Tailslayer: Library for reducing tail latency in RAM reads
TL;DR Highlight
Replicating data across DRAM channels and using the first read result cuts refresh-induced tail latency.
Who Should Read
A low-latency C++ developer troubled by microsecond-scale jitter in RAM reads.
Core Mechanics
- Refresh stalls cause RAM tail latency
- DRAM refresh stalls are the source of tail latency in RAM reads.
- Tailslayer is a C++ library that reduces it.
- Replicate across channels, use the first reply
- Data is replicated across independent DRAM channels with uncorrelated refresh schedules.
- On a request, hedged reads go to all replicas and the first result is processed.
- Undocumented channel scrambling offsets are used
- The offsets place data across channels.
- The README says they work on AMD, Intel, and Graviton.
- Usage is a signal function and a work function
- The signal function waits for an external event and returns the index to read, and the read fires immediately.
- The work function receives the value right after the read.
- The cost is memory and cores
- Each insert copies the element N times, where N is the replica count.
- Each replica is pinned to its own core and spins there until the read happens.
- Only two channels supported for now
- The library currently works with two channels, with updates to come.
- Full N-way usage is available in the benchmark.
Community Reactions
- Commenters learned refresh stalls reads and writes
- One commenter had thought refresh was fully asynchronous.
- Another praised the explanation of how addresses map to channels, ranks, and blocks.
- Concern that replication hurts cache hit rate
- A commenter asked whether a larger working set would erase the gains through lower cache hit rates.
- They also asked whether all-but-one replica reads are uncached.
- ECC correction and scrubbing may matter more for hard real-time
- A commenter said this covers the bounded short tail, while correctable-ECC-error scrub is a longer tail.
- Hope for a transparent hardware solution
- One commenter wondered if hardware could duplicate memory across channels and return the first result without threads or racing.
- Understood as a space-for-time trade-off
- One commenter read it as using more memory to get shorter access times.
How to Apply
- Build and run the example
- Clone the repo, run make, then ./tailslayer_example.
- Read how the signal and work functions are wired together.
- Measure the effect on your machine
- In discovery/benchmark, run make, then sudo chrt -f 99 ./hedged_read_cpp --all --channel-bit 8.
- Check the read latency distribution yourself.
- Apply it to a latency-sensitive lookup table
- Pick a small read-only table, copy include/tailslayer, and wrap it in HedgedReader.
- Calculate the extra memory and pinned cores first.
Try It
# Run in a shell (commands exactly as in the README)
git clone https://github.com/LaurieWired/tailslayer
cd tailslayer
make
./tailslayer_example
# Benchmark
cd discovery/benchmark
make
sudo chrt -f 99 ./hedged_read_cpp --all --channel-bit 8Terminology
Related Papers
A Beginner's Guide to Local AI with Inkling, Qwen, and Unsloth
Install Unsloth Desktop, load a quantized Qwen model, and share a private ChatGPT-like AI on your home LAN.
Muru – AI-assisted Rust server for Python apps by mod_WSGI's creator
mod_wsgi's creator is building Muru, an AI-assisted Rust ASGI/WSGI server, documenting it in public
87% of the Anthropic power will come from gas and 11% from coal in 2028
Analysis of Anthropic's contracted data centers: 87% gas, 11% coal power in 2028
Anthropic’s Nasdaq debut
Anthropic listed on Nasdaq and closed its first day below its opening price.
OpenAI still has a WebRTC Problem
WebRTC drops late audio, hurting voice AI; MoQ retransmits and buffers instead
Gemini 4 Neon
Gemini 4 Neon cuts cost per task 32% versus Carbon, at $3 input and $15 output per million tokens
AI is killing All About Berlin
After Google AI Overviews, a Berlin guide site lost 70-75% of its traffic.
Not Everything Needs an LLM
PostHog used small decision models to skip 98.7% of expensive LLM calls