8000 feat: Migrate NATS Queue to Rust (#669) by jthomson04 · Pull Request #961 · ai-dynamo/dynamo · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: Migrate NATS Queue to Rust (#669) #961

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

Merged
merged 4 commits into from
May 6, 2025

Conversation

jthomson04
Copy link
Contributor

Overview:

Migrate the NATS queue in examples/llm/utils/nats_queue.py from Python to Rust

Details:

  1. Move NATSQueue logic to Rust, in lib/runtime/transports/nats.rs
  2. Update the examples/llm example to use this new rust-based queue
  3. Add bindings in lib/bindings

Related Issues:

@jthomson04 jthomson04 force-pushed the jothomson/nats-queue-to-rust branch from d085638 to b5bb564 Compare May 6, 2025 19:45
@tedzhouhk
Copy link
Contributor
tedzhouhk commented May 6, 2025
8000

Thanks for taking this task and nice work!
Just one thing, have we benchmark python vs rust prefill queue performance? The implementation in this PR still leaves the serialization of RemotePrefillRequest in python using msgspec. Wonder if that might become the bottleneck and if we want to move that also to rust (maybe can use a general dictionary instead of a pydantic class?)

@jthomson04
Copy link
Contributor Author

Thanks for taking this task and nice work! Just one thing, have we benchmark python vs rust prefill queue performance? The implementation in this PR still leaves the serialization of RemotePrefillRequest in python using msgspec. Wonder if that might become the bottleneck and if we want to move that also to rust (maybe can use a general dictionary instead of a pydantic class?)

For now, there aren't any benchmarks. It looks like the python msgpack using cpython bindings, so I wouldn't expect it to be too much slower than a rust implementation, but it certainly has the potential to be a bottleneck on long context. I'll make a follow-on MR to investigate doing the serialization/deserialization in Rust.

@jthomson04 jthomson04 merged commit c421389 into main May 6, 2025
12 checks passed
@jthomson04 jthomson04 deleted the jothomson/nats-queue-to-rust branch May 6, 2025 22:36
@grahamking
Copy link
Contributor
grahamking commented May 15, 2025

@jthomson04 Do the messages need to be ACKed when taken off the queue?

Details in

@jthomson04
Copy link
Contributor Author

@jthomson04 Do the messages need to be ACKed when taken off the queue?

Details in

Yes, they're acked:

@grahamking
Copy link
Contributor

Yes, they're acked:

Darn. That means the ACK is not sufficient to take them off the queue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0