Search code examples
javaignite

Could I use igniteQueue in another cache.invoke() function?


Could I use igniteQueue in another cache.invoke() function?

In Ignite Service A's excute function:

cacheA.invoke(record){ // do process to record

igniteQueue.put(processed_record);

}

In Ignite Service B's excute function:

saved_processed_record = igniteQueue.take();

It runs smoothly when TPS is low, but when i running with high TPS, some times I get "Possible starvation in striped pool" in log,

See my previous post: Ignite service hangs when call cache remove in another cache's invoke processor, " Possible starvation in striped pool"?

It seems I use igniteQueue in cache.invoke is also not correct vs. use ignite cache in cache.invoke?

So if i could not use ignite queue in a cache.invoke(), is there a better way to do so? I have try to use another message queue(kafka or redis) instead ignite queue in the cache, but we know Ignite say it is also a message queue, using kafka in ignite invoke seems very strange, how could i use pure ignite to achive this?


Solution

  • You should not issue any blocking operations from "invoke(..)" method, as it executes within a lock on the key. Instead, why not create another thread pool and have it be responsible for adding and taking objects from the IgniteQueue. Then you can simply submit a task to that thread pool from the "invoke(..)" method and inside that task enqueue an object.