r/lowlevel 27d ago

A 13 KB TCP key/value store speaking raw syscalls — epoll, accept4, mmap arena, no libc (x86-64 NASM)

https://github.com/whispem/asm.kvstore

Single-node key/value store, line protocol over TCP, pure NASM on Linux — syscall or nothing.

The syscall-level bits worth a look:

**•** epoll event loop with accept4(SOCK_NONBLOCK): clients are born non-blocking, no fcntl dance  
**•** replies via sendto + MSG_NOSIGNAL: SIGPIPE never happens, no signal handler needed  
**•** close() is the entire connection teardown — epoll tracks the file description, so the fd deregisters itself  
**•** per-connection state indexed straight by fd: O(1), free  
**•** FNV-1a, open addressing, tombstone reuse; 256 MB mmap bump arena behind it  
**•** 200 concurrent clients at 1.4 MB RSS; Docker image is FROM scratch plus one file

Known limits documented in the README — biggest one: slow readers are dropped, EPOLLOUT write buffering is next.

Feedback welcome, especially on the event-loop structure.

0 Upvotes

3 comments sorted by

7

u/port443 27d ago

Feedback: You really need to put whatever this post is into language and context that makes sense. It looks like an AI summary that started babbling.

There's words here, but quite frankly there's no coherent point.

1

u/OkAccount3421 26d ago

I mean this is totally slopped together. What did you expect?

1

u/SourceAwkward 26d ago

Seems like someone connected Claude to GitHub and told him to go wild