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

Benchmark workflow tweaks. #434

Merged
merged 3 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
18 changes: 9 additions & 9 deletions .github/workflows/tquic-benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ env:
jobs:
config:
name: Prepare config
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
outputs:
benchmark_date: ${{ steps.set-benchmark-date.outputs.benchmark_date }}
benchmark_impls: ${{ steps.set-implements.outputs.benchmark_impls }}
Expand Down Expand Up @@ -43,7 +43,7 @@ jobs:

build_tquic:
name: Build tquic
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
needs: config
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:

build_lsquic:
name: Build lsquic
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
needs: config
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -109,7 +109,7 @@ jobs:

gen_cert:
name: Generate cert
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
needs: config
steps:
- name: Generate cert
Expand All @@ -124,7 +124,7 @@ jobs:

gen_files:
name: Generate files
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
needs: config
steps:
- name: Generate files
Expand All @@ -142,7 +142,7 @@ jobs:
run_long_conn:
name: Run long connection scenario benchmark
needs: [ config, build_tquic, build_lsquic, gen_cert, gen_files ]
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
matrix:
file: [ 15K, 50K, 2M ]
Expand Down Expand Up @@ -177,7 +177,7 @@ jobs:
run_short_conn:
name: Run short connection scenario benchmark
needs: [ config, build_tquic, build_lsquic, gen_cert, gen_files ]
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Download all
uses: actions/download-artifact@v4
Expand All @@ -191,7 +191,7 @@ jobs:
sh ${impl}_server_bin/start_${impl}.sh
pgrep ${impl}_server
sleep 1
./tquic_client_bin/tquic_client https://tquic_benchmark:4433/file_1K --connect-to 127.0.0.1:4433 --threads 10 --max-concurrent-conns 1 --max-concurrent-requests 1 --max-requests-per-conn 1 --total-requests-per-thread 0 -d ${{ needs.config.outputs.benchmark_duration }} --disable-stateless-reset --send-batch-size 1 --recv-udp-payload-size 1350 --send-udp-payload-size 1350 --log-level OFF > client.log 2>&1
./tquic_client_bin/tquic_client https://tquic_benchmark:4433/file_1K --connect-to 127.0.0.1:4433 --threads 10 --max-concurrent-conns 10 --max-concurrent-requests 1 --max-requests-per-conn 1 --total-requests-per-thread 0 -d ${{ needs.config.outputs.benchmark_duration }} --disable-stateless-reset --send-batch-size 1 --recv-udp-payload-size 1350 --send-udp-payload-size 1350 --log-level OFF > client.log 2>&1
cat client.log | grep "finished in" | awk '{print $4}' > benchmark_short_${impl}_1K_10_1.${round}.${{ needs.config.outputs.benchmark_date }}
killall ${impl}_server
sleep 1
Expand All @@ -205,7 +205,7 @@ jobs:
retention-days: 90

result:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
needs: [ run_long_conn, run_short_conn ]
steps:
- name: Download plot tools
Expand Down
2 changes: 1 addition & 1 deletion src/congestion_control/bbr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@ impl CongestionController for Bbr {
}

fn in_recovery(&self, sent_time: Instant) -> bool {
self.recovery_epoch_start.map_or(false, |t| sent_time <= t)
self.recovery_epoch_start.is_some_and(|t| sent_time <= t)
}

fn in_slow_start(&self) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion src/congestion_control/bbr3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ impl Bbr3 {
}

fn in_recovery(&self, sent_time: Instant) -> bool {
self.recovery_epoch_start.map_or(false, |t| sent_time <= t)
self.recovery_epoch_start.is_some_and(|t| sent_time <= t)
}

fn in_slow_start(&self) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion src/congestion_control/cubic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ impl CongestionController for Cubic {
}

fn in_recovery(&self, sent_time: Instant) -> bool {
self.recovery_epoch_start.map_or(false, |t| sent_time <= t)
self.recovery_epoch_start.is_some_and(|t| sent_time <= t)
}

fn congestion_window(&self) -> u64 {
Expand Down
6 changes: 3 additions & 3 deletions src/connection/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2996,7 +2996,7 @@ impl Connection {
// frame in a packet with the highest level of packet protection to
// avoid the packet being discarded.
// See RFC 9000 Section 10.2.3
if self.local_error.as_ref().map_or(false, |e| !e.is_app) {
if self.local_error.as_ref().is_some_and(|e| !e.is_app) {
let pkt_type = match self.tls_session.write_level() {
Level::Initial => PacketType::Initial,
Level::Handshake => PacketType::Handshake,
Expand Down Expand Up @@ -3073,7 +3073,7 @@ impl Connection {
|| self.tls_session.is_in_early_data())
&& (self.need_send_handshake_done_frame()
|| self.need_send_new_token_frame()
|| self.local_error.as_ref().map_or(false, |e| e.is_app)
|| self.local_error.as_ref().is_some_and(|e| e.is_app)
|| path.need_send_validation_frames(self.is_server)
|| path.dplpmtud.should_probe()
|| path.need_send_ping
Expand All @@ -3094,7 +3094,7 @@ impl Connection {
fn need_send_path_unaware_frames(&self) -> bool {
self.need_send_handshake_done_frame()
|| self.need_send_new_token_frame()
|| self.local_error.as_ref().map_or(false, |e| e.is_app)
|| self.local_error.as_ref().is_some_and(|e| e.is_app)
|| self.cids.need_send_cid_control_frames()
|| self.streams.need_send_stream_frames()
}
Expand Down
2 changes: 1 addition & 1 deletion src/connection/recovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ impl Recovery {
space.lost.clear();
space.acked.clear();

// Reset loss dection timer
// Reset loss detection timer
space.time_of_last_sent_ack_eliciting_pkt = None;
space.loss_time = None;
space.loss_probes = 0;
Expand Down
8 changes: 4 additions & 4 deletions src/connection/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4731,7 +4731,7 @@ mod tests {
// write empty data with fin flag, it should be ok.
assert_eq!(stream.send.write(Bytes::new(), true), Ok(0));

// Shutdown the stream abrubtly, it should be ok.
// Shutdown the stream abruptly, it should be ok.
assert_eq!(stream.send.shutdown(), Ok((0, 18)));
// Here we call `write` to make sure the stream's fin_off is set.
assert_eq!(stream.recv.write(0, Bytes::new(), true), Ok(()));
Expand Down Expand Up @@ -4939,7 +4939,7 @@ mod tests {
assert_eq!(map.get(20).unwrap().recv.fin_off, Some(30));

// 10. Receive a RESET_STREAM frame for a stream which has been closed.
// Shutdown the stream abrubtly, it should be ok.
// Shutdown the stream abruptly, it should be ok.
let stream = map.get_or_create(24, false).unwrap();
assert_eq!(stream.send.shutdown(), Ok((0, 0)));
// Here we call `write` to make sure the stream's fin_off is set.
Expand Down Expand Up @@ -5064,7 +5064,7 @@ mod tests {
assert_eq!(map.on_stop_sending_frame_received(4, 0), Ok(()));

// 5. Receive a STOP_SENDING frame for a stream which has been closed.
// Shutdown the stream abrubtly, it should be ok.
// Shutdown the stream abruptly, it should be ok.
let stream = map.get_or_create(24, false).unwrap();
assert_eq!(stream.send.shutdown(), Ok((0, 0)));
// Here we call `write` to make sure the stream's fin_off is set.
Expand Down Expand Up @@ -5134,7 +5134,7 @@ mod tests {
assert_eq!(map.on_stop_sending_frame_received(5, 0), Ok(()));

// 5. Receive a STOP_SENDING frame for a stream which has been closed.
// Shutdown the stream abrubtly, it should be ok.
// Shutdown the stream abruptly, it should be ok.
let stream = map.get_or_create(25, false).unwrap();
assert_eq!(stream.send.shutdown(), Ok((0, 0)));
// Here we call `write` to make sure the stream's fin_off is set.
Expand Down
2 changes: 1 addition & 1 deletion src/connection/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl TimerTable {

/// Check whether the given timer is expired
pub fn is_expired(&self, timer: Timer, after: Instant) -> bool {
self.expires[timer as usize].map_or(false, |x| x <= after)
self.expires[timer as usize].is_some_and(|x| x <= after)
}
}

Expand Down
5 changes: 1 addition & 4 deletions src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -757,10 +757,7 @@ impl Endpoint {
&self.trace_id,
);

let done = match self.sender.on_packets_send(batch) {
Ok(v) => v,
Err(e) => return Err(e),
};
let done = self.sender.on_packets_send(batch)?;
if done == 0 {
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1992,7 +1992,7 @@ pub struct PacketInfo<'a> {
dst_len: socklen_t,
}

impl<'a> From<&PacketInfo<'a>> for crate::PacketInfo {
impl From<&PacketInfo<'_>> for crate::PacketInfo {
fn from(info: &PacketInfo) -> crate::PacketInfo {
crate::PacketInfo {
src: sock_addr_from_c(info.src, info.src_len),
Expand Down
2 changes: 1 addition & 1 deletion src/h3/h3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ impl<'a> HeaderRef<'a> {
}
}

impl<'a> NameValue for HeaderRef<'a> {
impl NameValue for HeaderRef<'_> {
fn name(&self) -> &[u8] {
self.0
}
Expand Down
2 changes: 1 addition & 1 deletion src/h3/qpack/huffman.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ const ENCODE_TABLE: [(usize, u64); 257] = [
];

/// The multi-level decoding table for huffman decoder.
const DECODE_TABLE: [[(usize, u8, u8); 16]; 256] = [
static DECODE_TABLE: [[(usize, u8, u8); 16]; 256] = [
// 0
[
// (next-state, byte, flags).
Expand Down
2 changes: 1 addition & 1 deletion src/packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ fn encrypt_header(
/// Decrypt payload of a QUIC packet.
///
/// The `pkt_buf` is the raw data of a QUIC packet.
/// The `paylaod_offset` is the offset of packet payload in `pkt_buf`.
/// The `payload_offset` is the offset of packet payload in `pkt_buf`.
/// The `payload_len` is the length of pacekt payload (other than the value of Length field).
/// The `pkt_num` is the decrypted and decoded packet number.
#[allow(unexpected_cfgs)]
Expand Down
10 changes: 5 additions & 5 deletions src/ranges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ pub struct Iter<'a> {
set: btree_map::Iter<'a, u64, u64>,
}

impl<'a> Iterator for Iter<'a> {
impl Iterator for Iter<'_> {
type Item = Range<u64>;

fn next(&mut self) -> Option<Range<u64>> {
Expand All @@ -316,14 +316,14 @@ impl<'a> Iterator for Iter<'a> {
}
}

impl<'a> DoubleEndedIterator for Iter<'a> {
impl DoubleEndedIterator for Iter<'_> {
fn next_back(&mut self) -> Option<Range<u64>> {
let (&start, &end) = self.set.next_back()?;
Some(start..end)
}
}

impl<'a> ExactSizeIterator for Iter<'a> {
impl ExactSizeIterator for Iter<'_> {
fn len(&self) -> usize {
self.set.len()
}
Expand All @@ -335,7 +335,7 @@ pub struct Flatten<'a> {
end: u64,
}

impl<'a> Iterator for Flatten<'a> {
impl Iterator for Flatten<'_> {
type Item = u64;

fn next(&mut self) -> Option<u64> {
Expand All @@ -353,7 +353,7 @@ impl<'a> Iterator for Flatten<'a> {
}
}

impl<'a> DoubleEndedIterator for Flatten<'a> {
impl DoubleEndedIterator for Flatten<'_> {
fn next_back(&mut self) -> Option<u64> {
if self.next == self.end {
let (&start, &end) = self.set.next_back()?;
Expand Down
Loading