Context
To secure leadership buy-in, the immediate priority was demonstrating a significant reduction in update payloads to prove the ROI of binary diffing. The objective was to find an algorithm that yields optimized patch sizes out of the box.
Decision
Implemented the qbsdiff crate (Bsdiff algorithm) as the core diffing engine.
Rationale
- Pros: Successfully proved the business case for CDN cost reduction. Benchmarks showed a 120 MB base updating to a 128 MB target required only a 1.95 MB patch.
- Cons (The RAM Flaw): Bsdiff uses suffix sorting, requiring both the old and new files to be held in memory simultaneously. Patch creation requires RAM equal to or greater than the new file size.
- Next Steps: This technical debt is documented; for production scaling, the diffing engine will be hot-swapped for xdelta3 or HDiffPatch to balance patch size with a flat memory footprint.
| Downloads | Cost (Raw 128MB) | Cost (Patched 1.95MB) | Total Savings |
|---|---|---|---|
| 1,000 | $11.52 | $0.18 | $11.34 |
| 10,000 | $115.20 | $1.76 | $113.44 |
| 1,000,000 | $11,520.00 | $175.50 | $11,344.50 |