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

acknowledge timestamp frame manual testing #2

Draft
wants to merge 2 commits into
base: sdeng/receiver_timestamps
Choose a base branch
from

Conversation

sterlingdeng
Copy link
Owner

@sterlingdeng sterlingdeng commented Sep 27, 2024

Description

This PR contains the code for a rough E2E validation for the work done in quinn-rs#1992.
The focus of this E2E test is to see if the timestamps in the ACK frames are able to give a valid signal to the peer if there are some latency between the two connections.

Disclaimer: this test uses pnctl and dnctl to traffic shape because it's what was available on macos.

This test tries to measure 2 values:

  1. The time it takes for a packet to reach the peer from the sender (0.5RTT - half round trip time).
  2. The time the peer waits in between receiving packets (interpacket delay).

and there are two knobs that we can change to impact the measured values

  1. The delay we add using traffic shaping
  2. The interval at which the sender sends data to the receiver.

The 0.5RTT value measures roughly the same as the latency added by the traffic shaper. ~0 when traffic shaping is disabled and ~500ms for the default traffic shaping delay in the script.

For the interpacket delay, this is roughly about the interval the sender sends packet to the receiver, which is currently set at 250ms.

Procedure

In terminal 1:
sudo tcpdump -i any dst port 20001
This lets us monitor the packets and size.

In terminal 2:
RUST_LOG=info cargo run --example ack_timestamp_test
This runs the test. You should see output like:

2024-09-27T22:17:18.536363Z  INFO [cc] on_ack_packet{pn=18}: ack_timestamp_test::common::custom_congestion: ~0.5RTT=0
2024-09-27T22:17:18.536542Z  INFO [cc] on_ack_packet{pn=18}: ack_timestamp_test::common::custom_congestion: receiver interpacket delay = 251

The logs print out the measured values.

In terminal 3:
sudo -i because traffic shaping needs sudo privileges
cd to the repo
./trafficshape.sh delay will enable the traffic shaper
./trafficshape.sh reset will disable the traffic shaper

You can run ./trafficshape.sh delay|reset while the test is running to see the change in real time.

.with(EnvFilter::from_default_env())
.init();

let server_addr = "127.0.0.1:20001".parse().unwrap();
Copy link
Owner Author

Choose a reason for hiding this comment

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

The server_addr and client_endpoint have ports that are impacted by the traffic shaping script.

let (endpoint, server_cert) = make_server_endpoint(server_addr)?;
let endpoint2 = endpoint.clone();
let handle = tokio::spawn(async move {
let span = trace_span!("SERVER");
Copy link
Owner Author

Choose a reason for hiding this comment

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

You could grep for SERVER or CLIENT to filter the logs


// Provided methods

fn on_ack_packet(
Copy link
Owner Author

Choose a reason for hiding this comment

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

This controller just wraps the default cubic congestion control. The main difference is that it logs some messages here.

let span = info_span!("[cc] on_ack_packet", "pn" = pn);
let _guard = span.enter();
if let Some(recv) = received {
info!("~1RTT={}", recv.duration_since(sent).as_millis());
Copy link
Owner Author

Choose a reason for hiding this comment

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

The ~1RTT value should be roughly the same value as the delay set in the traffic shaping script. It should be 0 when traffic shaping is disabled and 500 when enabled (unless the value is changed).

if let Some(lp) = self.last_packet.as_ref() {
if let Some(last_recv) = lp.received {
info!(
"receiver interpacket delay = {}",
Copy link
Owner Author

Choose a reason for hiding this comment

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

The interpacket delay is the time delay between the current packet and the previous packet from the perspective of the peer. This should roughly be the send_interval on the client side.
Sometimes the value will be 0 if the QUIC packet was sent in the same UDP packet. Or at least thats what I think. I verified this by adding logs on the fn on_sent method on the congestion controller trait.

@@ -0,0 +1,41 @@
#!/bin/bash
Copy link
Owner Author

Choose a reason for hiding this comment

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

This requires sudo

@sterlingdeng sterlingdeng changed the title manual testing acknowledge timestamp frame manual testing Sep 27, 2024
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.

1 participant