Skip to content

Parallel document uploads on same bot instance seem to be serialized / slower than expected + how to track upload/download progress? #903

Description

Hi,

I'm running telegram-bot-api (local mode) inside Docker (aiogram/telegram-bot-api:latest image) on a dedicated Hetzner server with good CPU, RAM, and network bandwidth. I have two questions:

1) Concurrent uploads from the same bot seem to be partially serialized

When I send two large files (700MB each) to the same bot concurrently via sendDocument, I observe:

  • Single file upload: ~55 seconds
  • Two files sent concurrently: first finishes in ~55s, second finishes in ~91s (not ~55s in parallel, but also not ~110s fully sequential)

Test command used:

curl -F "chat_id=<CHAT_ID>" -F "document=@file1.mp4" "http://localhost:8081/bot<TOKEN>/sendDocument" &
curl -F "chat_id=<CHAT_ID>" -F "document=@file2.mp4" "http://localhost:8081/bot<TOKEN>/sendDocument" &
wait

I ruled out network/disk bottlenecks (Hetzner dedicated server, good upload bandwidth, fast local disk). No CPU/memory limits are set on the Docker container. No custom flags are passed (default TELEGRAM_LOCAL=true, TELEGRAM_API_ID, TELEGRAM_API_HASH only).

Is this expected behavior due to how TDLib handles the internal thread pool / actor model per bot instance? Is there a way to increase parallelism for uploads from a single bot (e.g. via --cpu-affinity, --max-connections, or another flag), or is queuing per-bot instance expected by design?

2) How can I track upload/download progress of a file in real time?

Is there any API method, webhook event, or getFile-style polling mechanism that reports the current bytes uploaded/downloaded for an in-progress file transfer (similar to TDLib's updateFile with local/remote FileDownload/UploadedSize)? I'd like to show progress percentage to end users while a large file is being uploaded or downloaded through the Bot API server.

Thanks in advance!

Activity

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