hn.today

Coalescing small writes on object storage

s2.dev6 points0 comments
Screenshot of Coalescing small writes on object storage

S2 models data as many independent durable streams, often one per user, device, session, or job. This creates a cost challenge when storing data in S3: a few hot streams produce most of the bytes, but numerous quiet streams generate most of the storage writes. Because S3 charges for each PUT regardless of size, a typical 14 KiB segment written every 20 seconds can cost about $0.66 per stream monthly in requests, far more than storing its data. Delaying writes to combine more data from each stream would reduce requests, but keeps shared chunks in memory longer and increases crash-recovery work.

Instead, S2 combines small segments from different streams into packed objects, generally uploading when a batch reaches 16 MiB or after four seconds. Large segments from hot streams remain standalone. Even with only 50 streams per packed object, the example PUT cost falls to about $0.013 per quiet stream monthly; across 100,000 streams, estimated monthly request costs drop from $65,700 to $1,314, and small-segment PUTs decline by more than 100 times. Segment metadata identifies each segment’s byte range, allowing readers to fetch only that stream’s data with a ranged GET. Access controls, checksums, and encryption remain intact, and deterministic testing checks that failures cannot lose data. Packing can retain space unnecessarily and does not improve long-history reads; compaction can regroup surviving data by stream, trading rewrite costs against storage and read efficiency.

Read on s2.dev0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Web

Search Providers Don't See the Same Web

Search Providers Don't See the Same Web

Search providers often return very different results: providers from separate groups shared about 10% of their top five pages. Combining providers from different groups found known answers 5.3 percentage points more often than relying on the better provider alone, compared with 2.8 points for providers in the same group. (telem.ai)

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.