-
Notifications
You must be signed in to change notification settings - Fork 4
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
optimization around get for raw usage #44
Conversation
|
||
post_get_req = optimized_for_raw ? "v k q\r\n" : "v f k q\r\n" |
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.
by not having the f
we save 2 bytes on all 100 get calls and we remove the bytes that includes the bitflags in the response, which in this case we do not want or need.
@@ -68,25 +74,42 @@ def read_multi_req(keys) | |||
# VA value_length flags key | |||
tokens = line.split | |||
value = @connection_manager.read_exact(tokens[1].to_i) | |||
bitflags = optimized_for_raw ? 0 : @response_processor.bitflags_from_tokens(tokens) |
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.
since we didn't ask for the response to have fit flags they will not be there and will be 0, skip all the parsing. across the whole batch.
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.
Are there test for this?
mostly it was driven by the benchmark and profile, I can add a test |
OK, starting to hit a wall with most of the profile and benchmark data, but we will talk more with some YJIT folks next week.
This is a small win, but does show up in the profiles and benchmarks, and should be more significant with remote vs local memcached servers as it reduces the total bytes on the socket write and read. This performance tweak only works on the
raw: true
client, which is what we use.multi_get before:
multi_get after:
and get before:
and get after: