Description
With the removal of ExecutorScheduler
in 0.18, we also lost the thread caching on the IO Scheduler, as it now just uses NewThreadScheduler
.
This causes performance problems and thread growth in use cases where lots of short-lived IO actions are performed.
We can just revert to using an Executor as before, since multi-threaded Executors can't maintain the Rx contract. This means we need to either:
a) figure out how to implement the Rx contract on top of an Executor
b) add thread caching to NewThreadScheduler
or create a new implementation of CachedThreadScheduler
for IO.
The problem with a) is that an Executor has it's own queue, and to ensure sequential execution we'd have to build separate queues on top and then only put something into the Executor queue when the next action can be performed. This is an awkward relationship between them, and adds overhead because it's queueing twice and has extra machinery between each task, so not good for performance.
I think b) is the more efficient and straight-forward approach.