-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Growing number of NioEventLoopGroup threads #165
Comments
Hi @oklahomer The EventLoop threads are an infrastructure resource that is expensive to create and to remove so they are kept alive until the client resource is closed. A thread is not bound to a particular connection, but a connection binds to one EventLoop thread which means that one thread can be used for more than one connection. To answer your question: This behavior is by design to facilitate scalability. wg/lettuce#34 is different because it's about daemon threads vs. regular threads. 3.4 and 4.1 are using daemon threads. |
Thanks @mp911de for quick reply. |
@mp911de Just to make sure, let me ask a bit more. With the code fragment above, we only have one client instance at all time. In the I think it's neat that client instance manages those threads' life-cycle, but got a bit confused to see how it's actually working. |
The answer is yes and no. The underlying facility that provides Threads to the client is the The thing of multithreaded There are two things you can do to limit Threads:
Come back to me if you need further support. |
Thanks again for detailed comment. I checked with the code fragment above and the number actually stopped at 32, where Thanks. |
Currently I am working on Redis Cluster interaction, so I tried out a couple of client modules: Jedis and lettuce. So far I prefer lettuce over Jedis in terms of handiness and robustness.
I, however, bumped into a strange behavior when I closed connection(s) via RedisAdvancedClusterConnection#close. I understand it creates new thread(s) for new connection handling, but it does not seem to be removed when the connection is closed. Below is the code fragment my colleague gave to me.
Try trace the count of threads and see it grows.
3.3.1.Final and 3.3.2.Final both reproduce this issue.
I tried to see if they were reused after reaching some kind of threshold, but no luck.
I also found a similar issue on the old repo, wg/lettuce#34 .
Is it going to be fixed? Or is there any solution or workaround?
The text was updated successfully, but these errors were encountered: