Commit graph

289 commits

Author SHA1 Message Date
Joakim Frostegård
2e67f11caf
udp: add experimental io_uring implementation (#131)
* WIP: add udp uring support

* WIP: fix udp uring address parsing

* WIP: udp uring: resubmit recv when needed

* WIP: udp uring: add OutMessageStorage, send swarm responses

* WIP: udp uring: increase ring entries to 1024

* WIP: udp uring: add constants

* WIP: udp uring: use sqpoll, avoid kernel calls

* WIP: udp uring: disable sqpoll

* WIP: udp uring: use VecDeque for local responses

* udp uring: enable setup_coop_taskrun

* udp uring: add RecvMsgStorage

* udp: improve split of uring and mio implementations

* udp uring: clean up

* udp uring: initial ipv6 support

* udp uring: improve helper structs

* udp uring: clean up, use constants for important data

* udp: share create_socket fn between implementations

* udp uring: improve send buffer free index finding

* udp uring: work on SendBuffers.try_add

* udp uring: split into modules

* udp uring: Rename RecvMsgMultiHelper to RecvHelper

* udp uring: improve SendBuffers

* udp uring: fix copyright attribution in buf_ring module

* udp uring: stop always consuming 100% cpu

* udp uring: clean up

* udp uring: add handle_recv_cqe

* udp uring: move local_responses into SocketWorker

* udp uring: move timeout_timespec into SocketWorker

* Update TODO

* udp: make io-uring optional

* Update TODO

* udp uring: enqueue timeout before sends

* udp uring: move likely empty buffer tracking logic into SendBuffers

* udp uring: improve error handling and logging

* udp uring: keep one timeout submitted at a time

* udp uring: update pending_scrape_valid_until

* udp uring: add second timeout for cleaning

* Update TODO

* udp uring: store resubmittable squeue entries in a Vec

* udp uring: add comment, remove a log statement

* Update TODO

* Update TODO

* udp: io_uring: fall back to mio if io_uring support not recent enough

* udp: uring: add bytes_received statistics

* udp: uring: add bytes_sent statistics

* udp: uring: add more statistics

* Update TODO

* udp: uring: improve SendBuffers code

* udp: uring: remove unneeded squeue sync calls

* udp: uring: replace buf_ring impl with one from tokio-uring

* udp: uring: store ring in TLS so it can be used in Drop impls

* udp: uring: store BufRing in SocketWorker

* udp: uring: silence buf_ring dead code warnings, improve comment

* Update TODO

* udp: uring: improve CurrentRing docs, use anonymous struct field

* udp: uring: improve ring setup

* udp: uring: get ipv6 working

* udp: uring: make ring entry count configurable, use more send entries

* udp: uring: log number of pending responses (info level)

* udp: uring: improve comment on send_buffer_entries calculation

* udp: improve config comments

* udp: uring: add to responses stats when they are confirmed as sent

* Update TODO

* udp: uring: enable IoUring setup_submit_all

* Update README
2023-03-07 19:01:37 +01:00
Joakim Frostegård
3806faaff9 udp: only include prometheus fields in config if feature enabled 2023-02-26 16:41:37 +01:00
Joakim Frostegård
f1d0901416 udp: check statistics.extended config for prometheus 2023-02-26 12:10:54 +01:00
Joakim Frostegård
07eac06a36 Enable prometheus by default, update README 2023-02-26 12:10:12 +01:00
Joakim Frostegård
9e7e56b082 udp: prometheus metrics for peers per torrent, add p999 2023-02-26 12:07:14 +01:00
Joakim Frostegård
5276a919da udp: add prometheus support 2023-02-26 11:57:00 +01:00
Joakim Frostegård
b42d55b003 Replace indexmap-amortized with plain (ahash) indexmap 2023-02-25 22:37:54 +01:00
Joakim Frostegård
9ace8f53b8 Upgrade hashbrown to version 0.13 2022-11-12 14:37:53 +01:00
Joakim Frostegård
82122da762 udp: in bandwidth statistics, take headers etc into account 2022-11-01 18:13:15 +01:00
Joakim Frostegård
c192ee6e5a udp: simplify statistics code further 2022-11-01 09:36:20 +01:00
Joakim Frostegård
3d6b012490 udp: refactor statistics code for better code clarity 2022-10-31 23:53:07 +01:00
Joakim Frostegård
77f5e68a9e udp: TorrentData: stop explicitly storing num_leechers
Calculate it with peers.len() - num_seeders instead
2022-10-26 20:59:25 +02:00
Joakim Frostegård
15f8d30518 udp: improve socket worker comments 2022-10-25 02:16:16 +02:00
Joakim Frostegård
224ae3ea3b udp: socket worker: always use relaxed ordering for stats 2022-10-25 02:00:55 +02:00
Joakim Frostegård
5e28f5a498 udp: handle request parse errors outside of handle_request function 2022-10-25 01:55:32 +02:00
Joakim Frostegård
4587c267d6 udp: rewrite socket worker to use SocketWorker struct
Also, stop checking token number all the time
2022-10-25 01:33:35 +02:00
Joakim Frostegård
ed98327e1a udp: if PeerStatus is Stopped, return empty peer list 2022-09-25 11:51:28 +02:00
Joakim Frostegård
65a8c9d6ff Use Rust 1.64 workspace inheritance 2022-09-25 11:40:43 +02:00
Joakim Frostegård
9797f24299 udp: handle_announce_request: remove two noop casts 2022-09-18 18:09:43 +02:00
Joakim Frostegård
5889cb22f7 udp: handle_announce_request: don't cast usize to i32, use try_into 2022-09-18 18:06:31 +02:00
Joakim Frostegård
e9f83403ba udp: fix bug in TorrentData num_seeders/num_leechers updates 2022-09-18 17:55:39 +02:00
Joakim Frostegård
becf88c372 udp: in Peer, replace PeerStatus with is_seeder bool 2022-08-06 18:14:12 +02:00
Joakim Frostegård
c76d7442e2 Use regular (ahash) IndexMap for PeerMaps 2022-08-06 16:53:49 +02:00
Joakim Frostegård
80cd6a3998 udp: improve docs for config.statistics.extended 2022-08-06 14:40:52 +02:00
Joakim Frostegård
e6e0bbc9da udp: show extended statistics in html output too 2022-08-06 14:36:46 +02:00
Joakim Frostegård
096fdeb93c udp: prettier stdout statistics printing 2022-08-06 14:20:18 +02:00
Joakim Frostegård
f0e0a84088 udp: add optional peers per torrent statistics 2022-08-06 13:56:19 +02:00
Joakim Frostegård
fcf18c845f Reduce ValidUntil size; reduce size of various ws structs 2022-08-01 14:15:06 +02:00
Joakim Frostegård
cedf0b61ca Exit with error message on unrecognized config keys 2022-07-05 11:26:46 +02:00
Joakim Frostegård
4ef51937a8 udp: fix rename (request worker to swarm worker) 2022-07-04 12:22:00 +02:00
Joakim Frostegård
fb2794643d udp, common: rename request workers to swarm workers 2022-07-04 11:49:39 +02:00
Joakim Frostegård
fb9d703007 udp: improve variable naming in read_requests 2022-07-04 08:52:58 +02:00
Joakim Frostegård
9d3420ba1c udp: improve code in send_response 2022-07-04 08:45:13 +02:00
Joakim Frostegård
8f37459298 udp: move ConnectionValidator to workers.socket.validator 2022-07-04 08:36:02 +02:00
Joakim Frostegård
de8d3a2bfa udp: improve config docs for resend_buffer_max_len 2022-07-03 22:29:51 +02:00
Joakim Frostegård
ff071080b0 udp: improve resend buffer logic and log messages 2022-07-03 22:24:58 +02:00
Joakim Frostegård
ae77c7426e udp: ignore requests with source port of value zero 2022-07-03 21:51:09 +02:00
Joakim Frostegård
daab5ab0d5 udp: improve response sending error logging 2022-06-28 01:10:37 +02:00
Joakim Frostegård
5cfd270ab7 udp: add optional resending buffer for responses that failed to send 2022-06-28 00:56:29 +02:00
Joakim Frostegård
945ff41ef2 Update crate descriptions 2022-06-27 22:44:45 +02:00
Joakim Frostegård
8451b2c50f udp: request workers: handle TorrentData updates in methods 2022-04-16 03:09:45 +02:00
Joakim Frostegård
80171170c8 udp: request workers: improve handle_scrape_request code 2022-04-16 02:28:03 +02:00
Joakim Frostegård
b8a74f0724 udp: make handle_scrape_request take protocol-specific TorrentMap 2022-04-16 02:21:19 +02:00
Joakim Frostegård
1025391e4f udp: request worker: remove layer of branching 2022-04-16 02:10:52 +02:00
Joakim Frostegård
9fedf82113 udp: improve TorrentMap cleaning code, always count peers 2022-04-16 01:59:36 +02:00
Joakim Frostegård
78266fd3e7 udp: move some TorrentMap cleaning code to TorrentData impl 2022-04-16 00:52:34 +02:00
Joakim Frostegård
29f97e881e udp: improve formatting of imports 2022-04-16 00:43:23 +02:00
Joakim Frostegård
1851886992 udp: socket workers: rename common.rs to storage.rs 2022-04-16 00:36:43 +02:00
Joakim Frostegård
043649d122 udp: fix name of test_pending_scrape_response_map 2022-04-16 00:35:22 +02:00
Joakim Frostegård
d0c6fb0e29 udp: request workers: move some code into run_request_worker 2022-04-16 00:29:50 +02:00