Skip to content

very slow download speed. #353

Closed as not planned
Closed as not planned

Description

@ipvsami

Hello. I am currently using the full-tunnel mode on a IP Project vps.
I am using 5 deployments, and the stability of telegram app is ok.
but the download speed is a nightmare! about 50KB/s!
checked the mhrv-rs stats while downloading, and cpu is about 0.04% so there is no bottleneck.
the VPS network port is 1Gb so I don't think that is the problem.
what is going on? Is deploying more accounts gonna fix it?

Activity

  1. therealaleph commented on Apr 27, 2026

    @therealaleph
    Owner

    @ipvsami — 50 KB/s in Full mode with low CPU + 1 Gbps VPS port + 5 deployments points to Apps Script as the bottleneck, not network or CPU. Here's the architecture:

    Each Full-mode batch is one UrlFetchApp.fetch() call:

    • Batch round-trip: Iran → Google edge → Apps Script execution → tunnel-node@VPS → origin → tunnel-node → Apps Script → Google edge → Iran
    • Apps Script's per-fetch latency floor: ~150-500ms (Google's internal hop)
    • Each batch can carry multiple ops, but the response is buffered and returned synchronously — no streaming, no pipelining within a batch

    Per-deployment throughput ceiling:

    • 30 concurrent executions per deployment (Apps Script enforced)
    • Each execution does one synchronous batch
    • Batch size is bounded by Apps Script's 50 MB response cap + 6 minute execution timeout

    For pure download throughput (e.g. downloading a large file), this means:

    • Theoretical max per deployment ≈ 30 concurrent × 50 MB / 6 min ≈ 4.2 MB/s upper bound
    • Real-world per deployment is far lower because batches usually finish in <30s with smaller payloads — say 30 batches × 256 KB / 1s = 7.5 MB/s, but in practice Apps Script's startup overhead means most batches are 200-500ms for 64-256 KB = ~500 KB/s sustained
    • Round-robin across 5 deployments multiplies parallelism but each flow is still bound to one deployment per session

    Why 50 KB/s:

    If you're downloading one large file (single TCP connection from origin, single SOCKS5 session through tunnel-node), only one deployment is in use for that flow. The 5 deployments give you horizontal capacity for multiple concurrent flows, not vertical capacity per flow.

    50 KB/s on a single flow is consistent with:

    • Apps Script's per-batch latency: ~250-300ms for 64 KB chunks → ~200 KB/s ceiling per flow
    • TCP slow-start within tunnel-node: a 250ms+250ms+250ms... pattern starves the TCP window from growing
    • Iran→Google round-trip: typically 200-300ms RTT in Iran, adding to per-batch latency

    Diagnostic to confirm:

    # Single-flow speed (where 50 KB/s shows):
    curl -o /dev/null -w "%{speed_download}\n" https://speed.cloudflare.com/__down?bytes=10000000
    
    # Multi-flow speed — open 5 parallel downloads:
    for i in 1 2 3 4 5; do
      curl -o /dev/null -w "stream $i: %{speed_download}\n" \
        https://speed.cloudflare.com/__down?bytes=10000000 &
    done
    wait

    If multi-flow aggregate is 5× the single-flow number, the bottleneck is per-flow Apps Script latency, and adding more deployments won't help a single flow but will help when multiple downloads run concurrently.

    If multi-flow doesn't scale linearly, there's another bottleneck (likely VPS network egress or tunnel-node coalescing).

    Mitigations:

    1. Increase parallel_concurrency in config — more concurrent batches per session = more inflight requests in flight at once. Default is 8 IIRC; try 16 or 32.

    2. Use a CDN-hosted target. Tested speeds against Cloudflare/Fastly/etc tend to be higher than tested against random origins because their TCP windows ramp faster.

    3. Switch to direct VPS connection. If you have your own VPS already, you can run a plain SOCKS5/Wireguard there and skip mhrv-rs entirely. mhrv-rs's value is the Apps Script domain-fronting layer, which is overhead when you control the path.

    For Telegram (your primary use case based on the report), 50 KB/s is sufficient — Telegram chunks are small, latency-tolerant. For file downloads, direct VPS Wireguard/Trojan ≫ mhrv-rs Full mode by 10-100x. Use mhrv-rs for the censorship-bypass layer (browser, app traffic) and a direct VPS connection for high-throughput downloads if speed matters.

    Adding more deployments helps if you have multiple concurrent flows. For one big download, no.


    [reply via Anthropic Claude | reviewed by @therealaleph]

  2. therealaleph commented on May 22, 2026

    @therealaleph
    Owner

    Closing this for now because the Apps Script per-flow throughput explanation and diagnostics were posted, and there has been no follow-up from the original reporter for more than 7 days.

    If the behavior is still different on the latest release, please reopen/comment with single-flow vs multi-flow speed numbers and the exact mode/deployment count. That will tell us whether this is the expected Apps Script per-flow ceiling or a separate tunnel-node bottleneck.


    Answered via LLM, Supervised @therealaleph

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions