-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ExecutorScheduler Concurrency and Performance Issues #713
Comments
- simpler (no one remembers the current names when talking about them) - does not tie naming to a particular implementation involving thread pools versus a pool of event loops or something similar (as we likely will change the implementation, see ReactiveX#713)
See ReactiveX#713 It was causing non-deterministic behavior, random test failures and poor performance.
See ReactiveX#713 It was causing non-deterministic behavior, random test failures and poor performance.
Removed |
See ReactiveX#713 for background on this.
I seem to be failing to understand how ComputationScheduler is a replacement for ExecutorScheduler. I was using ExecutorScheduler because I needed certain code to run in a certain thread. Specifically, I was using .observeOn() so the observer would be executed on the Android main thread. I'd also be perfectly happy with a scheduler that wraps a scala.concurrent.ExecutionContext instead, as that would be more idiomatic for Scala. Is there a way to do either with ComputationScheduler? |
I used it to bound the number of IO requests in progress at the same time to avoid saturating the memory of the receiver on Android. I guess I will have to find another way. |
It's not a direct replacement. The
You should use the AndroidScheduler: https://github.com/Netflix/RxJava/tree/master/rxjava-contrib/rxjava-android#observing-on-arbitrary-threads
That should be done as part of rxjava-scala: https://github.com/Netflix/RxJava/tree/master/language-adaptors/rxjava-scala
This is a valid use case (at Netflix we use Hystrix for that server-side, but that's not helpful for Android). I'm totally okay with The concurrent throttling case can be solved in other ways, including a If that was adopted into the core library, it would probably be something like What do you all think should be done? |
I would like to see the ExecutorScheduler come back without the default thread pool concurrency. ExecutorScheduler was the simplest way to delegate scheduling to the glib event loop: public class GlibExecutor implements Executor {
@Override
public void execute(@NotNull final Runnable runnable) {
Glib.idleAdd(new Handler() {
public boolean run() {
runnable.run();
return false;
}
});
}
} It looks like I now have to subclass rx.Scheduler directly. That seems straight-forward enough, but the ExecutorScheduler was very nice here. |
* fix resilience4j/resilience4j#712 * keep the 'which' as it is everywhere * fix unit test
The
ExecutorScheduler
, or at least the backing implementation ofSchedulers.threadPoolForComputation()
is needed because:It allows concurrent execution if used in a pattern other than sequential recursion. In other words, it doesn't protect against misuse: Fix Scheduler Memory Leaks #712 (comment)
Performance is very bad when doing recursion: Recursion on ExecutorService with >1 Thread is Slow #711
The text was updated successfully, but these errors were encountered: