最近做一个使用了大量redis查询的项目,发现查询速度并不是想象中那么快,在慢慢调试后发现,时间大多浪费在建立连接上去了,redis基于tcp连接的形式,每次查询数据都要经过三次握手,因而自己慢慢找原因。
终于在redis 的官方文档中看出,redis是一个基于tcp连接的的方式:
Redis is a TCP server using the client-server model and what is called a Request/Response protocol.
This means that usually a request is accomplished with the following steps:
1.The client sends a query to the server, and reads from the socket, usually in a blocking way, for the server response.
2.The server processes the command and sends the response bac