BMC: Accelerating Memcached using In-kernel Caching and Pre-stack Processing
pchaigno.github.io
pchaigno.github.io
They focused only on short keys and values, only on UDP, used a simple hash table with no collision algorithm, and still had to split the code into 7 ebpf programs.
Quite an achievement though, I didn't think it was possible.
Also it seems udp memcached is not popular and hasn't been optimized well - it uses a single socket and spends a lot of time fighting for the kernel lock on that socket. Both the authors and Facebook patched memcached to get around that bottleneck. It's surprising that hasn't yet found its way upstream.
> In userspace, Memcached consists of well-optimized data structures to handle key-value pairs, with an LRU algorithm to evict “stale” data.
Memchached itself has also no well-optimized hashing nor a modern swiss-table like hashtable. It can be easily made at least 2x faster on modern CPU's.
Doing it upfront in the kernel is if course a better idea, but I would have expected at least proper modern core hashtables, not 90ies tech.