Commit graph

189 commits

Author SHA1 Message Date
Joakim Frostegård
67c4c02bbd
aquatic_ws: mio: replace native_tls with rustls, rewrite connection state logic completely (#38)
* ws: mio: use rustls, rewrite Connection logic

* ws: mio: improve poll register/deregister handling

* ws: mio: work on type-level poll registry safety

* ws: mio: use stronger poll registry type-level guarantees

* ws: mio: fix stream reading

* ws: clean up, run fmt

* ws: mio: don't require registered connection for writing, improve docs

* ws: mio: add Connection::get_meta(), make Connection::meta private

* ws: mio: add ConnectionMap struct; remove utils.rs

* ws: mio: move token counter into ConnectionMap, improve docs

* ws: mio: connection: move Connection struct above state structs

* Update TODO

* ws: fix build errors

* ws: upgrade to tungstenite 0.16

* ws load test: don't panic on Close message; print shorter errors

* ws: fix socket worker bugs, add log statements

* ws: mio: wait for write availability if would block for ws messages

* Update README

* ws: mio: limit channels & queues; read 1 message only; other fixes

* ws: mio: send local responses each event; decrease channel size

* Update TODO

* ws: mio: limit ws send queue, fixing memory leak; limit pending messages

Also change some log output levels and run rustfmt

* Update TODO

* Update TODO
2021-12-16 16:09:36 +01:00
Joakim Frostegård
222fac0e09
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
2021-12-11 18:50:05 +01:00
Joakim Frostegård
baec259feb ws: use file naming more in line with other impls; other small fixes 2021-11-27 18:35:45 +01:00
Joakim Frostegård
d20e57d861 ws: use idiomatic folder structure 2021-11-27 18:19:43 +01:00
Joakim Frostegård
473276cd46 Switch to rust edition 2021 2021-11-24 18:56:26 +01:00
Joakim Frostegård
fee3c9ca4e Update mio to version 0.8 2021-11-19 03:01:03 +01:00
Joakim Frostegård
028a366ce5 Don't unnecessarily constrain crate versions in Cargo.toml files 2021-11-19 02:45:53 +01:00
Joakim Frostegård
af8b776937 udp, ws: auto-enable cpu-pinning feature when running with glommio 2021-11-11 20:54:40 +01:00
Joakim Frostegård
321add8455 udp glommio, ws: give worker threads names 2021-11-11 19:59:21 +01:00
Joakim Frostegård
40df1b587f run cargo fmt 2021-11-11 17:53:02 +01:00
Joakim Frostegård
4f8328b70a Feature-gate CPU pinning, since it only works on Linux 2021-11-09 11:40:16 +01:00
Joakim Frostegård
e86410291a cpu pinning: set affinity to multiple hyperthreads, fix issues 2021-11-07 13:31:03 +01:00
Joakim Frostegård
b54694bbc0 aquatic_ws: improve cpu pinning 2021-11-07 11:46:48 +01:00
Joakim Frostegård
1d34ba25bb aquatic_ws: mio: release torrent map lock quicker in handlers 2021-11-05 13:40:30 +01:00
Joakim Frostegård
2bed6ccdc5 WIP: ws: split into features, other fixes 2021-11-05 13:25:19 +01:00
Joakim Frostegård
465cf5920d WIP: ws: put back mio implementation 2021-11-05 12:42:55 +01:00
Joakim Frostegård
3986c0ec92 ws: don't panic when ConnectionWriter can't recv from closed channel 2021-11-05 11:27:51 +01:00
Joakim Frostegård
b8073e4bd1 Replace HashMap and IndexMap with indexmap_amortized
This will hopefully get down latency.
2021-11-03 10:35:29 +01:00
Joakim Frostegård
8871d0eec8 http and ws: rename cleaning.interval to torrent_cleaning_interval 2021-11-03 00:11:24 +01:00
Joakim Frostegård
fa3b6bb259 Move fn update_access_list to aquatic_common 2021-11-02 23:33:47 +01:00
Joakim Frostegård
446fd0b1f4 aquatic_ws: use signals for access list updates 2021-11-02 23:29:04 +01:00
Joakim Frostegård
78d29770f3 aquatic_ws, aquatic_ws_load_test: cargo fmt 2021-11-02 20:33:14 +01:00
Joakim Frostegård
98237c928f aquatic_ws: improve channel sending error handling 2021-11-02 12:06:53 +01:00
Joakim Frostegård
6140596d7e aquatic_ws: in request workers, await out message channel space 2021-11-02 11:58:10 +01:00
Joakim Frostegård
2f5e023fd7 aquatic_ws: use unbounded local out message channel 2021-11-02 11:57:43 +01:00
Joakim Frostegård
dcf86d2df2 aquatic_ws: remove unused statistics code and histogram dependency 2021-11-01 23:57:44 +01:00
Joakim Frostegård
65851fa544 aquatic_ws: remove unused config keys 2021-11-01 23:47:30 +01:00
Joakim Frostegård
e00dcaa5c3 aquatic_ws: log ConnectionWriter::send_error_response errors 2021-11-01 22:19:00 +01:00
Joakim Frostegård
724932a498 aquatic_ws: pending scrape responses: avoid cloning stats 2021-11-01 22:17:31 +01:00
Joakim Frostegård
07e1b8230f aquatic_ws: reclaim pending_scrape_slab memory after entry removal 2021-11-01 21:41:05 +01:00
Joakim Frostegård
d2595e9746 aquatic_ws: split networking into reader and writer tasks 2021-11-01 21:34:34 +01:00
Joakim Frostegård
23c2eff6f3 aquatic_ws: move comment on empty info hashes to network.rs 2021-11-01 19:25:14 +01:00
Joakim Frostegård
786642f486 aquatic_ws: in handlers, collect out messages in Vec for sending 2021-11-01 19:20:49 +01:00
Joakim Frostegård
24bfaf67c0 aquatic_ws: rewrite to use glommio 2021-11-01 19:08:00 +01:00
Joakim Frostegård
30fa96a7f4 aquatic_ws: use PrivilegeConfig from aquatic_common 2021-10-27 20:50:55 +02:00
Joakim Frostegård
38617c70f4 Refactor AccessList; update it periodically in aquatic_udp glommio 2021-10-19 22:52:31 +02:00
Joakim Frostegård
f3487d4749 Rename AccessList variants 2021-10-17 18:19:31 +02:00
Joakim Frostegård
1e66b18e52 aquatic_ws network: don't send error response when message parse fails 2021-10-16 18:07:00 +02:00
Joakim Frostegård
3678e86654 Run rustfmt 2021-10-16 17:49:00 +02:00
Joakim Frostegård
523a21dac4 aquatic_ws: improve network message reading, handle parse error better 2021-10-16 17:46:42 +02:00
Joakim Frostegård
8c3db1b9b9 aquatic_ws: use cleaner logic for filtering by access list 2021-10-16 17:31:11 +02:00
Joakim Frostegård
7ccd5fcbf7 access lists: filter requests in socket workers instead 2021-10-16 17:26:40 +02:00
Joakim Frostegård
417ebf61b9 aquatic_ws; clean up 2021-10-16 01:56:43 +02:00
Joakim Frostegård
c02d7f2113 aquatic_ws: run rustfmt 2021-10-16 01:47:10 +02:00
Joakim Frostegård
1d5eb0dff9 aquatic_ws: add ErrorResponse, send it when info hash is not allowed 2021-10-16 01:18:23 +02:00
Joakim Frostegård
28cc6c261a aquatic_ws: almost finish implementing access list support 2021-10-16 01:08:59 +02:00
Joakim Frostegård
d1ee18394d aquatic_ws: don't call unwrap on stream.get_peer_addr 2021-10-16 00:27:52 +02:00
Joakim Frostegård
6cfa220097 access list: log when update fails; run cargo fmt 2021-10-15 02:35:13 +02:00
Joakim Frostegård
fae0692f90 Upgrade tungstenite 2021-08-16 23:22:56 +02:00
Joakim Frostegård
82a36041b3 Merge branch 'master' into ws-file-transfer-ci 2021-08-16 19:27:13 +02:00