C++ library for reducing tail latency in RAM reads by hedging across multiple DRAM channels with uncorrelated refresh schedules
Skill by ara.so — Daily 2026 Skills collection.
Tailslayer is a C++ library that reduces tail latency in RAM reads caused by DRAM refresh stalls. It replicates data across multiple independent DRAM channels with uncorrelated refresh schedules, issues hedged reads across all replicas simultaneously, and returns whichever result responds first — eliminating worst-case stall spikes from DRAM refresh cycles.
Works on AMD, Intel, and AWS Graviton using undocumented channel scrambling offsets.
git clone https://github.com/LaurieWired/tailslayer.git
cp -r tailslayer/include/tailslayer /your/project/include/
#include <tailslayer/hedged_reader.hpp>
git clone https://github.com/LaurieWired/tailslayer.git
cd tailslayer
make
./tailslayer_example
tailslayer::HedgedReader<T, SignalFn, WorkFn, SignalArgs, WorkArgs>Template parameters:
| Parameter | Description |
|---|---|
T | Value type stored and read |
SignalFn | Function that waits for a trigger and returns the index to read |
WorkFn | Function called with the value immediately after read |
SignalArgs | (optional) tailslayer::ArgList<...> of compile-time args to signal function |
WorkArgs | (optional) tailslayer::ArgList<...> of compile-time args to work function |
HedgedReader(
uint64_t channel_offset = DEFAULT_OFFSET, // undocumented channel scrambling offset
uint64_t channel_bit = DEFAULT_BIT, // bit used for channel selection
std::size_t n_replicas = 2 // number of DRAM channel replicas
)
reader.insert(T value); // Insert value, replicated across all channels
reader.start_workers(); // Launch per-channel worker threads (blocking)