optimize performance of ingest path
Fixes #452
Description
Blocking I/O moved to the tokio spawn_blocking so it would not block the worker thread and move away the mem write from write path
To improve performance of ingest flow
May be other possible solutions can be various we can discuss like may be introduce a different lock for memtable and disk so we would have minimum contention, or introduce a channel so rather than writting directly to disk first push to channel and consumer would consume and write it to disk. But here in this change we just move both write to memtable and disk to spawn_blocking so worker thread would not be blocked, and take memtable write from core ingest path. Note - for now not changed anything in memtable concats, need explore that more
Major change is in src/parseable/streams.rs all other changes are just to support it, now disk write and memtable write are moved to tokio::spawn_blocking and we are waiting for write on memtable anymore.
This PR has:
- [ ] been tested to ensure log ingestion and log query works.
- [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
- [ ] added documentation for new or modified features or behaviors.
Summary by CodeRabbit
-
Refactor
- Event processing and stream push flows converted to async so processing yields correctly; disk persistence is awaited for durability while in-memory updates run in background tasks.
- Internal call sites updated to await new async flows.
-
Tests
- I/O and push-related tests updated to match async behavior.
-
Chores
- Public method signatures changed to async—callers may need to update call sites to await these methods.
✏️ Tip: You can customize this high-level summary in your review settings.