cpp-bredis icon indicating copy to clipboard operation
cpp-bredis copied to clipboard

performance improvements ideas

Open basiliscos opened this issue 6 years ago • 1 comments

  1. Introduce prepared_command, which already holds serialized form, and yous it as item in ConstBufferSequence

in other words, the idea is to avoid output (tx) buffer linearization. Currently this technique is used with rx buffer on (and it used completely on the experimental branch).

Avoiding output linearization will really make bredis zero cost, as the user's payload will not be copied by bredis, and will be passed into OS-kernel directly.

basiliscos avatar Apr 19 '19 08:04 basiliscos

@ovanes Here are preliminary experimental PR:

https://github.com/basiliscos/cpp-bredis/blob/prepared-command/examples/speed_test_async_multi.cpp

it uses writev syscall under the hood and performs zero-copy for input commands.

but the performance for the bulk of small commands actually drops to 80..90 times. So, it does not worth in general case, however it might be worth for case when bredis is data-producer, i.e. generates huge amounts of data and feeds it to redis-server.

It might be useful to have mixed mode, i.e. allow linearization as well as zero-copy, but I'll wait further requests/cases from bredis-users.

basiliscos avatar Apr 28 '19 09:04 basiliscos