当前位置:网站首页>Redis pipeline technology speed and efficiency increased by 5 times
Redis pipeline technology speed and efficiency increased by 5 times
2022-06-24 04:54:00 【User 1685462】
Redis It's a client based - Server model and request / In response to the protocol TCP service . This means that normally a request follows these steps :
- The client sends a query request to the server , And monitor Socket return , Usually in blocking mode , Waiting for the server to respond .
- The server handles commands , And return the result to the client .
Redis Pipeline technology
Redis Pipeline technology can be used when the server is not responding , The client can continue to send requests to the server , And finally read all the server's responses at once .
example
see redis The Conduit , Just start redis Instance and enter the following command :
$(echo -en "PING\r\n SET runoobkey redis\r\nGET runoobkey\r\nINCR visitor\r\nINCR visitor\r\nINCR visitor\r\n"; sleep 10) | nc localhost 6379 +PONG +OK redis :1 :2 :3
In the above example, we use PING Command view redis Is the service available , And then we set up runoobkey The value of is redis, Then we get runoobkey And make visitor Self increasing 3 Time .
In the returned results, we can see that these commands are directed to redis Service submission , And finally read all the server's responses at once
Advantages of Pipeline Technology
The most significant advantage of pipeline technology is the improvement of redis Service performance .
Some test data
In the following test , We will use Redis Of Ruby client , Support pipeline technical characteristics , Test the effect of pipeline technology on speed .
require 'rubygems'
require 'redis'
def bench(descr)
start = Time.now
yield
puts "#{descr} #{Time.now-start} seconds"
end
def without_pipelining
r = Redis.new
10000.times {
r.ping
}
end
def with_pipelining
r = Redis.new
r.pipelined {
10000.times {
r.ping
}
}
end
bench("without pipelining") {
without_pipelining
}
bench("with pipelining") {
with_pipelining
}From... In the LAN Mac OS X The data of executing the above simple script on the system shows that , After opening the pipeline operation , Round trip delay has been improved to a fairly low level .
without pipelining 1.185238 seconds with pipelining 0.250783 seconds
As you can see , After opening the pipe , Our speed and efficiency have improved 5 times .
边栏推荐
- How to build an ECS and how to control the server through the local host
- How to enlarge the ECS page? How to select ECS instance specifications?
- What is the principle of Ping? How does the server disable Ping?
- Loss and optimization of linear regression, machine learning to predict house prices
- SAP mts/ato/mto/eto topic 8: ATO mode 2 d+ empty mode strategy 85
- Abnova fluorescence in situ hybridization (FISH) probe solution
- Application practice of helium decentralized lorawan network in Tencent cloud IOT development platform
- 梯度下降法介紹-黑馬程序員機器學習講義
- What is the experience of developing an ice 3D music player in 3 minutes?
- LeetCode 1791. Find the central node of the star chart
猜你喜欢

SAP mts/ato/mto/eto topic 10: ETO mode q+ empty mode unvalued inventory policy customization

"Emergency response practice" logparser log analysis practice

C语言自定义类型的介绍(结构体,枚举,联合体,位段)

Idea creates a servlet and accesses the 404 message

阿里云混合云首席架构师张晓丹:政企混合云技术架构的演进和发展

重新认识WorkPlus,不止IM即时通讯,是企业移动应用管理专家

Analysis on the subjective enthusiasm of post-90s makers' Education

Zhang Xiaodan, chief architect of Alibaba cloud hybrid cloud: evolution and development of government enterprise hybrid cloud technology architecture
2020年Android面试题汇总(中级)

少儿编程课程改革后的培养方式
随机推荐
After purchasing Tencent ECs, how to solve packet loss in Internet access?
What is an evpn switch?
Powerbi - for you who are learning
Facebook internal announcement: instant messaging will be re integrated
『渗透基础』Cobalt Strike基础使用入门_Cobalt Strike联动msfconsole
Analyzing the superiority of humanoid robot in the post human era
How to build an ECS and how to control the server through the local host
getAttribute 返回值为null
What is the role of ECS? How does FTP connect to ECS configuration?
提pr,push 的时候网络超时配置方法
查找GBase 8c数据库当前索引?
Brief introduction: how much do you know about supply chain attacks
How to control CDN traffic gracefully in cloud development?
How RedHat 8 checks whether the port is connected
Getattribute return value is null
How does the compiler put the first instruction executed by the chip at the start address of the chip?
TCPIP协议详解
Network timeout configuration method when PR and push are proposed
What is the experience of developing an ice 3D music player in 3 minutes?
The trunk warehouse can also be tob, and Tencent cloud microenterprises do not leave quality behind