Gadi
Gadi

Reputation: 1629

apache ignite cumpute service with affinity

I would like to run a service/compute jub on ignite using a service but run the job where the data is.

from the client I will either call a compute or service proxy but need the service to run near the cache data.

I noticed you can use a service from a compute job:

compute.run(new IgniteRunnable() {
  @ServiceResource(serviceName = "myCounterService");
  private MyCounterService counterSvc;

If I deploy the service on every node in the cluster can I use compute with near cach to do this?

 compute.affinityRun(CACHE_NAME, key, () -> { 
      // call my servie here...

maybe there is a way to directly call a service proxy with affinity to avoid using comupte?

p.s. the reason is the service preduce more cache data and I would like to avoid transferring large data between nodes and clients back and forth.

Upvotes: 0

Views: 586

Answers (2)

Denis Mekhanikov
Denis Mekhanikov

Reputation: 3591

Unfortunately, there is no way to tell Ignite, which service instance to use, based on the argument of the method being called.

Services are good when you need to store some state in them. Otherwise compute jobs are just as effective. Moreover, compute jobs are used internally to call services' methods.

So, if you don't have any state, then just use the compute jobs. Otherwise you can try injecting needed resources into compute jobs: https://apacheignite.readme.io/docs/resource-injection

Upvotes: 3

sanluck
sanluck

Reputation: 1554

You can use Affinity key based deployment

Upvotes: 0

Related Questions