-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Description
Summary
Each write operation currently creates a separate IndexedDB transaction. Batching multiple writes into single transactions would significantly improve throughput.
Problem
In core/gateways/indexeddb/gateway-impl.ts, each put() call creates its own transaction. IndexedDB transactions have overhead, and frequent small transactions are inefficient for bulk writes.
Proposed Solution
- Add batch queue configuration to database options
- Create
BatchQueueatcore/gateways/indexeddb/batch-queue.ts - Implement time-window batching:
- Collect writes within configurable window (e.g., 10ms)
- Execute as single transaction
- Implement read-your-writes consistency check
- Add batch statistics reporting
- Create throughput benchmarks
Expected Outcomes
- Multiple writes within time window share one transaction
- Batched writes maintain atomicity
- Read-your-writes consistency maintained
- 5x throughput improvement on bulk writes (benchmark verified)
Metadata
Metadata
Assignees
Labels
No labels