-
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
Pass Finagle Future into FuturePool Threads #862
Comments
Hi, Before
After
|
Hi for the answer. Basically I have the problem that Finagle by default use an ExecutionContext with same number of threads as cores I have in my machine. And with block operations that number is not enough for a good performance and I would like to use another ExecutionContext with more Threads. Here what I tried so far
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
|
Where is the blocking code being run? The same thread will run continuations for Twitter Futures & Promises if you adjusted the following, I believe you'll see the desired affect. With the sample you've posted |
Hi @hamdiallam This code that I posted was extracted from one filter that is trying to do that. The change you suggest it does not work and I think is logical. The code is just transfering the Finagle thread content into the promise, but when that happens it's too late since the whole request/response has been done in the Finagle Netty thread. As I see this is a death end I will stop and I will just use the java param we can pass in the process to specify number of workers. You can close this ticket unless someone else can tell any other workaround @hamdiallam thanks for all the support mate, cheers |
@politrons From my experience you should never block Netty threads if you're looking for high and predictable performance of your service and offload blocking code to another pool. You could try 2 things, both described here - https://twitter.github.io/finagle/guide/ThreadingModel.html Just increase number of threadsOr per entire application (JVM process), using command-line flags:
Offload blocking/heavy codeOffloading can be done on per-method (endpoint) basis:
As well as per entire client or server:
|
We're using version 18.11.0 which not contains Thanks |
Can you clarify how the suggestion I posted does not work? I tried it out right now and does. It's the same mechanism in the OffloadFilter In this example you can consideer
outputs "GroupB-1" |
Basically I have the problem that Finagle by default use an ExecutionContext with same number of threads as cores I have in my machine. And with block operations that number is not enough for a good performance and I would like to use another ExecutionContext with more Threads.
Here what I tried so far
But the only thing that I achieve is to move the response from the request in the
FuturePool
what I would like to do is make the request in theFuturePool
alreadyHere as you can see the request/response is done in the finagle/netty thread pool
FINAGLE RESPONSE Return(Response("HTTP/1.1 Status(200)")) IN THREAD finagle/netty4-1-10
The text was updated successfully, but these errors were encountered: