Pipeline和Batch

Using Batch (mget, mset single command like) for a plurality of key commands, one time a plurality of commands to be submitted in the past, to bring in the less significant network transmission loss

 

PipeLine pipeline

  Pipeline can be packaged after issuing multiple commands from Client (Client) together, Redis server processes the result packaged in multiple commands occurs after a plurality of commands to return to the client, with a single command execution sequence comparison, Pipeline use greatly reduces the number of communications with the client redis server, thereby reducing the round-trip delay time. Select pipeline client buffer, the server selection Multi buffer; multi / exec atomicity can be guaranteed, and the pipeline does not guarantee atomicity. In order to ensure atomicity combination of multiple commands, Redis provides a simple transaction, and integrated Lua script to solve this problem.

advantage

Pipeline by changing the order in response to a request to reduce the RTT

Reduce the number of IO calls (IO call involves switching between the user mode to kernel mode)

The need to control the size of the Pipeline, otherwise it will consume Redis memory

 

RTT, round trip time, i.e. the round trip time refers to the time a response to the request. redis communication protocol is tcp based on a request / response protocol may send the next request to send a request, in response to the read before the whole is the round-trip time RTT.

 

Published 50 original articles · won praise 2 · Views 2272

Guess you like

Origin blog.csdn.net/eafun_888/article/details/104714212