Files
telefind-rs/docs/capacity.md

3.2 KiB

Estimating intake and queue capacity

TGStat reports over 40 million new posts and messages daily from over 3.165 million channels and chats. Its callback documentation separately reports around 100,000 events per minute. Those figures measure different work. Neither is a traffic forecast for a single Telegram bot. Monitoring figures · Callback documentation

Telemetry advertises a searchable stock of over 4.45 billion messages. Its homepage does not give a daily intake series. A directory entry, an indexed post, an edit and a user query should be counted separately. Telemetry

Estimate new posts per day as the sum of reachable sources times posts per source per day for each source class. Measure edits, redeliveries and queries separately. As a planning scenario, 10,000 channels at 20 posts/day produce 200,000 posts/day. At an assumed 2 KiB per projected job this is 0.41 GB/day before queue overhead, indexes, replicas or media. A 10x peak is 23.1 posts/s. At that sustained peak, 15 minutes of stopped workers creates about 20,833 pending jobs; a consumer group processing 50/s takes about 13 minutes to catch up while peak traffic continues. Use measured byte and rate distributions before choosing a broker or retention period.

Queue integration

The built-in CLI processes updates inline. Hosts can instead call telegram::queue::run_gateway with a durable Publisher and run consume_one against separate Index and Query consumers. Scope the broker namespace to the bot. Share the backing search index across workers. Queries read the latest committed snapshot; queued posts can take time to appear. Search calls themselves remain synchronous. Workers for separate lanes may run on different hosts. A full broker can still backpressure the single inbound poller.

Use bounded retention and high-water marks. Commit durable acceptance before returning from publish; enforce deduplication across delivery and completion for the Telegram retry horizon. Preserve per-chat order across retries and exclude concurrent stale owners, including when worker leases expire during index writes. Configure finite worker operation timeouts, lease renewal or fenced writes. On store or worker failure the receipt remains unacknowledged. On transient reply failures the worker defers delivery, honoring Telegram retry_after. Spread retries, cap attempts, quarantine poison jobs with a replay path and coordinate bot-wide send limits across query workers. A lost sendMessage acknowledgement can still cause duplicate replies.

Monitor oldest unprocessed age, ingress rate and bytes by lane, indexing lag, reply latency, retry and dead-letter counts, 429s and worker throughput. Telegram keeps pending updates for at most 24 hours; a local broker only covers work it has accepted. A Bot API token receives channel posts where the bot is a member. Wider coverage needs an upstream source. Index growth, query traffic and restart recovery require separate measurements. Telegram Bot API · Bot FAQ