Revision 655a208add8065096a3b61f1c6b64134616f4f87
Committed on 16/12/2025 6:16 pm by
Zohaib Sibte Hassan <zohaib@sibte.pk> [GitHub Diff]
Perf: Eliminate read-modify-write anti-patterns in PebbleMetaStore
Profiling showed 23% CPU in cleanupAfterCommit due to toxic
read-unmarshal-modify-marshal-write cycles. This commit implements
three optimizations:
P0: GC Intent Markers
- MarkIntentsForCleanup writes presence keys (/gc/intent/) instead of
modifying intent records
- writeIntentSlowPath checks GC markers before expensive unmarshal
P1: Transaction Record Split
- Split TransactionRecord into immutable (/txn/) and commit (/txn_commit/)
- Status stored as 1-byte key (/txn_status/)
- BeginTransaction/CommitTransaction no longer do read-modify-write
- GetTransaction reconstructs for backward compatibility
P2: Raw Heartbeat Optimization
- Heartbeat stored as raw 8-byte timestamp (/txn_heartbeat/)
- Heartbeat() reduced from 16-line read-modify-write to single write
- WriteIntent paths refresh heartbeat on success
- CleanupStaleTransactions reads 8 bytes instead of full record
Performance impact:
- Heartbeat: ~1057 bytes → 8 bytes (132x smaller)
- CommitTransaction: No read-unmarshal-modify-marshal cycle
- Status updates: 1-byte writes instead of full record
???? Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>