{
  "slug": "segcache",
  "term": "Segcache",
  "aliases": [
    "Segment-structured cache"
  ],
  "definition": "Segcache is an in-memory key-value cache that groups objects by approximate expiration time and manages their storage in fixed-size segments.",
  "note": "Segments share metadata in creation-time order within TTL buckets. Expiration removes whole segments; capacity eviction merges segments and keeps selected objects. The five-byte object header excludes shared metadata and hash-table frequency counters: it is not the complete memory cost per key. [paper]\n\nShared expiration can remove later-written objects early. The paper describes downward TTL rounding, but exact request boundaries depend on the implementation. [paper] [native]\n\nIn the pinned C archive, seg_is_accessible rejects a segment at its deadline. Background expiration requires that deadline to be strictly less than current time minus two seconds; the loop then sleeps 200 milliseconds. This is a reclamation grace condition, not permission to serve expired data or a cleanup-latency bound. A deadline of 109 blocks reads at 109; cleanup is ineligible until integer time 112. [access] [background]\n\nA controlled-clock native request-path experiment wrote at second 100. Relative TTL 8 returned a value at 108 and missed at 109; TTL 9 missed at its requested deadline. A segment already four seconds old instead expired at 105. The bucket initializer adds one to an interval multiple, while shared creation time can shorten lifetime. [native]\n\nAn absolute expiry equal to the controlled current second became internal duration zero and selected the final bucket, returning the value immediately. Client expiry argument zero follows a different conversion path. These observations concern the unmaintained C archive, not later implementations. [native]",
  "status": "research",
  "advantages": [],
  "limitations": [
    {
      "text": "The official erratum removes the original LFU optimality and k-competitiveness assertion. Frequency-based retention is not a universal optimality guarantee.",
      "citationIds": [
        "erratum"
      ]
    },
    {
      "text": "The paper evaluates storage-subsystem replay using week-long production traces and a combined workload. Its throughput results are not end-to-end network-service measurements.",
      "citationIds": [
        "paper"
      ]
    }
  ],
  "related": [
    "gl-cache",
    "sieve-eviction",
    "lfu-replacement"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-19",
  "citations": [
    {
      "id": "paper",
      "title": "Yang, Yue and Rashmi. Segcache. NSDI 2021, pp. 503-518; sections 3.1-3.6 and 4.2, including footnote 4.",
      "url": "https://www.usenix.org/system/files/nsdi21-yang.pdf",
      "accessed": "2026-11-19"
    },
    {
      "id": "erratum",
      "title": "USENIX NSDI 2021 Errata Slip 1: correction to Segcache section 3.6.3.",
      "url": "https://www.usenix.org/system/files/nsdi21_errata_yang_juncheng-1.pdf",
      "accessed": "2026-11-19"
    },
    {
      "id": "access",
      "title": "Segcache author archive: seg_is_accessible, commit 0abdfeed3031b5cf441f07d35ad2aeb3d870789d.",
      "url": "https://github.com/Thesys-lab/segcache/blob/0abdfeed3031b5cf441f07d35ad2aeb3d870789d/src/storage/seg/seg.c",
      "accessed": "2026-11-19"
    },
    {
      "id": "background",
      "title": "Segcache author archive: check_seg_expire and background_main, same pinned commit.",
      "url": "https://github.com/Thesys-lab/segcache/blob/0abdfeed3031b5cf441f07d35ad2aeb3d870789d/src/storage/seg/background.c",
      "accessed": "2026-11-19"
    },
    {
      "id": "native",
      "title": "Hesela. Archived Segcache TTL: controlled-clock native observations, source ledger and reproduction package.",
      "url": "https://hesela.dev/research/segcache-ttl/README.md",
      "accessed": "2026-11-19"
    }
  ],
  "provenance": [
    "Full-paper, official-erratum and pinned-code review plus 26 native scenarios repeated twice in each of Debug and Release. Publishing-agent replay reproduced all scenario outputs; no external peer review is claimed. [native]",
    "The probe executes unmodified parsing, processing, allocation, lookup and response composition with an injected clock. Background reclamation is stopped and joined before writes; the experiment isolates read eligibility. [native]",
    "A separate loopback-server attempt failed at startup with zero successful responses. This is not network timing, a production trace replay or a performance replication. No conclusion about the later Rust implementation follows. [native]",
    "The earlier deadline-only arithmetic is retained as a predicate illustration. Flush handling and reference-count coordination can affect reclamation. [access] [background]"
  ]
}
