1

I am trying to build an application using Lettuce as a Redis Client. I know that Lettuce provides Asynchronous and Non-Blocking Connection. One connection to the application is shared by multiple threads, but then what is the behavior if the application accepts too many requests? Is it necessary for the application to have an exception handling when the connection reaches its limit?

sksm216
  • 75
  • 5

1 Answers1

2

With Lettuce, you build your application such that you open very few connections and use it across threads. Lettuce connections are thread-safe and hence in theory just 1 connection can support all your Redis operations across application threads. So you will never reach a situation where you have too many Redis connections open within your application since you are responding to too many concurrent requests - that would be an application bug if that happens.

There is one situation where you would not want to share a connection and is explained as an answer to a previous question about blocking commands. Most applications would not require more than 2-4 open connections (to accommodate for pub/sub, polling pattern on blocking commands, transaction etc) to Redis when using Lettuce.

Ashwin Prabhu
  • 9,285
  • 5
  • 49
  • 82