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

Improve congestion control #1627

Merged
merged 7 commits into from
Dec 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use set_congested function
Mallets committed Dec 4, 2024
commit 5b24ff5d4e1bb57cc8bcfa1a36b0b98ebde7964c
35 changes: 19 additions & 16 deletions examples/examples/z_sub.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::time::Duration;

//
// Copyright (c) 2023 ZettaScale Technology
//
@@ -30,23 +32,24 @@ async fn main() {

println!("Press CTRL-C to quit...");
while let Ok(sample) = subscriber.recv_async().await {
// Refer to z_bytes.rs to see how to deserialize different types of message
let payload = sample
.payload()
.try_to_string()
.unwrap_or_else(|e| e.to_string().into());
tokio::time::sleep(Duration::from_millis(100)).await;
// // Refer to z_bytes.rs to see how to deserialize different types of message
// let payload = sample
// .payload()
// .try_to_string()
// .unwrap_or_else(|e| e.to_string().into());

print!(
">> [Subscriber] Received {} ('{}': '{}')",
sample.kind(),
sample.key_expr().as_str(),
payload
);
if let Some(att) = sample.attachment() {
let att = att.try_to_string().unwrap_or_else(|e| e.to_string().into());
print!(" ({})", att);
}
println!();
// print!(
// ">> [Subscriber] Received {} ('{}': '{}')",
// sample.kind(),
// sample.key_expr().as_str(),
// payload
// );
// if let Some(att) = sample.attachment() {
// let att = att.try_to_string().unwrap_or_else(|e| e.to_string().into());
// print!(" ({})", att);
// }
// println!();
}
}

4 changes: 1 addition & 3 deletions io/zenoh-transport/src/common/pipeline.rs
Original file line number Diff line number Diff line change
@@ -863,9 +863,7 @@ impl TransmissionPipelineConsumer {

pub(crate) fn refill(&mut self, batch: WBatch, priority: usize) {
self.stage_out[priority].refill(batch);
// Reset the priority congested flag
let prioflag = 1 << priority as u8;
self.status.congested.fetch_and(!prioflag, Ordering::AcqRel);
self.status.set_congested(priority, false);
}

pub(crate) fn drain(&mut self) -> Vec<(WBatch, usize)> {