Understanding of database connection pools, long connections, and short connections

TCP connection: The TCP connection between the node and the node needs to go through three handshakes for data communication.
TCP connection 3-way handshake: Reference: http://www.jellythink.com/archives/705


Long connection: After TCO is established, it is a long connection. As long as you do not disconnect, you can continue to lose data.
Long connections are suitable for situations where a large amount of data is to be transmitted, such as databases, redis, memcached, etc. that require fast speed and a large amount of data.
The long connection monitors the connection status through the heartbeat mechanism (with little communication data), and reconnects after disconnection.


HTTP connection: HTTP connection is a short connection. Every time a request is initiated, a TCP connection is established, and the connection is disconnected after responding to the request. This prevents the client from occupying the server's resources for a long time, and maintaining the connection requires threading.


The database connection pool means that the server application establishes multiple connections to the database, and the unused connections are placed in the connection pool. time) is much faster, thereby improving transmission efficiency.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326686699&siteId=291194637