douzao5487 2014-12-02 06:06
浏览 51

PHP + Redis中的实际流水线操作,而不是批处理

There's a lot of information on "pipelining" in PHP+Redis on the web. However, When you actually start looking at the examples, not a single one of them does actual pipelining. All they do is batch processing. As examples, let's take Predis ->pipeline() (https://github.com/nrk/predis) and Phpredis ->multi() (https://github.com/nicolasff/phpredis). They basically suspend execution of commands and instead collect the commands into a buffer, then execute them as a batch when calling ->execute() / ->exec() later.

Disadvantages: - has to allocate a command buffer that can grow large for many commands - needs a round-trip to the server once for every batch of commands

The behaviour I would expect from pipelining mode is: Start sending commands as soon as I pass them to the client, not buffer them. Return before the response for a command has arrived. Allow to send more and more commands while the previous ones are "in flight". Once in a while, collect responses from the client that have arrived, without waiting for responses that have not yet arrived.

The strange thing is that the examples actually pass constants to the client that are called "pipelining", yet they describe the behaviour as batch processing.

Big question: How can you actually put those clients into pipelining mode?

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥100 为什么这个恒流源电路不能恒流?
    • ¥15 有偿求跨组件数据流路径图
    • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
    • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
    • ¥15 CSAPPattacklab
    • ¥15 一直显示正在等待HID—ISP
    • ¥15 Python turtle 画图
    • ¥15 stm32开发clion时遇到的编译问题
    • ¥15 lna设计 源简并电感型共源放大器
    • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)