some performance optimizations for tunnel-node#1414
Conversation
…pgw DNS High priority: - therealaleph#1 Replace reader_task busy-poll (50ms) with drain_notify Notify — reader now wakes only when bytes are consumed, cutting CPU waste under sustained backpressure (fast upstream / slow Apps Script). - therealaleph#4 Add buf_len / pkt_count atomics so the straggler settle loop reads buffer sizes lock-free (was 10k+ mutex acquisitions per batch). - therealaleph#7 Make DstAddr::to_socket_addr async, use tokio::net::lookup_host instead of blocking std::net::ToSocketAddrs inside async tasks. Medium priority: - therealaleph#5 Collect stale sessions under global lock but abort them after releasing it — other handlers aren't blocked during task abort. - therealaleph#8 Cap udpgw accumulation buffer at 256 KiB; clear on overflow to prevent OOM from repeated corrupt frames. Low priority: - Add sid_short(&str) helper, deduplicate nginx-404 DECOY_404_BODY const, remove redundant drop(packets), suppress dead_code on test-only pub consts.
|
oh hey would you look at that another optimization edit |
|
@CaptainMirage which one do you mean? |
yours lol, to rephrase : tho if u go see i did check, we have no conflicts, our PRs are complementary |
|
Thanks for this. I pulled the PR head via tarball locally because git fetch is misbehaving on my side today, then ran the tunnel-node gate: I am not merging yet because I found one race in the new atomic buffer-length accounting. In session.read_buf.lock().await.extend_from_slice(&buf[..n]);
session.buf_len.fetch_add(n, Ordering::Release);Because the lock guard is not bound to a variable, it is dropped at the end of the first statement. A concurrent Please update this so the atomic is written while the After that change I can re-run Answered via LLM, Supervised @therealaleph |
perf(tunnel-node): event-driven backpressure, atomic settle, async udpgw DNS
High priority:
Medium priority:
Low priority: