feat: reduce low-tail latency via root-meta cache and IO tuning#320
feat: reduce low-tail latency via root-meta cache and IO tuning#320thweetkomputer wants to merge 137 commits intomainfrom
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughThis PR implements arena-backed chunked storage for mapping tables, introduces background job initialization infrastructure for io-uring rings, optimizes pools and pages with deque-based storage and lazy initialization, adds batch write operations with yielding checkpoints, and adjusts configuration defaults for performance tuning across multiple subsystems. Changes
Sequence DiagramssequenceDiagram
actor Client
participant Shard
participant IouringMgr
participant IOUring
Client->>Shard: WorkOneRound / WorkLoop
activate Shard
Shard->>Shard: Check if InitBackgroundJob needed
alt First time or ring not initialized
Shard->>IouringMgr: InitBackgroundJob()
activate IouringMgr
IouringMgr->>IouringMgr: BootstrapRing(shard)
IouringMgr->>IOUring: io_uring_queue_init with SINGLE_ISSUER + COOP_TASKRUN
IOUring-->>IouringMgr: ring initialized
IouringMgr->>IouringMgr: Set ring_inited_ = true
IouringMgr-->>Shard: success
deactivate IouringMgr
end
Shard->>Shard: ExecuteReadyTasks with time budget enforcement
Note over Shard: Track ts_, enforce max_processing_time_microseconds
Shard->>Client: Return control
deactivate Shard
sequenceDiagram
participant Client
participant MappingTbl
participant MappingArena
participant MappingChunkArena
Client->>MappingTbl: Constructor(vector_arena, chunk_arena)
activate MappingTbl
MappingTbl->>MappingTbl: Store arena pointers
deactivate MappingTbl
Client->>MappingTbl: EnsureSize(page_id)
activate MappingTbl
MappingTbl->>MappingTbl: Calculate required chunks
alt Chunks needed
MappingTbl->>MappingTbl: EnsureChunkCount(count)
loop For each new chunk
MappingTbl->>MappingChunkArena: AcquireChunk()
activate MappingChunkArena
MappingChunkArena->>MappingChunkArena: Pop from pool or allocate
MappingChunkArena-->>MappingTbl: unique_ptr<Chunk>
deactivate MappingChunkArena
MappingTbl->>MappingTbl: Add chunk to base_
end
end
MappingTbl-->>Client: Size ensured
deactivate MappingTbl
Client->>MappingTbl: Set(page_id, value)
activate MappingTbl
MappingTbl->>MappingTbl: Locate chunk via page_id >> kChunkShift
MappingTbl->>MappingTbl: Update value in chunk
deactivate MappingTbl
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| private: | ||
| size_t max_cached_; | ||
| std::vector<T> pool_; | ||
| std::deque<T> pool_; |
There was a problem hiding this comment.
[cpplint] reported by reviewdog 🐶
Add #include for deque<> [build/include_what_you_use] [4]
| void Extend(); | ||
|
|
||
| private: | ||
| std::deque<std::unique_ptr<MappingSnapshot::MappingTbl::Chunk>> pool_; |
There was a problem hiding this comment.
[cpplint] reported by reviewdog 🐶
Add #include for deque<> [build/include_what_you_use] [4]
| return std::tuple{replayer.root_, | ||
| replayer.ttl_root_, | ||
| replayer.mapping_tbl_, | ||
| std::move(replayer.mapping_tbl_), |
There was a problem hiding this comment.
[cpplint] reported by reviewdog 🐶
Add #include for move [build/include_what_you_use] [4]
This reverts commit 311824b.
7099099 to
1d23405
Compare
while evictions happen in the background.
tasks—cutting long-tail stalls.
Here are some reminders before you submit the pull request
fixes eloqdb/eloqstore#issue_idctest --test-dir build/tests/Summary by CodeRabbit
Release Notes
New Features
max_compaction_in_progressoption.Performance Improvements
Configuration Changes
max_write_batch_pages(256→32),direct_io_buffer_pool_size(4→128).mapping_arena_sizeconfiguration option.Stability & Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.