-
Notifications
You must be signed in to change notification settings - Fork 822
perf: optimize file-based KV store with async I/O #5695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Replace blocking std::fs operations with non-blocking tokio::fs in async
functions to prevent blocking the tokio runtime. This eliminates latency
overhead when using --store-kv file for local development.
Changes:
- Use tokio::fs::{read,write,remove_file,read_dir} instead of std::fs
- Use filetime::set_file_mtime() instead of opening files to update mtime
- Optimize lock patterns: collect items then release lock before I/O
- Remove TOCTOU race: try operation directly, handle NotFound error
Before: ~4% latency overhead with file store
After: ~0% latency overhead (matches etcd performance)
Signed-off-by: Vasilis Vagias <vvagias@nvidia.com>
|
👋 Hi vvagias! Thank you for contributing to ai-dynamo/dynamo. Just a reminder: The 🚀 |
WalkthroughThis pull request introduces the Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
Summary
std::fswith non-blockingtokio::fsin async functionsfiletime::set_file_mtime()instead of opening files to update mtimePerformance
--store-kv fileTest plan
cargo test -p dynamo-runtime storage::kv)Summary by CodeRabbit
Chores
Bug Fixes
Refactor
✏️ Tip: You can customize this high-level summary in your review settings.