使用pipelineing 优化你的redis查询

本文探讨了在使用大量Redis查询时,由于TCP连接的三次握手导致的性能瓶颈。通过引入pipelining技术,显著减少了查询延迟,提高了查询速度。对比未使用pipelining的情况,性能提升了约34倍。此外,还提到了Redis scripting作为另一种优化手段,尤其适用于需要在服务器端执行复杂计算的场景。
摘要由CSDN通过智能技术生成

最近做一个使用了大量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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值