I agree and I don't want to expose too much if we think it's not necessary. I wasn't actually thinking of making sure to have enough threads, but being afraid of starting too many as that's often making things bloated, inefficient and hard to diagnose when taking thread dumps.
Would it be reasonable to default to one single thread, which is shared across all indexes? It would be conceivable to have these defaults hardcoded but re-configurable by JVM properties only? Not having any way to change these makes me a bit nervous, but if we make it a JVM property it would still need to be documented somewhere, and we might as well want to expose it as normal (least surprise).
I suspect a single thread for all indexes would be fast enough, but sharing Executor among threads we wouldn't be able to name the thread to a specific index following this approach. Considering that Infinispan would use a SearchFactory for each Cache, if we really want to reduce the number of threads we might want to allow injecting the Executor as a Service.
|