Skip to content

Compare TUN cores across proxy transports in isolated Linux - #152

Closed
andre487 wants to merge 5 commits into
mainfrom
bench/compare-sing-box
Closed

andre487 wants to merge 5 commits into
mainfrom
bench/compare-sing-box

Conversation

@andre487

@andre487 andre487 commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Add a manual Linux TUN comparison of the production MegaProxy core across nine proxy variants. Rebased on main with the QUIC receive-credit fix from #153. Build Go binaries with one toolchain and pinned GOST 3.3.0; original pairs use stable sing-box 1.14.4 (gvisor), while HTTP/2, HTTP/3 and CONNECT-UDP/MASQUE use pinned 1.15.0-alpha.13 (gvisor + QUIC), with explicit HTTP versions and fallback disabled. CONNECT-IP is outside this comparison.

Require iperf3 3.22.1 before setup, resolving one executable for client and server through Fastlane iperf:PATH / runner --iperf PATH. Record its version, path and SHA-256. Preserve process return codes and signal names. An unexpected fixture exit aborts without retries and retains partial samples, summary and complete: false status identifying the fixture and exit cause. A completed matrix with failed workloads still exits nonzero with complete: true.

HTTP/3 jump is excluded from both engines pending GOST's oversized-DATAGRAM fix. The exclusion/reason remains in metadata and the report. The error path still exists in go-gost/x v0.28.1 and the inspected master: MASQUE WriteTo, UDP relay. No diagnostic GOST patch is used.

Use private verified TLS/SSH identities, network namespaces, fixed CPU affinity and independent TUN/underlay MTUs (1400/1500). Each workload gets a fresh warmed core. Measure TCP upload/download, connection+echo, supported UDP, latency percentiles and core CPU/RSS at 1/8 streams. Host routes, trust stores and existing SSH service are untouched; credentials stay outside artifacts. Expose Fastlane lanes and synchronized EN/RU methodology; required CI has no performance thresholds.

Completed post-fix measurements

Clean commit 18973b3, Go 1.26.3, same dedicated 2-vCPU Linux VM, three samples, two measured seconds plus warm-up. 462/462 passed, including 30 direct controls; all 432 successful proxied measurements increased both TUN counters. No UDP packet loss was observed at an offered 20 Mbit/s total (1/8 streams). Exact runner and binary hashes are retained with raw JSON outside Git; previous pre-fix and diagnostic datasets are separate and not pooled.

Median single-stream TCP receiver goodput, upload/download, Mbit/s:

Transport MegaProxy sing-box sing-box version
SOCKS5 1077 / 268 2238 / 900 1.14.4
HTTPS/1.1 1003 / 281 1994 / 844 1.14.4
HTTPS/2 1013 / 328 1944 / 996 1.15.0-alpha.13
HTTPS/3 809 / 763 1425 / 793 1.15.0-alpha.13
MASQUE 819 / 771 1443 / 752 1.15.0-alpha.13
SSH 740 / 464 1150 / 669 1.14.4
HTTPS jump 1.1 943 / 343 1814 / 790 1.14.4
HTTPS jump 2 881 / 391 1492 / 889 1.15.0-alpha.13
SSH jump 540 / 354 770 / 471 1.14.4

Profiling qualification

A separate anonymous-SOCKS5 experiment confirms different Linux TUN capabilities: kernel netlink reports vnet_hdr=false for MegaProxy and true for stock sing-box. Forcing only sing-box's GSO option off selects the non-vnet/GRO/offload path and changes single-stream upload from 2290 to 710 Mbit/s; MegaProxy records 1075. Download changes from 920 to 640, versus MegaProxy's 237. These are single 15-second diagnostic samples with identical profiling hooks, not replacement medians for the table above. The original table compares Linux defaults, not equal offload capabilities or Android performance.

Native reverse CPU profiling attributes 41.23% of CPU samples cumulatively to rackControl.detectLoss and its children. A temporary TCPRecovery=0 control raises native download from 237 to 448 Mbit/s (one stream), and from 344 to 466 (eight). This establishes a contributor, not the entire remaining gap. Disabling loss recovery is not a proposed production fix; packet loss/reordering behavior was not tested. System calls and packet processing remain important; telemetry/GC do not appear as primary CPU consumers in this experiment.

All 18 profiling/control workloads pass. CPU, block, mutex, alloc/heap, mid-run goroutine profiles and separate execution traces are retained outside Git with source/binary hashes. No production code was changed for profiling.

Validation: Fastlane Python checks pass (93 tests); CI for the exact head is successful, including native integration and Android API 26/35. VM setup smoke passes 30/30. Old iperf3 3.16 is rejected before setup; an intentionally SIGKILLed private iperf server verifies explicit signal reporting and preservation of one partial measurement with complete: false.

Short samples, shared server/load CPU, VM scheduling and prerelease sing-box limit generalization. These are Linux TUN measurements; Android/JNI and energy performance are not measured.

APK artifacts

Built from commit 18973b3c by CI run #494.
Artifacts expire after 14 days. Neither APK uses the MegaProxy release key.

@andre487 andre487 changed the title Compare production TUN core with sing-box on isolated Linux Compare TUN cores across proxy transports in isolated Linux Nov 21, 2026
@andre487
andre487 force-pushed the bench/compare-sing-box branch from 6a6cb6d to 18973b3 Compare November 21, 2026 12:54
@andre487 andre487 closed this Nov 21, 2026
@andre487
andre487 deleted the bench/compare-sing-box branch November 21, 2026 20:01
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