Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the benefits of using persistent connections in Redis

Shulou Source: shulou.com Published: 2022-06-01 06:58:22 11月16日 Update

This article mainly shows you "what are the benefits of Redis using long connections", the content is simple and clear, and I hope it can help you solve your doubts. Let me lead you to study and learn this article "what are the benefits of using long connections in Redis".

Use long connection

Redis is a request-response server based on the TCP protocol. The use of short connections results in frequent creation of connections.

Short connections have the following slow operations:

When creating a connection, TCP executes policies such as three-way handshake, slow start, and so on.

Redis triggers a new / disconnected event to perform time-consuming operations such as assigning / destroying clients.

If you are using Redis Cluster, when you create a new connection, the client will pull the slots information to initialize. It is slower to establish a connection.

Therefore, compared to the fast-performing Redis, creating a connection is a very slow operation.

It is recommended that you use connection pooling and set the connection pool size reasonably.

However, when using long connections, you need to pay attention to the "automatic reconnection" strategy. Avoid network anomalies that lead to connection failure and affect normal business.

The above is all the contents of the article "what are the benefits of using long connections in Redis". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Benefits content articles customers clients policies slow learning help frequency business events information size suggestions performance understandability more servers organization Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Xiaomi Shulou Technology macOS Redmi