{
  "slug": "haystack",
  "term": "Haystack",
  "aliases": [
    "Haystack photo store"
  ],
  "definition": "Haystack is an object-storage design that packs photo records into large volume files and locates them through compact in-memory mappings.",
  "note": "Layout: A stored record is a needle. Replacing an image appends another needle; the highest offset identifies the latest version only within the same physical volume. [paper]\n\nRecovery: The index file accelerates restart but is updated asynchronously. Startup scans trailing needles missing from the index. The paper's index-record Flags field is unused; deletion state is checked in the volume's needle, not refreshed by replaying that index. After restart, reads must inspect the stored delete flag. [paper]\n\nReclamation: Deletion marks a record; compaction copies retained records into a replacement file. Marking deletion alone does not recover its occupied space. [engineering] During compaction, deletes reach both files; at the final switch, modifications are blocked and files and mappings are swapped atomically. [paper]\n\nI/O boundary: Avoiding metadata reads does not guarantee one physical disk operation per image. Extent and RAID boundaries can require more. Count application reads and device operations separately. [paper]",
  "status": "unknown",
  "advantages": [],
  "limitations": [],
  "related": [
    "object-storage",
    "bitcask",
    "key-value-separation",
    "compaction",
    "checksum"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-29",
  "citations": [
    {
      "id": "paper",
      "title": "Beaver, Kumar, Li, Sobel and Vajgel. Finding a Needle in Haystack: Facebook's Photo Storage. OSDI 2010, sections 3.4.1-3.4.5 and 3.6.1.",
      "url": "https://www.usenix.org/legacy/event/osdi10/tech/full_papers/Beaver.pdf",
      "accessed": "2026-11-29"
    },
    {
      "id": "engineering",
      "title": "Vajgel, Beaver and Sobel. Needle in a haystack: efficient storage of billions of photos. 30 April 2009.",
      "url": "https://engineering.fb.com/2009/04/30/core-infra/needle-in-a-haystack-efficient-storage-of-billions-of-photos/",
      "accessed": "2026-11-29"
    }
  ],
  "provenance": [
    "Historical architecture described in 2009 and 2010; current deployment status is unknown. Source synthesis, not a Haystack execution or benchmark."
  ]
}
