Skip to content

Slow download speeds for small files #1088

Closed

Description

@letmeinbruh13

I've noticed that the download speed varies significantly depending on file size:

Platform: Android
App Version: Latest version and also previous versions
Mode: Full Tunnel

• Large files (>10 MB): Download at a decent speed
• Small files (<10 MB): Download speed is capped around 50-80 KB/s

I tested this in Telegram as well:
• When downloading a big file, it starts by downloading a 512 KB chunk and then continues with a decent speed
• For smaller files, it starts with a 32 KB chunk and the speed is limited to 50-80 KB/s

However, if I simultaneously start downloading multiple small files, the speed multiplies for each file:
• 2 files (5 MB each): speed increases to 100-160 KB/s
• 4 files: speed increases to ~300 KB/s

Is there a way to fix this so that smaller files also download quickly?

I'm using full tunnel mode.

Extra note: Using the download speed boost option in unofficial Telegram clients improves the download speed for both small and large files. However, there's still a difference between the download speed of small and large files.

Logs attached:

• 1mb.txt — log for 1 MB worth of video from a 6 MB video in Telegram (download speed boost was on, speed ~50 KB/s)
• 13.9mb.txt — log for a 13.9 MB video in Telegram (download speed boost was on, speed ~300-600 KB/s)

One more note:

I believe this behavior may not be universal across all apps/websites. For example:
• Downloading 6 MB from Cloudflare's speedtest — speed was good
• Downloading from Instagram — the slow-down behavior can be observed. in fact, all videos with all sizes load slowly. but in the web version the behavior is different and needs further checks
edit: the web version of Instagram is fine. i guess the web version of telegram should be fine too.

Activity

  1. dazzling-no-more commented on May 12, 2026

    @dazzling-no-more
    Contributor

    What mode are you on? Can you share the logs?

  2. letmeinbruh13 commented on May 12, 2026

    @letmeinbruh13
    Author

    What mode are you on? Can you share the logs?

    @dazzling-no-more I'm using full tunnel mode.

    Extra note: Using the download speed boost option in unofficial Telegram clients improves the download speed for both small and large files. However, there's still a difference between the download speed of small and large files.

    Logs attached:

    • 1mb.txt — log for 1 MB worth of video from a 6 MB video in Telegram (download speed boost was on, speed ~50 KB/s)
    • 13.9mb.txt — log for a 13.9 MB video in Telegram (download speed boost was on, speed ~300-600 KB/s)

    One more note:

    I believe this behavior may not be universal across all apps/websites. For example:
    • Downloading 6 MB from Cloudflare's speedtest — speed was good
    • Downloading from Instagram — the slow-down behavior can be observed. in fact, all videos with all sizes load slowly. but in the web version the behavior is different and needs further checks
    edit: the web version of Instagram is fine. i guess the web version of telegram should be fine too.

  3. therealaleph commented on May 12, 2026

    @therealaleph
    Owner

    Reviewed via Anthropic Claude.

    @letmeinbruh13 — "small files slow, large files fast" on Full mode is consistent with how the batch coalesce works:

    • Large files (>10 MB): range-parallel path. mhrv-rs fires up to 8 parallel 256 KiB chunk requests. Each Apps Script call brings back ~256 KiB. Throughput compounds — actual speed is bounded by your weakest connection segment (Apps Script edge → your ISP).
    • Small files (<10 MB): single-request path. One Apps Script round-trip for the entire file. Latency dominates throughput here — even at 50-80 KB/s, a 5 MB file is ~60-100 seconds.

    This isn't a bug; it's the structural cost of doing each small file in one round-trip. The fix is request batching across multiple small files, which is what Code.gs's spreadsheet cache () addresses for repeat assets — once you've seen the same URL once, subsequent fetches come from the spreadsheet cache instantly. v1.9.23 (just shipped) also has the large-file streaming fix from #1085 that improves throughput for the >40 MiB range.

    Tuning that helps small-file throughput today:

    • parallel_relay: 2 (or higher, up to your script_id count): fan out small requests across multiple deployments for first-byte latency improvement
    • coalesce_max_ms: 2000: pack more concurrent small-file requests into one batch
    • More script_id entries from different Google accounts: round-robin reduces per-deployment quota pressure

    For HTTP API calls (REST endpoints returning JSON, etc.) which are intrinsically small-file requests, 50-80 KB/s in Full mode is roughly what Apps Script's per-request RTT allows. Switching to apps_script mode (no tunnel-node middleman) usually helps for those — one less layer.

    Closing — expected behavior. If you're seeing speeds much worse than 50-80 KB/s for small files (e.g. sub-10 KB/s) that's separate and worth a new issue with timing data.

  4. letmeinbruh13 commented on May 12, 2026

    @letmeinbruh13
    Author
    • Small files (<10 MB): single-request path. One Apps Script round-trip for the entire file. Latency dominates throughput here — even at 50-80 KB/s, a 5 MB file is ~60-100 seconds.

    @therealaleph I understand the need for lower latency with smaller files, but some types of files fall into a gray area. For example, most Instagram and Telegram videos are well below 10 MB, and to watch a 30-second video, sometimes we have to wait 140 seconds for it to load completely. Isn't there a way to make certain file formats or specific services like Instagram/Telegram use the batch-request path you mentioned to make watching videos a smoother experience in full tunnel mode?

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions