'Is it any downside or overhead to Redis Pipeline for executing small set of commands?

I'm reading that using Redis Pipeline could improve performance by sending a batch of commands to the Redis server rather than sending separate messages one by one which could add up in latency time. In this way, there is a rough correlation between the number of separate commands that you have in a pipeline batch and how much you improve in speed. My question is that, is there an overhead or a downside to using Redis Pipeline that would make it not worth it in certain situations, especially when there are just a few simple commands that are being executed not so often? I understand the actual improvement in these cases would be very marginal, but I'm wondering if using Pipeline could worsen the execution time actually by introducing some sort of overhead?



Solution 1:[1]

The overhead of pipeline is that Redis needs to queue replies for these piped commands before sending to client, i.e. cost memory. So, normally, you'd better not create a huge pipeline.

In your case, since your pipeline only has a few simple commands, it's not a problem.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 for_stack