Add MemcacheSocket class and response types with CI tests#13
Merged
Conversation
This was referenced Mar 11, 2026
Merged
Member
Author
antoniobg
reviewed
Mar 11, 2026
antoniobg
left a comment
There was a problem hiding this comment.
Overall this is a really impressive change — the performance gains are substantial and the code is well-structured. I found a few issues worth addressing before merging, mostly around socket/OS-level edge cases.
antoniobg
approved these changes
Mar 11, 2026
2b057da to
682cb21
Compare
8f3a54c to
bf04b6e
Compare
682cb21 to
5b0186d
Compare
This was referenced Mar 13, 2026
5b0186d to
bf6ddf8
Compare
e6bb63a to
7fc665e
Compare
7fc665e to
119e70e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Motivation / Description
This pull request introduces a high-performance Rust-based
MemcacheSocketclass that provides low-level socket operations for memcache protocol communication. The implementation focuses on performance optimization through zero-copy operations, efficient buffer management, and GIL-free I/O operations.This replaced the python-implementation in meta-memcahce-py extension and provides 20% faster gets and 40% faster set/deletes (less CPU) on multithreaded tests:
Latency per-request is not that measurable, as typical memcache latency will be dominated by the network, but it significantly reduces CPU usage, allocations and GIL lock time.
Before/after with 10 threads doing operations on a loop against a local memcache.
Changes introduced
MemcacheSocketclass with methods for sending commands (sendall), receiving responses (get_response), and reading value data (get_value)Value,Success,Miss,NotStored,Conflict) to represent different memcache server responsesSERVER_VERSION_AWS_1_6_6,SERVER_VERSION_STABLE) for compatibility with different memcache server implementationslibcdependency for direct system call access to socket operationspoll()uvandmaturin