Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redisson client - thread safe

Is the redisson client thread-safe? In my application, I would like to maintain one client object and let all the threads use this to get/put to Redis. In the config, there are two parameters threads and nettyThreads. Do these parameters help create a connection pool? If yes, which among these should I use if my use-case is primarily simple get/put operations on Redisson objects?

Also, are these connections active throughout the life of the RedissonClient?

like image 630
Anirudh Jayakumar Avatar asked Sep 21 '17 22:09

Anirudh Jayakumar


1 Answers

Redisson client and all of its objects are thread safe. threads and nettyThreads are configuration for the internal thread pools.

Since netty uses event loop model that is similar to the way Redis works internally, you don't need a great deal of threads. The default value is twice the number of your processor cores, assuming you have hyper-thread or equivalent technology enabled. I would advise to start on the default value and see how you are getting on.

like image 166
Redisson_RuiGu Avatar answered Sep 29 '22 02:09

Redisson_RuiGu