Improve aquatic_ws glommio implementation, fixing memory leak (#37)

* ws: upgrade tungstenite and async-tungstenite to 0.16

* ws: use latest glommio

* ws: glommio: add config key connection_cleaning_interval

* ws: glommio: limit socket worker local channel size

Quick fix for memory leak

* ws: glommio: use prioritized task queue for sending responses

This is a start on trying to fix the large amount of responses
being dropped due to local response channel being full

* scripts/watch-threads.sh: don't highlight changes

* ws: glommio: await when sending responses from shared to local

* ws: glommio: limit ws message queue; add lots of ::log::warn for debug

* ws: glommio: add timeout to send_out_message, maybe pinpointing issue

* ws: glommio: clean up, tweak channel sizes; update TODO

* ws: glommio: set send timeout to 10s, add backpressure, accept drops

* ws: glommio: yield if needed in ConnectionReader backoff loop

* ws load test: add config key connection_creation_interval_ms

* ws load test: don't print "run connection" when opening connection

* ws load test: rename config num_connection to num_connections_per_worker

* ws load test config: improve order of code in file

* ws: glommio: info-level log for socket send timeout

* ws glommio: clean idle connections, improve cleaning code

* ws: glommio: make ConnectionWriter::send_error_response fallible; fmt

* ws: glommio: store JoinHandle in conn reference, cancel task on clean

* add scripts/heaptrack.sh

* Update TODO
This commit is contained in:
Joakim Frostegård 2021-12-11 18:50:05 +01:00 committed by GitHub
parent e1bffae42c
commit 222fac0e09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 334 additions and 165 deletions

47
Cargo.lock generated
View file

@ -94,7 +94,7 @@ dependencies = [
"either",
"futures-lite",
"futures-rustls",
"glommio",
"glommio 0.6.0 (git+https://github.com/DataDog/glommio.git?rev=4e6b14772da2f4325271fbcf12d24cf91ed466e5)",
"itoa",
"log",
"memchr",
@ -120,7 +120,7 @@ dependencies = [
"aquatic_common",
"aquatic_http_protocol",
"futures-lite",
"glommio",
"glommio 0.6.0 (git+https://github.com/DataDog/glommio.git?rev=4e6b14772da2f4325271fbcf12d24cf91ed466e5)",
"hashbrown 0.11.2",
"log",
"mimalloc",
@ -239,7 +239,7 @@ dependencies = [
"futures",
"futures-lite",
"futures-rustls",
"glommio",
"glommio 0.6.0 (git+https://github.com/DataDog/glommio.git?rev=2efe2f2a08f54394a435b674e8e0125057cbff03)",
"hashbrown 0.11.2",
"histogram",
"log",
@ -270,7 +270,7 @@ dependencies = [
"async-tungstenite",
"futures",
"futures-rustls",
"glommio",
"glommio 0.6.0 (git+https://github.com/DataDog/glommio.git?rev=2efe2f2a08f54394a435b674e8e0125057cbff03)",
"hashbrown 0.11.2",
"mimalloc",
"quickcheck",
@ -315,9 +315,9 @@ dependencies = [
[[package]]
name = "async-tungstenite"
version = "0.15.0"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "742cc7dcb20b2f84a42f4691aa999070ec7e78f8e7e7438bf14be7017b44907e"
checksum = "a0d06e9a20f1c0d64b6067ef6aa9fdf59e194ecde93575591fb4c78063692324"
dependencies = [
"futures-io",
"futures-util",
@ -944,6 +944,37 @@ version = "0.26.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4"
[[package]]
name = "glommio"
version = "0.6.0"
source = "git+https://github.com/DataDog/glommio.git?rev=2efe2f2a08f54394a435b674e8e0125057cbff03#2efe2f2a08f54394a435b674e8e0125057cbff03"
dependencies = [
"ahash",
"bitflags 1.3.2",
"bitmaps",
"buddy-alloc",
"cc",
"concurrent-queue",
"crossbeam",
"enclose",
"futures-lite",
"intrusive-collections",
"lazy_static",
"libc",
"lockfree",
"log",
"membarrier",
"nix",
"pin-project-lite",
"rlimit",
"scoped-tls",
"scopeguard",
"smallvec",
"socket2 0.3.19",
"tracing",
"typenum",
]
[[package]]
name = "glommio"
version = "0.6.0"
@ -2214,9 +2245,9 @@ dependencies = [
[[package]]
name = "tungstenite"
version = "0.15.0"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "983d40747bce878d2fb67d910dcb8bd3eca2b2358540c3cc1b98c027407a3ae3"
checksum = "6ad3713a14ae247f22a728a0456a545df14acf3867f905adff84be99e23b3ad1"
dependencies = [
"base64",
"byteorder",