-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Set own ExecutionContext in Twitter future #860
Comments
Hey, I believe what you're looking for is a You can create a FuturePool backed by a supplied ExecutorService. The work in the |
How is this FuturePool used once I created?. Finagle Service does not apply a function param for this FuturePool. shall I defined as implicit like Scala Future allow and that's it?. Sorry I´m little bit lost here. |
No problem, I understand the confusion. Some clarity around what you are trying to accomplish would be helpful. In terms of By default, all of Finagle's futures are scheduled using the FinagleScheduler. This can be configured or entirely swapped if this is what you're looking to configure (i do not recommend). Scheduler.setUnsafe If you're simply looking to do some computation into another thread pool that's backed by your own Executor, this is where
However, the global Scheduler is what is responsible for scheduling the submitted Runnables to corresponding threads (FinagleScheduler or one that you set). |
How would you use a FuturePool with a Finagle What I want is to make the request of the Finagle Service running in a particular
I made several experiments with and without Twitter Future with Twitter Future
I can only reach 41 TPS with Scala which use a Execution context of 100
I can have 61 TPS. As you can see the difference of performance is huge, and is because the Any suggestion how to force |
I see. Have you looked using the Offloading functionality in Finagle, https://twitter.github.io/finagle/guide/ThreadingModel.html#offloading? The threads used by Finagle are IO threads. Blocking these threads will impact performance. Using the offload filter to run your application code in a dedicated thread pool would mitigate this. For example, 14 worker (application) threads and 14 IO threads. I believe this would give you the behavior you're looking for if I'm not mistaken |
I´m afriad I cannot use offloading in our mandatory version 18.11.0 😒 |
Ah, I didn't realize you also posted #861 The offload filter can still be applied manually to your client/server stacks. Did you get a chance to see my latest comment there? |
Hi,
Yes I was trying now to apply that code. I guess is just the Client class which is a filter right?.
Can I use composition with andThen using that class?
Enviado desde mi iPhone
… El 25 jun 2020, a las 21:10, Hamdi Allam ***@***.***> escribió:
Ah, I didn't realize you also posted #861
The offload filter can still be applied manually to your client/server stacks. Did you get a chance to see my latest comment there?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
yep! It would look something like this
Be sure to share the The number of IO threads by default is the number of cores on the machine. If you'd like to change that, this flag should still be available to you |
Yep I just create my own Filter and I add it the Service
Unfortunately no improvement so far. I will continue investigating. |
hm interesting. I would also recommend profiling your service/code to find blocking threads, making sure they aren't finagle threads |
I´ve been playing with visualVM and I can see the 100 threads of the FuturePool that I created, but they are park, and I can only see the 24 threads of finagle/netty4 running. Checking the API of future
It that's means that it will be executed in the Finagle main thread until receive response?, that would not fix then our problem
I dont think the interrupt and shifted is working as we expect. 😔 I will try to do a very simple example to see if that filter works out of my whole project. |
Hi again I made a very simple example, and watching threads with
|
I cannot make work this code to make the Finagle service run in FuturePool threads, always is running in Netty-finagle-X threads
But the only thing that I achieve is to move the response from the request in the Here as you can see the request/response is done in the finagle/netty thread pool
|
Closing in favor of #862 |
Hi I´m reading the documentation regarding the Futures and Context where to execute them https://twitter.github.io/finagle/guide/Contexts.html
But I cannot find a way to pass to finagle to use my own ExecutionContext as you can do with Scala future.
There's any way to do that?.
Regards.
The text was updated successfully, but these errors were encountered: