Skip to content

socks5: improve throughput - #194

Merged
pymq merged 2 commits into
masterfrom
socks5-fix-perf
Jan 14, 2026
Merged

socks5: improve throughput#194
pymq merged 2 commits into
masterfrom
socks5-fix-perf

Conversation

@pymq

@pymq pymq commented Jan 12, 2026

Copy link
Copy Markdown
Member

I added local benchmark for socks5 throughput with simnet and different bandwidth and latency pairs. Unfortunately, it's still flaky on my device, and I have no idea how to fix it. Nevertheless, this PR improves network utilization by 1.5-3x, as confirmed by my tests with a real network on a high latency connection between Europe and Asia.

It is possible to cut the TTFB in half by removing one RTT. However, a new protocol needs to be implemented, which will be done in a future MR.

Before:

+-----------------------------+---------+-----------------+------------+------------+-------------+---------+
|          SCENARIO           | LATENCY | BANDWIDTH LIMIT | THROUGHPUT | THROUGHPUT | UTILIZATION |  TTFB   |
|                             |         |                 |    AVG     | LAST 5 SEC |             |         |
+-----------------------------+---------+-----------------+------------+------------+-------------+---------+
| WARM-UP                     | 10ms    | 50 Mbps         | 25.04 Mbps | 25.42 Mbps | 50.08 %     | 43.8ms  |
| Fiber_100Mbps_1ms           | 1ms     | 100 Mbps        | 57.06 Mbps | 59.48 Mbps | 57.06 %     | 8.1ms   |
| LongDistFiber_100Mbps_200ms | 200ms   | 100 Mbps        | 25.43 Mbps | 28.77 Mbps | 25.43 %     | 807.3ms |
| Cable_50Mbps_10ms           | 10ms    | 50 Mbps         | 26.73 Mbps | 26.57 Mbps | 53.45 %     | 44.6ms  |
| LongDistCable_50Mbps_300ms  | 300ms   | 50 Mbps         | 11.80 Mbps | 12.40 Mbps | 23.61 %     | 1.2058s |
| Cable_10Mbps_100ms          | 100ms   | 10 Mbps         | 8.18 Mbps  | 7.67 Mbps  | 81.80 %     | 404.1ms |
| LongDistCable_10Mbps_300ms  | 300ms   | 10 Mbps         | 6.68 Mbps  | 7.53 Mbps  | 66.79 %     | 1.207s  |
+-----------------------------+---------+-----------------+------------+------------+-------------+---------+

After:

+-----------------------------+---------+-----------------+------------+------------+-------------+---------+
|          SCENARIO           | LATENCY | BANDWIDTH LIMIT | THROUGHPUT | THROUGHPUT | UTILIZATION |  TTFB   |
|                             |         |                 |    AVG     | LAST 5 SEC |             |         |
+-----------------------------+---------+-----------------+------------+------------+-------------+---------+
| WARM-UP                     | 10ms    | 50 Mbps         | 26.03 Mbps | 26.28 Mbps | 52.05 %     | 47.2ms  |
| Fiber_100Mbps_1ms           | 1ms     | 100 Mbps        | 97.19 Mbps | 97.02 Mbps | 97.19 %     | 5.8ms   |
| LongDistFiber_100Mbps_200ms | 200ms   | 100 Mbps        | 59.54 Mbps | 67.28 Mbps | 59.54 %     | 802.5ms |
| Cable_50Mbps_10ms           | 10ms    | 50 Mbps         | 48.26 Mbps | 48.28 Mbps | 96.53 %     | 41.8ms  |
| LongDistCable_50Mbps_300ms  | 300ms   | 50 Mbps         | 29.42 Mbps | 37.10 Mbps | 58.85 %     | 1.202s  |
| Cable_10Mbps_100ms          | 100ms   | 10 Mbps         | 8.47 Mbps  | 8.70 Mbps  | 84.67 %     | 401.9ms |
| LongDistCable_10Mbps_300ms  | 300ms   | 10 Mbps         | 6.65 Mbps  | 7.61 Mbps  | 66.54 %     | 1.2019s |
+-----------------------------+---------+-----------------+------------+------------+-------------+---------+

(flaky)
+-----------------------------+---------+-----------------+------------+------------+-------------+---------+
|          SCENARIO           | LATENCY | BANDWIDTH LIMIT | THROUGHPUT | THROUGHPUT | UTILIZATION |  TTFB   |
|                             |         |                 |    AVG     | LAST 5 SEC |             |         |
+-----------------------------+---------+-----------------+------------+------------+-------------+---------+
| WARM-UP                     | 10ms    | 50 Mbps         | 25.27 Mbps | 25.56 Mbps | 50.55 %     | 48.1ms  |
| Fiber_100Mbps_1ms           | 1ms     | 100 Mbps        | 54.95 Mbps | 55.14 Mbps | 54.95 %     | 9.4ms   |
| LongDistFiber_100Mbps_200ms | 200ms   | 100 Mbps        | 24.46 Mbps | 27.76 Mbps | 24.46 %     | 806.8ms |
| Cable_50Mbps_10ms           | 10ms    | 50 Mbps         | 25.86 Mbps | 25.67 Mbps | 51.71 %     | 45.1ms  |
| LongDistCable_50Mbps_300ms  | 300ms   | 50 Mbps         | 10.69 Mbps | 12.19 Mbps | 21.37 %     | 1.2083s |
| Cable_10Mbps_100ms          | 100ms   | 10 Mbps         | 8.54 Mbps  | 8.99 Mbps  | 85.40 %     | 405.4ms |
| LongDistCable_10Mbps_300ms  | 300ms   | 10 Mbps         | 6.62 Mbps  | 7.51 Mbps  | 66.15 %     | 1.2064s |
+-----------------------------+---------+-----------------+------------+------------+-------------+---------+

@pymq pymq added this to the v0.15.0 milestone Jan 12, 2026
@pymq
pymq merged commit 3f541bb into master Jan 14, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant