简体   繁体   English

apache点燃与亲密关系的服务

[英]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. 我想使用服务在点燃时运行服务/计算jub,但运行数据所在的作业。

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? 也许有一种方法可以直接调用具有亲缘关系的服务代理以避免使用comupte?

ps 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. ps原因是该服务产生更多的缓存数据,我想避免在节点和客户端之间来回传输大数据。

Unfortunately, there is no way to tell Ignite, which service instance to use, based on the argument of the method being called. 不幸的是,无法基于被调用方法的参数来告诉Ignite使用哪个服务实例。

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 否则,您可以尝试将所需的资源注入计算作业: https : //apacheignite.readme.io/docs/resource-injection

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM