Hi Ashish, If you use onRegion, the function will be executed on all nodes hosting data for the region. If you use withFilter, the nodes would be narrowed down to the ones hosting the set of keys passed.
If you want the function to be run in one node you have the two options already proposed: either use onRegion plus withFilter passing one key or use onServer. Do you really need to pass a set of keys to the function? Is it a function dependent data? If not, onServer should work for you. -Alberto On 18/9/19 15:30, aashish choudhary wrote: Any thoughts? With best regards, Ashish On Tue, Sep 17, 2019, 12:19 PM aashish choudhary <aashish.choudha...@gmail.com<mailto:aashish.choudha...@gmail.com>> wrote: Thanks Mike,Dan,Anil for your suggestions. We do use withFilter but we pass Set of keys not a single key while executing functions and we also have the optimizeforwrite set to true as best practices. We have redundancy of 3.With that primaries are basically split among 12 data nodes. We basically want to reduce calls to external http service. May be what Dan is suggesting something we can do. With best regards, Ashish On Tue, Sep 17, 2019, 12:39 AM Anilkumar Gingade <aging...@pivotal.io<mailto:aging...@pivotal.io>> wrote: Ashish, can you give more detail on your usecase/requirement...Is your requirement is to execute the function on all the nodes that host the region? If thats the case, what is expected to happen by calling the external service? Is only one node suppose to use the data/info from the external service. If your requirement is not to execute on all nodes; you can use the options as suggested by Dan and Mike. -Anil. On Mon, Sep 16, 2019 at 10:55 AM Dan Smith <dsm...@pivotal.io<mailto:dsm...@pivotal.io>> wrote: When you call FunctionService.onServer, you can pass it a ClientCache or a Pool. It will find a running server and execute on that. So you never pass it an individual server name. -Dan On Mon, Sep 16, 2019 at 10:22 AM Michael Stolz <mst...@pivotal.io<mailto:mst...@pivotal.io>> wrote: If you execute onRegion withFilter and a single filter key it will only be executed on the server who would host that key. -- Mike Stolz Principal Engineer, Pivotal Cloud Cache Mobile: +1-631-835-4771 On Mon, Sep 16, 2019 at 12:49 PM aashish choudhary <aashish.choudha...@gmail.com<mailto:aashish.choudha...@gmail.com>> wrote: We use onRegion call to make http request to external service inside function. Because of that it gets executed on multiple servers. So basically we will have to make nested call to another function using onServer to avoid multiple calls? But what if that node is down? With best regards, Ashish On Mon, Sep 16, 2019, 9:59 PM Dan Smith <dsm...@pivotal.io<mailto:dsm...@pivotal.io>> wrote: Hi Ashish, How are you executing your function? If you execute a function from the client with Function.onServer, it should only be executed on a single running server. -Dan