-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Set the default read/write buffer size of Redis connection to 32KiB #3483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@cxljs thank you for updating the Readme. I am still not convinced we need that big of a buffer to be allocated on startup. If you have the time, would you investigate how the reader will compare when reading with 8kb chunks? The reader will need some refactoring, but the writer should be fine, since we know how much data we should write. |
Hello @ndyakov , I agree that the default size of 256KB is a bit large for most scenarios. The default size of the receive buffer for TCP sockets is 128KB, so in most scenarios, a value <= 128KB (or 64KB?) should be sufficient.
I'll find some time to test it. |
I write a simple test: set a 1KB-32KB value, and use 10000 goroutines to concurrent get it. when value size = 8KB, the result:
It seems that let the read buffer size >= the average size of the value is sufficient. |
@cxljs from the example I can see the WriteBufferSize was always 256? Is this a mistake when printing or you left the write buffer the same? |
Yes, and the size of WriteBufferSize won't affect the test results.
I agree it. |
Signed-off-by: Xiaolong Chen <[email protected]>
Signed-off-by: Xiaolong Chen <[email protected]>
@cxljs would you like to work on this in this branch or I can merge this one and you (or I) can work on using 32k as default and fix all docs / comments related to it ? |
I'll update it directly in this PR. |
Signed-off-by: Xiaolong Chen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @cxljs !
No description provided.