Repository navigation
test(bench): four-core server comparison (Xray, sing-box, mihomo, Citrus) - #126
Merged
Merged
Conversation
…AnyTLS The harness compares Xray-core, sing-box, mihomo and Citrus as servers. - fetch.sh pins sing-box v1.14.3 (musl build) and Xray v26.10.17, both checked against the release asset digests (Xray also its .dgst). - cmp gen writes the sing-box configs and the new inbounds: Hysteria2, TUIC v5 and AnyTLS (sing-box, mihomo, Citrus; Xray has Hysteria2). A server without an inbound gets no config and run.sh skips it as n/a. - One client per protocol for every server: Xray where it speaks the protocol, sing-box for TUIC and AnyTLS. QUIC runs skip the TCP checks. - Xray's Hysteria server gets maxIncomingStreams 2^60, as the sing-quic servers have: with its default of 1024 its own client fails new streams. - cmp report: four columns, n/a cells, headline.md with the winner per protocol (a tie when the min-max ranges overlap) and Citrus against the best other server; memory levels a server did not reach are left out; reality-tlsin uploads are marked not comparable (the client decides). - run.sh: NAME, NET, SUBNET and IMAGE let setups share a host; ALONE=1 waits for other containers before a run and flags the runs one starts during; ONLY reruns given runs; NET_ADMIN for the QUIC buffers. The client config path is per network, so its pkill does not hit the clients of another setup.
Xray-core v26.10.17, sing-box v1.14.3, mihomo v1.19.32 and Citrus cc48b13 (dev after the upload write batching, before the download batching) as servers: REALITY (+ variants), XHTTP, Trojan, SS2022, Hysteria2, TUIC and AnyTLS, 3 repetitions. RESULTS.md has the method, the clients per protocol, the headline tables with the winner per protocol, the verdict and the caveats; runs that another container overlapped were redone and the originals kept under disturbed/.
This was referenced Oct 18, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Server-side comparison of four cores on one host, same load, same client per protocol: Xray-core v26.10.17, sing-box v1.14.3, mihomo v1.19.32 and Citrus
cc48b139.Citrus snapshot:
devafter #119 (upload write batching) and #118, before #124 (download batching, tls/utls fork bumps) — #124 is not in these numbers.Full write-up:
test/bench/compare/results/2026-10-18-four-cores/RESULTS.md(method, versions, clients, caveats, verdict); all cells with min–max inheadline.md/tables.md.Harness (test/bench/compare)
cmp reportwritesheadline.md: per protocol the winner (a tie when min–max ranges overlap) and Citrus vs the best other server. Unreached idle levels give no value;reality-tlsinuploads are marked not comparable (Xray's client decides whether Vision goes direct).run.sh:NAME/NET/SUBNET/IMAGEto share a host,ALONE=1waits for and flags foreign containers,ONLYto redo runs; the client config path is per network (with--pid=hostthe oldpkillkilled the clients of other bench setups).maxIncomingStreams2^60 like the sing-quic servers: with its default 1024 its own client fails ~99.9% of new streams.Headline (medians of 3; Xray / sing-box / mihomo / Citrus)
Download, 32 streams, MB/s
Upload, 32 streams, MB/s
Server CPU per GB, CPU s/GB (lower is better)
At 500 Mbit/s, one stream (same work for every server):
Bulk, 32 streams (unpaced):
New connections (128 concurrent clients, request/answer, the sink closes)
Idle tunnels: RSS per tunnel, KiB (lower is better)
TUIC on Citrus: no value at 5000. Citrus's TUIC server allows 2048
concurrent bidirectional streams per QUIC connection (
listener/tuic/server.go,ServerMaxIncomingStreams), and the sing-box client does not wait for streamcredit: past 2048 it refuses new tunnels ("too many open streams", 2952
errors of 5000 in every repetition). The code comment assumes clients wait
for MAX_STREAMS; the sing-box client does not. A single sing-box TUIC client
with more than 2048 simultaneous TCP connections gets errors from Citrus and
not from mihomo or sing-box. At 1000 tunnels Citrus uses the least.
Latency under load (8-stream unpaced download on the same server)
On the TCP protocols this RTT is mostly queueing in socket buffers behind the
unpaced download (70–90 ms at 2–4 GB/s); it tracks how much a server buffers,
not its scheduling. sing-box is lower on SS2022 (45 vs 69–80 ms) while also
downloading the fastest there. QUIC protocols stay at 1–3 ms because the
bulk rate is 5× lower.
Verdict
Overall. No core wins everywhere. On this host, among the four, Citrus
has the best or tied-best result on most TCP metrics (REALITY, Trojan,
SS2022, XHTTP): download on par with mihomo and sing-box and far ahead of
Xray, upload ahead of mihomo and sing-box by 50%+ (behind Xray by 16–17% on
Trojan/SS2022 bulk upload), new connections on par with mihomo (13% ahead
on REALITY), and the
lowest memory per tunnel on REALITY, XHTTP and SS2022. sing-box is the
reference on AnyTLS and TUIC (and its new-connection path is the cheapest
on the QUIC protocols); Xray remains the most CPU-efficient on Trojan/SS2022
bulk upload. On the QUIC protocols (Hysteria2, TUIC) sing-box, mihomo and
Citrus are within
the noise on throughput and CPU per GB (Xray trails on Hysteria2 download
and CPU); differences there are in new
streams and memory.
Main caveats: one host (Docker Desktop/WSL2, hybrid CPU), no latency or loss on the bridge; QUIC throughput is bounded by one connection per client; TUIC/AnyTLS use the sing-box client; Citrus's TUIC server caps 2048 streams per connection and the sing-box client errors past that (no 5000-tunnel value for Citrus TUIC; follow-up). Runs overlapped by other containers on the shared host were redone (see RESULTS.md).