From a892465c545ac360355de9d6c1ea90ae2dc31390 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Sat, 12 Nov 2022 14:32:50 +0100 Subject: [PATCH 01/10] ws_load_test: exclusively use TLS 1.3 --- CHANGELOG.md | 6 ++++++ aquatic_ws_load_test/Cargo.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8cd2e11..7920167 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -85,3 +85,9 @@ * Remove peer from swarms immediately when connection is closed * Allow peers to use multiple peer IDs, as long as they only use one per info hash + +### aquatic_ws_load_test + +#### Changed + +* Exclusively use TLS 1.3 diff --git a/aquatic_ws_load_test/Cargo.toml b/aquatic_ws_load_test/Cargo.toml index b123c89..0c679ee 100644 --- a/aquatic_ws_load_test/Cargo.toml +++ b/aquatic_ws_load_test/Cargo.toml @@ -27,7 +27,7 @@ log = "0.4" mimalloc = { version = "0.1", default-features = false } rand = { version = "0.8", features = ["small_rng"] } rand_distr = "0.4" -rustls = { version = "0.20", features = ["dangerous_configuration"] } +rustls = { version = "0.20", default-features = false, features = ["dangerous_configuration"] } serde = { version = "1", features = ["derive"] } serde_json = "1" tungstenite = "0.17" From 1f73d11a97bb1c969bf093197f15861ebf23d8ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Sat, 12 Nov 2022 14:35:22 +0100 Subject: [PATCH 02/10] Run cargo update Updating ahash v0.8.0 -> v0.8.2 Updating cc v1.0.74 -> v1.0.76 Updating futures-intrusive v0.4.1 -> v0.4.2 Updating halfbrown v0.1.15 -> v0.1.16 Updating hyper v0.14.22 -> v0.14.23 Updating libm v0.2.5 -> v0.2.6 Updating libmimalloc-sys v0.1.26 -> v0.1.27 Updating mimalloc v0.1.30 -> v0.1.31 Updating num_cpus v1.13.1 -> v1.14.0 Adding parking_lot v0.11.2 Adding parking_lot_core v0.8.5 Updating ppv-lite86 v0.2.16 -> v0.2.17 Updating regex v1.6.0 -> v1.7.0 Updating regex-syntax v0.6.27 -> v0.6.28 Updating time v0.3.16 -> v0.3.17 Updating time-macros v0.2.5 -> v0.2.6 --- Cargo.lock | 89 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3c3f028..f21dc92 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -30,9 +30,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57e6e951cfbb2db8de1828d49073a113a29fd7117b1596caa781a258c7e38d72" +checksum = "bf6ccdb167abbf410dcb915cabd428929d7f6a04980b54a11f26a39f1c7f7107" dependencies = [ "cfg-if", "getrandom", @@ -70,7 +70,7 @@ dependencies = [ name = "aquatic_common" version = "0.2.0" dependencies = [ - "ahash 0.8.0", + "ahash 0.8.2", "anyhow", "aquatic_toml_config", "arc-swap", @@ -613,9 +613,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.0.74" +version = "1.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581f5dba903aac52ea3feb5ec4810848460ee833876f1f9b0fdeab1f19091574" +checksum = "76a284da2e6fe2092f2353e51713435363112dfd60030e22add80be333fb928f" [[package]] name = "cfg-if" @@ -1084,13 +1084,13 @@ dependencies = [ [[package]] name = "futures-intrusive" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b6bdbb8c5a42b2bb5ee8dd9dc2c7d73ce3e15d26dfe100fb347ffa3f58c672b" +checksum = "a604f7a68fbf8103337523b1fadc8ade7361ee3f112f7c680ad179651616aed5" dependencies = [ "futures-core", "lock_api", - "parking_lot", + "parking_lot 0.11.2", ] [[package]] @@ -1271,9 +1271,9 @@ checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" [[package]] name = "halfbrown" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce69ed202df415a3d4a01e6f3341320ca88b9bd4f0bf37be6fa239cdea06d9bf" +checksum = "ff8ba437813c5a31783dd9a21ce4f555583dc9b048af6bd2b12217394ed9c199" dependencies = [ "hashbrown 0.12.3", "serde", @@ -1424,9 +1424,9 @@ dependencies = [ [[package]] name = "hyper" -version = "0.14.22" +version = "0.14.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abfba89e19b959ca163c7752ba59d737c1ceea53a5d31a149c805446fc958064" +checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c" dependencies = [ "bytes", "futures-channel", @@ -1563,15 +1563,15 @@ checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" [[package]] name = "libm" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "292a948cd991e376cf75541fe5b97a1081d713c618b4f1b9500f8844e49eb565" +checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" [[package]] name = "libmimalloc-sys" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc093ab289b0bfda3aa1bdfab9c9542be29c7ef385cfcbe77f8c9813588eb48" +checksum = "c37567b180c1af25924b303ddf1ee4467653783440c62360beb2b322a4d93361" dependencies = [ "cc", ] @@ -1647,9 +1647,9 @@ dependencies = [ [[package]] name = "mimalloc" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76ce6a4b40d3bff9eb3ce9881ca0737a85072f9f975886082640cd46a75cdb35" +checksum = "b32d6a9ac92d0239d7bfa31137fb47634ac7272a3c11bcee91379ac100781670" dependencies = [ "libmimalloc-sys", ] @@ -1819,9 +1819,9 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.13.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" dependencies = [ "hermit-abi", "libc", @@ -1875,6 +1875,17 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core 0.8.5", +] + [[package]] name = "parking_lot" version = "0.12.1" @@ -1882,7 +1893,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core", + "parking_lot_core 0.9.4", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall", + "smallvec", + "winapi 0.3.9", ] [[package]] @@ -2009,9 +2034,9 @@ dependencies = [ [[package]] name = "ppv-lite86" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "privdrop" @@ -2162,9 +2187,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" dependencies = [ "aho-corasick", "memchr", @@ -2179,9 +2204,9 @@ checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" [[package]] name = "regex-syntax" -version = "0.6.27" +version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] name = "ring" @@ -2705,9 +2730,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fab5c8b9980850e06d92ddbe3ab839c062c801f3927c0fb8abd6fc8e918fbca" +checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" dependencies = [ "itoa 1.0.4", "libc", @@ -2725,9 +2750,9 @@ checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" [[package]] name = "time-macros" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bb801831d812c562ae7d2bfb531f26e66e4e1f6b17307ba4149c5064710e5b" +checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2" dependencies = [ "time-core", ] @@ -2769,7 +2794,7 @@ dependencies = [ "memchr", "mio", "num_cpus", - "parking_lot", + "parking_lot 0.12.1", "pin-project-lite", "signal-hook-registry", "socket2 0.4.7", From 9ace8f53b8623803b2c3988c535e5d433190e27b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Sat, 12 Nov 2022 14:37:53 +0100 Subject: [PATCH 03/10] Upgrade hashbrown to version 0.13 --- Cargo.lock | 21 +++++++++++++++------ aquatic_common/Cargo.toml | 2 +- aquatic_http_load_test/Cargo.toml | 2 +- aquatic_udp/Cargo.toml | 2 +- aquatic_udp_load_test/Cargo.toml | 2 +- aquatic_ws/Cargo.toml | 2 +- aquatic_ws_protocol/Cargo.toml | 2 +- 7 files changed, 21 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f21dc92..7394978 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -77,7 +77,7 @@ dependencies = [ "duplicate", "git-testament", "glommio", - "hashbrown 0.12.3", + "hashbrown 0.13.1", "hex", "hwloc", "indexmap", @@ -136,7 +136,7 @@ dependencies = [ "futures-lite", "futures-rustls", "glommio", - "hashbrown 0.12.3", + "hashbrown 0.13.1", "log", "mimalloc", "quickcheck", @@ -227,7 +227,7 @@ dependencies = [ "constant_time_eq 0.2.4", "crossbeam-channel", "getrandom", - "hashbrown 0.12.3", + "hashbrown 0.13.1", "hdrhistogram", "hex", "libc", @@ -272,7 +272,7 @@ dependencies = [ "aquatic_common", "aquatic_toml_config", "aquatic_udp_protocol", - "hashbrown 0.12.3", + "hashbrown 0.13.1", "mimalloc", "mio", "quickcheck", @@ -308,7 +308,7 @@ dependencies = [ "futures-lite", "futures-rustls", "glommio", - "hashbrown 0.12.3", + "hashbrown 0.13.1", "httparse", "log", "mimalloc", @@ -355,7 +355,7 @@ version = "0.2.0" dependencies = [ "anyhow", "criterion", - "hashbrown 0.12.3", + "hashbrown 0.13.1", "quickcheck", "quickcheck_macros", "serde", @@ -1292,6 +1292,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ "ahash 0.7.6", +] + +[[package]] +name = "hashbrown" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ff8ae62cd3a9102e5637afc8452c55acf3844001bd5374e0b0bd7b6616c038" +dependencies = [ + "ahash 0.8.2", "serde", ] diff --git a/aquatic_common/Cargo.toml b/aquatic_common/Cargo.toml index 2b2fa5b..24e05c7 100644 --- a/aquatic_common/Cargo.toml +++ b/aquatic_common/Cargo.toml @@ -23,7 +23,7 @@ anyhow = "1" arc-swap = "1" duplicate = "0.4" git-testament = "0.2" -hashbrown = "0.12" +hashbrown = "0.13" hex = "0.4" indexmap = "1" indexmap-amortized = "1" diff --git a/aquatic_http_load_test/Cargo.toml b/aquatic_http_load_test/Cargo.toml index 540fec2..5c0caf4 100644 --- a/aquatic_http_load_test/Cargo.toml +++ b/aquatic_http_load_test/Cargo.toml @@ -21,7 +21,7 @@ aquatic_toml_config.workspace = true anyhow = "1" futures-lite = "1" futures-rustls = "0.22" -hashbrown = "0.12" +hashbrown = "0.13" glommio = "0.7" log = "0.4" mimalloc = { version = "0.1", default-features = false } diff --git a/aquatic_udp/Cargo.toml b/aquatic_udp/Cargo.toml index 840a5d8..c561bd9 100644 --- a/aquatic_udp/Cargo.toml +++ b/aquatic_udp/Cargo.toml @@ -30,7 +30,7 @@ cfg-if = "1" constant_time_eq = "0.2" crossbeam-channel = "0.5" getrandom = "0.2" -hashbrown = { version = "0.12", default-features = false } +hashbrown = { version = "0.13", default-features = false } hdrhistogram = "7" hex = "0.4" libc = "0.2" diff --git a/aquatic_udp_load_test/Cargo.toml b/aquatic_udp_load_test/Cargo.toml index 2e4d23d..5869536 100644 --- a/aquatic_udp_load_test/Cargo.toml +++ b/aquatic_udp_load_test/Cargo.toml @@ -22,7 +22,7 @@ aquatic_toml_config.workspace = true aquatic_udp_protocol.workspace = true anyhow = "1" -hashbrown = "0.12" +hashbrown = "0.13" mimalloc = { version = "0.1", default-features = false } mio = { version = "0.8", features = ["net", "os-poll"] } rand_distr = "0.4" diff --git a/aquatic_ws/Cargo.toml b/aquatic_ws/Cargo.toml index 3cd73bd..e373f70 100644 --- a/aquatic_ws/Cargo.toml +++ b/aquatic_ws/Cargo.toml @@ -29,7 +29,7 @@ futures = "0.3" futures-lite = "1" futures-rustls = "0.22" glommio = "0.7" -hashbrown = { version = "0.12", features = ["serde"] } +hashbrown = { version = "0.13", features = ["serde"] } httparse = "1" log = "0.4" mimalloc = { version = "0.1", default-features = false } diff --git a/aquatic_ws_protocol/Cargo.toml b/aquatic_ws_protocol/Cargo.toml index 0dbdd5f..81a31b8 100644 --- a/aquatic_ws_protocol/Cargo.toml +++ b/aquatic_ws_protocol/Cargo.toml @@ -21,7 +21,7 @@ harness = false [dependencies] anyhow = "1" -hashbrown = { version = "0.12", features = ["serde"] } +hashbrown = { version = "0.13", features = ["serde"] } serde = { version = "1", features = ["derive"] } serde_json = "1" simd-json = { version = "0.6", features = ["allow-non-simd"] } From 9bb0fd8d7bd885861bd0fbd65f8e98e16608d3d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Sat, 12 Nov 2022 14:40:24 +0100 Subject: [PATCH 04/10] Update indicatif to version 0.17 --- Cargo.lock | 15 +++++++++++---- aquatic_udp_bench/Cargo.toml | 2 +- aquatic_udp_bench/src/common.rs | 4 +++- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7394978..087a09b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -664,6 +664,7 @@ dependencies = [ "lazy_static", "libc", "terminal_size", + "unicode-width", "winapi 0.3.9", ] @@ -1487,14 +1488,14 @@ dependencies = [ [[package]] name = "indicatif" -version = "0.16.2" +version = "0.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d207dc617c7a380ab07ff572a6e52fa202a2a8f355860ac9c38e23f8196be1b" +checksum = "4295cbb7573c16d310e99e713cf9e75101eb190ab31fccd35f2d2691b4352b19" dependencies = [ "console", - "lazy_static", "number_prefix", - "regex", + "portable-atomic", + "unicode-width", ] [[package]] @@ -2041,6 +2042,12 @@ dependencies = [ "plotters-backend", ] +[[package]] +name = "portable-atomic" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15eb2c6e362923af47e13c23ca5afb859e83d54452c55b0b9ac763b8f7c1ac16" + [[package]] name = "ppv-lite86" version = "0.2.17" diff --git a/aquatic_udp_bench/Cargo.toml b/aquatic_udp_bench/Cargo.toml index e9786d9..f45d1b0 100644 --- a/aquatic_udp_bench/Cargo.toml +++ b/aquatic_udp_bench/Cargo.toml @@ -19,7 +19,7 @@ aquatic_udp_protocol.workspace = true anyhow = "1" crossbeam-channel = "0.5" -indicatif = "0.16" +indicatif = "0.17" mimalloc = { version = "0.1", default-features = false } num-format = "0.4" rand_distr = "0.4" diff --git a/aquatic_udp_bench/src/common.rs b/aquatic_udp_bench/src/common.rs index e3885d0..8952c3c 100644 --- a/aquatic_udp_bench/src/common.rs +++ b/aquatic_udp_bench/src/common.rs @@ -9,7 +9,9 @@ pub const NUM_INFO_HASHES: usize = 10_000; pub fn create_progress_bar(name: &str, iterations: u64) -> ProgressBar { let t = format!("{:<8} {}", name, "{wide_bar} {pos:>2}/{len:>2}"); - let style = ProgressStyle::default_bar().template(&t); + let style = ProgressStyle::default_bar() + .template(&t) + .expect("setup indicatif template"); ProgressBar::new(iterations).with_style(style) } From 37f80783207574e27c54f067eaa526c71e0fc2ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Sat, 12 Nov 2022 14:51:06 +0100 Subject: [PATCH 05/10] http protocol: use bendy 0.4 beta to get rid of failure crate --- Cargo.lock | 81 +++++++++++++++----------------- aquatic_http_protocol/Cargo.toml | 2 +- 2 files changed, 39 insertions(+), 44 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 087a09b..9bab3f8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -513,13 +513,14 @@ checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" [[package]] name = "bendy" -version = "0.3.3" +version = "0.4.0-beta.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8133e404c8bec821e531f347dab1247bf64f60882826e7228f8ffeb33a35a658" +checksum = "2a77a3f8614953e04ffd9901b9420a324125c3a21bfa485c5161936c378b67b3" dependencies = [ - "failure", + "rustversion", "serde", "serde_bytes", + "snafu", ] [[package]] @@ -886,6 +887,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "doc-comment" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" + [[package]] name = "dotenv" version = "0.15.0" @@ -963,28 +970,6 @@ version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" -[[package]] -name = "failure" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" -dependencies = [ - "backtrace", - "failure_derive", -] - -[[package]] -name = "failure_derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - [[package]] name = "fastrand" version = "1.8.0" @@ -2295,6 +2280,12 @@ dependencies = [ "base64", ] +[[package]] +name = "rustversion" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" + [[package]] name = "ryu" version = "1.0.11" @@ -2508,6 +2499,28 @@ dependencies = [ "version_check", ] +[[package]] +name = "snafu" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a152ba99b054b22972ee794cf04e5ef572da1229e33b65f3c57abbff0525a454" +dependencies = [ + "doc-comment", + "snafu-derive", +] + +[[package]] +name = "snafu-derive" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5e79cdebbabaebb06a9bdbaedc7f159b410461f63611d4d0e3fb0fab8fed850" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "socket2" version = "0.3.19" @@ -2693,18 +2706,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20518fe4a4c9acf048008599e464deb21beeae3d3578418951a189c235a7a9a8" -[[package]] -name = "synstructure" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "unicode-xid", -] - [[package]] name = "terminal_size" version = "0.1.17" @@ -3004,12 +3005,6 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - [[package]] name = "unicode_categories" version = "0.1.1" diff --git a/aquatic_http_protocol/Cargo.toml b/aquatic_http_protocol/Cargo.toml index 86a2f64..eada89d 100644 --- a/aquatic_http_protocol/Cargo.toml +++ b/aquatic_http_protocol/Cargo.toml @@ -38,7 +38,7 @@ smartstring = "1" urlencoding = "2" [dev-dependencies] -bendy = { version = "0.3", features = ["std", "serde"] } +bendy = { version = "0.4.0-beta.2", features = ["std", "serde"] } criterion = "0.3" quickcheck = "1" quickcheck_macros = "1" From a04fab43fb8c7851f53c7ee9c445c4eb5dfc224f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Sat, 12 Nov 2022 14:57:21 +0100 Subject: [PATCH 06/10] Upgrade async-tungstenite to version 0.18 --- Cargo.lock | 4 ++-- aquatic_ws/Cargo.toml | 2 +- aquatic_ws_load_test/Cargo.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9bab3f8..38119be 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -395,9 +395,9 @@ dependencies = [ [[package]] name = "async-tungstenite" -version = "0.17.2" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1b71b31561643aa8e7df3effe284fa83ab1a840e52294c5f4bd7bfd8b2becbb" +checksum = "4b750efd83b7e716a015eed5ebb583cda83c52d9b24a8f0125e5c48c3313c9f8" dependencies = [ "futures-io", "futures-util", diff --git a/aquatic_ws/Cargo.toml b/aquatic_ws/Cargo.toml index e373f70..fd127bd 100644 --- a/aquatic_ws/Cargo.toml +++ b/aquatic_ws/Cargo.toml @@ -22,7 +22,7 @@ aquatic_toml_config.workspace = true aquatic_ws_protocol.workspace = true anyhow = "1" -async-tungstenite = "0.17" +async-tungstenite = "0.18" cfg-if = "1" either = "1" futures = "0.3" diff --git a/aquatic_ws_load_test/Cargo.toml b/aquatic_ws_load_test/Cargo.toml index 0c679ee..a6a407b 100644 --- a/aquatic_ws_load_test/Cargo.toml +++ b/aquatic_ws_load_test/Cargo.toml @@ -19,7 +19,7 @@ aquatic_toml_config.workspace = true aquatic_ws_protocol.workspace = true anyhow = "1" -async-tungstenite = "0.17" +async-tungstenite = "0.18" futures = "0.3" futures-rustls = "0.22" glommio = "0.7" From b1224927134fb98456c0211220e7c75757f44d45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Sat, 12 Nov 2022 15:25:19 +0100 Subject: [PATCH 07/10] Upgrade simple-logger to version 4 --- Cargo.lock | 6 +++--- aquatic_common/Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 38119be..dcc86ff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2456,15 +2456,15 @@ checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" [[package]] name = "simple_logger" -version = "2.3.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48047e77b528151aaf841a10a9025f9459da80ba820e425ff7eb005708a76dc7" +checksum = "e190a521c2044948158666916d9e872cbb9984f755e9bb3b5b75a836205affcd" dependencies = [ "atty", "colored", "log", "time", - "winapi 0.3.9", + "windows-sys", ] [[package]] diff --git a/aquatic_common/Cargo.toml b/aquatic_common/Cargo.toml index 24e05c7..d3cd52a 100644 --- a/aquatic_common/Cargo.toml +++ b/aquatic_common/Cargo.toml @@ -32,7 +32,7 @@ log = "0.4" privdrop = "0.5" rand = { version = "0.8", features = ["small_rng"] } serde = { version = "1", features = ["derive"] } -simple_logger = { version = "2", features = ["stderr"] } +simple_logger = { version = "4", features = ["stderr"] } toml = "0.5" # Optional From 38a48562420def5bc56b1bb9d9561ca008b89c13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Sat, 12 Nov 2022 15:30:16 +0100 Subject: [PATCH 08/10] ws load test: use log crate instead of eprintln --- aquatic_ws_load_test/src/config.rs | 2 +- aquatic_ws_load_test/src/network.rs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/aquatic_ws_load_test/src/config.rs b/aquatic_ws_load_test/src/config.rs index eff0ae5..42282d2 100644 --- a/aquatic_ws_load_test/src/config.rs +++ b/aquatic_ws_load_test/src/config.rs @@ -29,7 +29,7 @@ impl Default for Config { fn default() -> Self { Self { server_address: "127.0.0.1:3000".parse().unwrap(), - log_level: LogLevel::Error, + log_level: LogLevel::Warn, num_workers: 1, num_connections_per_worker: 16, connection_creation_interval_ms: 10, diff --git a/aquatic_ws_load_test/src/network.rs b/aquatic_ws_load_test/src/network.rs index 62c847d..b537eab 100644 --- a/aquatic_ws_load_test/src/network.rs +++ b/aquatic_ws_load_test/src/network.rs @@ -51,7 +51,7 @@ async fn periodically_open_connections( if let Err(err) = Connection::run(config, tls_config, load_test_state, num_active_connections).await { - eprintln!("connection creation error: {:?}", err); + ::log::info!("connection creation error: {:#}", err); } }) .detach(); @@ -105,7 +105,7 @@ impl Connection { *num_active_connections.borrow_mut() += 1; if let Err(err) = connection.run_connection_loop().await { - eprintln!("connection error: {}", err); + ::log::info!("connection error: {:#}", err); } *num_active_connections.borrow_mut() -= 1; @@ -169,7 +169,7 @@ impl Connection { message } message => { - eprintln!( + ::log::warn!( "Received WebSocket message of unexpected type: {:?}", message ); @@ -219,12 +219,12 @@ impl Connection { .responses_error .fetch_add(1, Ordering::SeqCst); - eprintln!("received error response: {:?}", response.failure_reason); + ::log::warn!("received error response: {:?}", response.failure_reason); self.can_send = true; } Err(err) => { - eprintln!("error deserializing message: {:?}", err); + ::log::error!("error deserializing message: {:#}", err); } } From 4342a3387e4442fdc4a12fd05ed533be83a601f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Sat, 12 Nov 2022 15:35:48 +0100 Subject: [PATCH 09/10] Update TODO --- TODO.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/TODO.md b/TODO.md index 9bec0ba..ea7f667 100644 --- a/TODO.md +++ b/TODO.md @@ -33,7 +33,6 @@ * replacing indexmap_amortized / simd_json with equivalents doesn't help * SinkExt::send maybe doesn't wake up properly? * related to https://github.com/sdroege/async-tungstenite/blob/master/src/compat.rs#L18 ? - * Consider using simd-json known-key feature * aquatic_http_private * Consider not setting Content-type: text/plain for responses and send vec as default octet stream instead @@ -42,8 +41,13 @@ * check user token length * site will likely want num_seeders and num_leechers for all torrents.. -* extract_response_peers - * don't assume requesting peer is in list? +* Performance hyperoptimization (receive interrupts on correct core) + * If there is no network card RSS support, do eBPF XDP CpuMap redirect based on packet info, to + cpus where socket workers run. Support is work in progress in the larger Rust eBPF + implementations, but exists in rebpf + * Pin socket workers + * Set SO_INCOMING_CPU (which should be fixed in very recent Linux?) to currently pinned thread + * How does this relate to (currently unused) so_attach_reuseport_cbpf code? ## Low priority @@ -56,7 +60,6 @@ * aquatic_ws * large amount of temporary allocations in serialize_20_bytes, pretty many in deserialize_20_bytes -* so_attach_reuseport_cbpf * extract response peers: extract "one extra" to compensate for removal, of sender if present in selection? From 61d5f2571f736971e01ccb7cafd71b95c32fd654 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Sat, 12 Nov 2022 16:34:36 +0100 Subject: [PATCH 10/10] ws protocol: mention simd-json v0.7 possible parsing bugs --- aquatic_ws_protocol/Cargo.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aquatic_ws_protocol/Cargo.toml b/aquatic_ws_protocol/Cargo.toml index 81a31b8..84ef0e6 100644 --- a/aquatic_ws_protocol/Cargo.toml +++ b/aquatic_ws_protocol/Cargo.toml @@ -24,6 +24,8 @@ anyhow = "1" hashbrown = { version = "0.13", features = ["serde"] } serde = { version = "1", features = ["derive"] } serde_json = "1" +# simd-json version 0.7 seems to have bugs in string parsing +# with custom visitor, where it includes quotes in strings simd-json = { version = "0.6", features = ["allow-non-simd"] } tungstenite = "0.17"