Limits and isolation¶
Resources¶
Five limits come from the bot's plan: CPU, memory, storage, bandwidth and monthly transfer. They are shown on the plan cards when you buy, on the bot's Overview and on its Usage page, with how much of each the bot uses. The others are the same for every bot.
Set by the plan¶
| Resource | Limit |
|---|---|
| CPU | Set by the bot's plan, in cores (for example 0.5). A bot cannot use more: it runs slower instead. |
| Memory | Set by the bot's plan, for example 256 MB. Swap is not available. A bot that goes over the limit is killed (exit code 137) and restarted. |
| Persistent data | /data: one folder per bot that survives restarts and deploys, as large as the bot's plan says (for example 256 MB) and with at most 64 files per MiB (at least 4096). It is not executable. A write over the limit fails with "disk quota exceeded" and the bot keeps running. |
| Bandwidth | Set by the bot's plan, in Mbit/s, for each direction: what the bot sends and what it receives, on the network and through the webhook together. Faster transfers are slowed down, not refused. The limit holds from the bot's first instruction and the bot cannot change it. |
| Monthly transfer | Set by the bot's plan, in GB per calendar month (UTC): the data the bot sends plus the data it receives, webhook included. A bot that uses it all is slowed down, not stopped: see below. |
The same for every bot¶
| Resource | Limit |
|---|---|
| Processes and threads | 256 per bot. |
| Open files | 4096 per process. |
| Temporary space | /tmp and /var/tmp, 64 MiB each. They live in memory, count toward the memory limit and are gone at restart. The rest of the filesystem is read-only. |
| Log file | 10 MB; the Logs page shows the last 200 lines. |
| Build | 15 minutes per build, with its own memory, CPU and process limits. A build's downloads do not count toward the monthly transfer. |
| Deploys | 10 deployments and 20 starts or restarts per bot and hour. |
| Variables | 100 per bot, 4096 characters per value. |
| Source archive | 20 MB. |
| Webhook requests | 1 MB each; answer within 10 seconds. |
When a bot uses its monthly transfer¶
BotBarn adds up the data a bot sends and receives since 00:00 UTC on the 1st of the month, over all its deployments.
- At 80 % the Usage and Overview pages warn you, and you get one message (Telegram, or email) for that month.
- At 100 % the bot is slowed to 1 Mbit/s in each direction (or to its plan's own bandwidth when that is lower) and keeps running. A banner says until when, and you get one message for that month.
- It speeds up again at 00:00 UTC on the 1st, or as soon as you move the bot to a plan with more transfer than it used this month. The page shows the date in your time zone.
The numbers are measured every few minutes, so a bot can pass its transfer by a few minutes of traffic before it is slowed.
The network figures changed with the bandwidth limit
The network figures of the Usage page now come from the counters of the bandwidth limit itself: the webhook traffic is included, and what the limit dropped (for example a flood sent to the bot) is not. Figures from before the change were measured differently and can be lower or higher.
Usage against the limits¶
The Usage page lists the five limits with the use of the last 7 days (CPU, memory, bandwidth), the size of /data
and the transfer of the month, each with a bar and a status:
| Status | Meaning |
|---|---|
| OK | Below 80 % of the limit. |
| Near the limit | At 80 % or more. A warning names the limit and suggests the plan that fits. |
| Limit reached | Memory: the bot was killed for it in the last 7 days. /data: it is full and writes fail. Transfer: the bot is slowed down. CPU and bandwidth: at 95 % of the limit in the busiest hour, so the bot is held back (slower, not broken). |
A banner on the Overview and Usage pages says what it means and offers the plan that fits (or says that no plan on sale
is larger). The bots list marks a bot with a limit near or reached. Telegram or email tells you when a bot nears or
uses its transfer, fills /data, runs out of memory or reaches its bandwidth limit (95 % in the busiest hour), at
most once per bot and kind in a month (transfer) or a week (the others); turn this off with Usage limits in your
profile. Nothing is sent for CPU. Your AI assistant sees the same figures.
When new limits apply¶
When a bot's plan changes (a renewal on another plan, or the operator editing the plan), the bandwidth changes
within seconds, without a restart. CPU, memory and /data change at the next deploy or start; until then the Overview
and Deployments pages say so.
Isolation¶
Each bot runs in its own container:
- Rootless: containers run without root privileges on the host, with no extra Linux capabilities, and cannot gain new privileges. Even root inside a container maps to an unprivileged range of user IDs that no other container uses.
- Network: outgoing connections reach the public internet only. Other bots, the BotBarn servers and private networks are not reachable. Incoming traffic reaches the bot only through its webhook URL. The speed of each bot is limited to its plan's bandwidth by the server, from outside the container, so a bot cannot lift its own limit.
- Variables: each bot receives only its own variables.
- Files: the filesystem of the container is read-only except
/data,/tmpand/var/tmp./datais the bot's own persistent folder: it is mounted into that bot only, cannot run programs, and its size is limited by the plan in a way the bot cannot change./tmpand/var/tmpstay in memory. Nothing is shared between bots.
Your bot's data¶
/data is the place for everything the bot must remember: a SQLite database (use WAL mode) or plain files.
It survives restarts, crashes and deploys; its size follows the plan (shown on the plan cards and on the bot's
Overview, in the Data card, with what the bot uses). Files keep their numeric owner (uid), so a bot that
builds its own image should always run as the same fixed user. Do not chown /data or files in it: the bot has no
permission to change owners, so an image whose entrypoint does (the official PostgreSQL image, for example) fails to
start; chmod works. The data is deleted with the bot, and 7 days after
the plan ends (renew within 7 days and it is intact; the Overview shows the date). In the Data card you can
download everything as an archive and reset (empty) /data; the AI assistant can do the same.
- Builds: the build of your image runs under the same network rules as a running bot, with its own memory and CPU
limits, and in storage that other bots' builds cannot read.
Acceptable use¶
BotBarn hosts Telegram bots that people choose to talk to. Do not use it for:
- spam, bulk or unsolicited messages, or messages to users who did not start your bot;
- anything that breaks Telegram's terms or the law;
- attacking, scanning or overloading other systems, or mining cryptocurrency;
- polling Telegram in a tight loop or ignoring its
429answers: see Polling or webhook.
Abusive bots are stopped.