Skip to content
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

Avoid blocking the daemon main loop by using unbounded queue #230

Merged
merged 2 commits into from
Mar 22, 2023

Conversation

phil-opp
Copy link
Collaborator

Blocking the main loop blocks all inputs and outputs, so we should really avoid it. By using unbounded queues to the subscriber tasks we can ensure that the daemon can always forward events immediately. The subscriber tasks will then take care of dropping inputs if the receiver is too slow.

This should fix lag issues that occur when messages are send with high frequency.

The main loop of the daemon should not be blocked at any time.
Copy link
Collaborator

@haixuanTao haixuanTao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I just tested and it works very well!
It might even be a bit faster,

Latency is the last column in nanoseconds

From:

name, platform, Msg Size in Bit, Latency 
dora-rs daemon Python,[email protected],8,792.4573099990084
dora-rs daemon Python,[email protected],64,747.8795000008629
dora-rs daemon Python,[email protected],512,799.8767300040299
dora-rs daemon Python,[email protected],2048,711.45794000131
dora-rs daemon Python,[email protected],4096,865.6043299993144
dora-rs daemon Python,[email protected],16384,890.8924600001457
dora-rs daemon Python,[email protected],40960,1007.7704199989056
dora-rs daemon Python,[email protected],409600,1250.2376100025003
dora-rs daemon Python,[email protected],4096000,7941.366180000956
dora-rs daemon Python,[email protected],40960000,53663.645750003765

To

dora-rs daemon Python,[email protected],8,508.10982938855886
dora-rs daemon Python,[email protected],64,503.40708054136485
dora-rs daemon Python,[email protected],512,569.5853204815648
dora-rs daemon Python,[email protected],2048,799.5779596967623
dora-rs daemon Python,[email protected],4096,500.8382411324419
dora-rs daemon Python,[email protected],16384,502.8422095347196
dora-rs daemon Python,[email protected],40960,545.0415704399347
dora-rs daemon Python,[email protected],409600,775.8157313219272
dora-rs daemon Python,[email protected],4096000,4016.9729199260473
dora-rs daemon Python,[email protected],40960000,53985.91389093781

This is not a precise test, I just runned it a handful of time

@phil-opp
Copy link
Collaborator Author

Great, thanks for testing!

@phil-opp phil-opp merged commit ad4ff0f into main Mar 22, 2023
@phil-opp phil-opp deleted the dont-wait branch March 22, 2023 12:48
haixuanTao added a commit that referenced this pull request Mar 22, 2023
* [Make dora-rs publishable on crates.io](#211)
* [Add an internal cli argument to create template with path dependencies](#212)

* [Avoid blocking the daemon main loop by using unbounded queue](#230)
* [Inject YAML declared env variable into the runtime](#227)
* [Use rustls instead of system SSL implementation](#216)

* [Refactor python error](#229)
* [The first letter of rust should be lowercase in the command](#226)
* [Add documentation to the cli within the helper mode](#225)
* [Update to safer-ffi v0.1.0-rc1](#218)
* [remove unused variable: data_bytes](#215)
* [Clean up: Remove workspace path](#210)
* [Decouple opentelemetry from tracing](#222)
* [Remove zenoh dependency from dora node API to speed up build](#220)
* [Update to Rust v1.68](#221)
* [Deny unknown fields to avoid typos](#223)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants