In the Redis protocol documentation it states:
A client can use the same connection in order to issue multiple
commands. Pipelining is supported so multiple commands can be sent
with a single write operation by the client, it is not needed to read
the server reply in order to issue the next command. All the replies
can be read at the end.
However, I can’t find any example of how this is actually implemented. How does a Redis client implement pipelining?
As long as you can easily delimit messages on a TCP stream, little support is really needed for a server to support pipelining, the TCP stack will buffer the data for you, and as a server you can just read/parse requests one-by-one, and send replies back as you finish the requests. The client/server just needs to be aware and handle the cases when these buffers fill up, as to not deadlock.
That said, for redis take a look at processInputBuffer()/processMultibulkBuffer() in networking.c , redis has its own output buffering as well, see e.g. addReply()