Managing connections
Connections to your IBM Cloud® Databases for Redis deployment use resources, so it is important to consider how many connections you need to tune your deployment's performance.
Redis connection limits
At provision, IBM Cloud® Databases for Redis sets the maximum number of connections to your Redis deployment to 10,000. Leave some connections available, as a number of them are reserved internally to maintain the state and integrity of your database.
Exceeding the connection limit for your deployment can make your database unreachable by your applications. If your connection limit is reached, you see the following error.
ERR max number of clients reached
Checking Redis connection limits
To display your current client connections, use the following CLI command with your admin user.
CLIENT LIST
The output can be filtered.
CLIENT LIST TYPE NORMAL
For more information, see Redis CLIENT LIST documentation.
Ending Redis connections
Due to the single-threaded nature of Redis, it is not possible to end a client connection while it is running a command. From the client point of view, the connection can never be closed in the middle of the execution of a command. However, the client will notice that the connection is closed only when the next command is sent (and results in network error).
The CLIENT KILL
Command closes a client connection.
For more information, see Redis CLIENT KILL documentation.
Redis connection pooling
One way to prevent exceeding the connection limit and ensure that connections from your applications are being handled efficiently is through connection pooling. Connection pooling minimizes the number of active connections against your deployment. For more information, see The Pooling of Connections in Redis .
Redis Context-based restrictions and Allowlisting
You can also use Context-based restrictions or allowlisting to manage and/or limit connections to your Redis deployment. For more information, see Context-based restrictions or Allowlisting.