THUNDER-ARCHITECTURE(7)
Reference indexNAME
thunder-architecture — how Thunder stores a value and finds it again
ROUTING
Thunder divides its keys among 1,024 stores called shards. A server worker, called a reactor, handles all reads and writes for the shards it owns.
Give the client one server address. On that first connection, it asks which reactor owns each shard and which port the reactor uses. To read or write a key, the client hashes the key’s bytes and sends the request directly to the owner.
shard = CRC32C(key) % 1024
port = starting_port + reactor_index
Suppose a model saves a report under results/run-007/report. The formula above puts that key in shard 949. With four reactors, reactor 3 owns shards 768–1023. If ports start at 7380, the client writes the report to port 7383. A later read of the same key goes to the same port while the layout stays the same. Trace another key.
CPU TOPOLOGY
Set THUNDERSTRIKE_CORES to the number of physical cores Thunder may use. Each reactor group needs two hardware threads. One runs the reactor. Its background workers share the other.
With eight cores and two usable hardware threads per core, Thunder starts eight reactors. If the process sees one thread per core, the same eight cores support four reactors. The shard count stays at 1,024. Each reactor gets a consecutive range of shards, a port, and its own block of working memory (the arena).
LARGE VALUES
A single key can hold an entire file. To write a 512 MiB file, its reactor needs room for two copies of the value, or 1 GiB. Other writes to the same reactor and values already in its cache share that memory.
For 512 MiB values, set THUNDERSTRIKE_ARENA_BYTES=4294967296 (4 GiB per reactor). Four reactors then reserve 16 GiB before the rest of the process is counted. See memory and disk sizing.
DURABILITY
A successful write means its entry in Thunder’s journal is on disk. On restart, Thunder recovers the stores before it accepts client connections. If an agent saved a checkpoint and received a reply confirming the write, its next worker can read that checkpoint by key.
Thunder uses TLS 1.3 for client connections and encrypts stored values. To restore a backup, you need the data volume and its keystore passphrase.
DIAGNOSTICS
- The client connects, but some keys time out
- The initial connection tests one port. The client also needs a route to every port in the shard map. Compare the ports in
docker compose pswith the mappings incompose.override.yaml. - The core budget or CPU layout has changed
- After a clean stop, run the release kit’s
configurejob to regenerate the port mappings, then start the server. After a crash, first restart with the previous reactor count so each reactor can recover its journal. Stop cleanly before applying the new allocation.