tuning socket i/o buffer size upto 16384 to get more throughputs #1940
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
in my user cases there are numbers of requests (around 200) pipelined, and the total size of such responses is much more than 8192 bytes, so in the lower tier it called a bit more times of the syscal 'recvfrom', and the outputs from strace is below:
12207 17:02:03.556594 sendto(289, "*5\r\n$9\r\nZREVRANGE\r\n$21\r\nfeed:user:*****:posts\r\n$1\r\n0\r\n$4\r\n1001\r\n$10\r\nwithscores\r\n", 81, 0, NULL, 0 <unfinished ...>
12207 17:02:03.560635 recvfrom(289, <unfinished ...>
12207 17:02:03.561209 <... recvfrom resumed> "*2000\r\n$24\r\n ..., 8192, MSG_DONTWAIT, NULL, NULL) = 8192 <0.000559>
12207 17:02:03.562899 recvfrom(289, <unfinished ...>
12207 17:02:03.563336 <... recvfrom resumed> "a70 ..., 8192, MSG_DONTWAIT, NULL, NULL) = 8192 <0.000432>
12207 17:02:03.565026 recvfrom(289, <unfinished ...>
12207 17:02:03.565464 <... recvfrom resumed> "bf5 ..., 8192, MSG_DONTWAIT, NULL, NULL) = 8192 <0.000433>
12207 17:02:03.567184 recvfrom(289, <unfinished ...>
12207 17:02:03.567765 <... recvfrom resumed> "459 ..., 8192, MSG_DONTWAIT, NULL, NULL) = 8192 <0.000577>
12207 17:02:03.569528 recvfrom(289, <unfinished ...>
12207 17:02:03.570149 <... recvfrom resumed> "32b ..., 8192, MSG_DONTWAIT, NULL, NULL) = 8192 <0.000617>
12207 17:02:03.572850 <... recvfrom resumed> "f89 ..., 8192, MSG_DONTWAIT, NULL, NULL) = 8192 <0.000681>
12207 17:02:03.574861 recvfrom(289, <unfinished ...>
12207 17:02:03.575534 <... recvfrom resumed> "a0- ..., 8192, MSG_DONTWAIT, NULL, NULL) = 8192 <0.000669>
12207 17:02:03.577385 recvfrom(289, <unfinished ...>
12207 17:02:03.577878 <... recvfrom resumed> "-f98 ..., 8192, MSG_DONTWAIT, NULL, NULL) = 1247 <0.000488>
and the hiredis is using the read buffer size hardcoded as 16384
https://github.com/antirez/redis/blob/unstable/deps/hiredis/hiredis.c
this PR tuned the read buffer size upto 16384, also the write buffer size was upto 16384, to take more throuthputs,
please review,
thanks,
harper