Bigger cache objects change the backup window

A cache can keep the same key count while its payloads grow eightfold. Lavik moves that growth onto SSD, but snapshot export and retained storage versions need their own capacity plan.

A document-preview cache starts by storing a short rendering for each document. Later, the product adds accessibility text and additional preview panels. The number of documents barely changes, but each cached object becomes much larger. Lavik 0.1.0 offers a concrete reason to keep those richer previews online: its key index resides in DRAM while values reside on storage, including NVMe. The less obvious consequence appears during backup: more payload must leave the server, and a snapshot can keep older storage blocks occupied while refreshes continue.

One million keys, eight times the payload

Consider a hypothetical cache with one million document keys. Each value grows from 8 KiB to 64 KiB, and the application still reads and replaces the complete preview. Keep key names, retention policy and refresh frequency unchanged. Logical value bytes increase eightfold; top-level key cardinality does not. This is an application model, not a measured Lavik workload. It illustrates why SSD value capacity can be attractive when richer objects would otherwise increase the DRAM capacity needed to retain the dataset.

Memory use will nevertheless change. Lavik promotes Strings at 16 KiB of encoded size and stores grouped Strings in fixed 8 KiB segments. The hypothetical 64 KiB payload therefore spans eight value segments, with resident routing and physical-location metadata in addition to its top-level key entry. Complete reads still return all the bytes, and complete replacements still supply a new value. Segmentation helps selective access when the application uses it; it does not make a whole-preview API transfer fewer bytes. Budget key indexes, grouped metadata, request buffers and reply work separately from SSD payload capacity.

Export can stream while storage remains pinned

Suppose the team exports an RDB snapshot to shorten cache warmup after a replacement deployment. Lavik's grouped export can traverse a captured collection one page at a time and emit bounded file fragments without constructing a second complete serialized collection. This is useful for the larger preview format: export does not require a second whole-value buffer for each grouped object. Snapshot capture and output still consume admitted memory, and this streaming mechanism is not a promise of constant total backup memory.

The captured view also retains exact physical block pins. If a preview is refreshed after capture, the snapshot must retain access to its captured version while the live key points to newer data. Physical reclamation waits for the relevant pins to drain. Consequently, a slow export can overlap more replacement writes and leave more storage temporarily unavailable for reuse. The dependency runs in both directions: larger payloads increase export work, and a longer export can extend the period during which refreshes accumulate alongside retained history.

For the hypothetical cache, the raw value bytes presented to an export grow eightfold. That does not establish an eightfold increase in RDB file size or elapsed backup time: encoding, output throughput and concurrent activity matter. Nor can retained storage be calculated by multiplying the changed-key count by the old payload size. Pins protect physical blocks, unchanged groups may be shared, and obsolete records pass through reclamation before their space becomes reusable. The operating quantity is available storage during the overlap, alongside snapshot memory and foreground latency.

Make snapshot overlap part of the application design

Because these previews are reconstructable, a useful design is to schedule their bulk refresh after the export completes, while allowing ordinary document updates to continue. This reduces the deliberate overlap between two large streams of work. It does not require freezing all writes: BGSAVE releases database gates after capture and exports the captured view. If snapshot admission fails, Lavik can invalidate the snapshot while allowing the foreground mutation to complete; a failed export does not publish a partial RDB. The application therefore needs separate signals for a healthy serving cache and a successful backup.

The adoption case is keeping richer, rebuildable previews available without requiring all their value bytes to fit in DRAM, using the Redis interface and an Apache-2.0 open-source server. The infrastructure budget should include SSD space for live data, overlapping versions and reclamation, plus resident metadata and temporary memory. A value-capacity ratio alone cannot establish total cost savings or equivalent service guarantees. An ordinary successful write is also not a synchronous crash-durability fence, so backup policy must remain consistent with the cache's rebuild and loss tolerance.

A practical next step is to rehearse the two preview formats with the same key population and the application's actual refresh traffic. Capture an RDB during refresh, then repeat with bulk refresh deferred until completion. Compare backup completion time, foreground tail latency, retained memory and available storage through the export and subsequent reclamation. Verify the resulting RDB through a restore and application-level preview comparison. These are proposed acceptance checks, not results reported here; they answer whether the larger cache can keep serving and still finish its backup within the required window.

Publication reference: use the stable 0.1.0 manual entry point for installation, RDB operations and storage guidance: https://github.com/eloqdata/lavik/blob/471f4864357f4a5034c64e7d4972ec0e55b82d94/README.md