From 958dd3bc95bd46ca1b86b7f3a80d2a1626a1a17d Mon Sep 17 00:00:00 2001 From: tamirms Date: Fri, 25 Sep 2026 16:21:00 -0400 Subject: [PATCH] events: 8 KiB blocks for the hot store's event data A point read decompresses one block to serve one event of about 250 bytes, so a 32 KiB block made every cache miss decompress about 128 events to serve one. Measured on the events corpus at limit=1000, 8 KiB against 32 KiB: service p50 -53%, p99 -59% and peak RSS -41% at stress density (sac-6000); neutral at pubnet density; +0.8% disk; ingest unchanged. 4 KiB adds nothing further. This is the hot tier only. RocksDB reads any block size, so existing databases keep working and pick up the new size as compaction rewrites them. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01QHnF5BhsuoxpWxGmatQzmt --- .../internal/rpcv2/stores/event/hot_store.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cmd/stellar-rpc/internal/rpcv2/stores/event/hot_store.go b/cmd/stellar-rpc/internal/rpcv2/stores/event/hot_store.go index ec2e3730c..fe2592af2 100644 --- a/cmd/stellar-rpc/internal/rpcv2/stores/event/hot_store.go +++ b/cmd/stellar-rpc/internal/rpcv2/stores/event/hot_store.go @@ -29,16 +29,21 @@ const ( // // - DataCF holds XDR-encoded event payloads: compressible (zstd // typically 2-3× on XDR) and read in batches via -// BatchedMultiGetCF. Larger blocks give zstd more context per -// compression unit and align with batch-fetch shapes. +// BatchedMultiGetCF. A point read decompresses one block to serve +// one ~250B event, so a 32 KiB block paid for ~128 events per cache +// miss. // - IndexCF stores 20-byte (term_hash || event_id) keys with // empty values — nothing in the values to compress, and small // blocks reduce wasted I/O per random Lookup miss (each Lookup // reads one block to find one key). // - OffsetsCF stores 8-byte (ledger_seq -> event_count) rows in // the tens-of-thousands per chunk — same shape as IndexCF. +// +// A block size applies to SSTs as they are written. Chunks already on disk +// keep theirs until compaction or rotation rewrites them; a restart changes +// nothing. const ( - dataCFBlockSize = 32 * 1024 + dataCFBlockSize = 8 * 1024 indexCFBlockSize = 4 * 1024 offsetsCFBlockSize = 4 * 1024 )