
# How Much RAM for Discord Bot Hosting, Telegram Bots and n8n

**How much RAM for Discord bot hosting do you need? Less than most people buy: a 1 GB server runs a typical Discord or Telegram bot with room to spare.** We measured eight popular libraries, and a freshly started bot process used between 46 and 162 MB, so even the heaviest takes under a sixth of a 1 GB server. Give a bot with a database and LLM calls 2 GB, and n8n with real workflows 2 to 4 GB.

One surprise from the test: aiogram starts at more than three times the memory of python-telegram-bot. Below we explain why, cover what the discord.py and n8n docs say, and show the commands to check your own bot in five minutes.


## How much RAM does a Discord bot use? Our test

None of these libraries publishes a memory requirement, so we measured. Setup: November 20, 2026, macOS arm64, Python 3.13.5 and Node.js 25.8, process measured right after importing the library and creating the bot object, no traffic, three runs within 1–2 MB of each other.

| Library | Language | Process memory (RSS) |
|---|---|---|
| Empty Python process | Python 3.13 | ≈ 15 MB |
| python-telegram-bot 22.8 | Python | ≈ 46 MB |
| discord.py 2.7.1 | Python | ≈ 49 MB |
| aiogram 3.33.0 | Python | ≈ 162 MB |
| Empty Node.js process | Node 25 | ≈ 45 MB |
| Telegraf 4.16.3 | Node.js | ≈ 57 MB |
| grammY 1.46.0 | Node.js | ≈ 57 MB |
| discord.js 14.28.1 | Node.js | ≈ 85 MB |

How to read these numbers:

- **They're a floor, not a ceiling.** Memory grows under load: caches, queues, database connections.
- **Linux numbers will differ.** macOS and Linux count process memory differently. The order of magnitude holds, but take the exact figure on your own server (commands below).
- **Why aiogram is heavier.** We checked: `import aiogram.types` alone takes the process to the same ~161 MB. That module defines about 480 classes, one model per Telegram Bot API type. It doesn't slow the bot down, but ten aiogram bots on one box use about 1.6 GB before handling a single message.

## Sizing table: bot type to RAM and plan

The first three rows are our estimates based on the test above.

| Bot | Memory for the bot | Server | 0x.cloud plan | Price/mo |
|---|---|---|---|---|
| One simple Discord or Telegram bot (commands, buttons, replies) | 50–200 MB | 1 GB | s1-1 | $4.49 |
| Bot with a database (SQLite, PostgreSQL) and LLM API calls | 200–600 MB plus the database | 2 GB | s1-2 | $7.99 |
| Discord bot on hundreds of servers with a member cache | grows with members, measure it | 2–4 GB | s1-2 or s2-4 | $7.99–15.99 |
| Several bots and a database on one server | sum of measurements plus 500 MB for the system | 4 GB | s2-4 | $15.99 |

If you're sizing a server for more than bots, see [which VPS plan do I need](https://0x.cloud/kb/getting-started/choose-vps-plan).

## How much RAM for Discord bot caches

For Discord bots, the cache is the main consumer. The library keeps guilds, channels, roles, members and recent messages in memory. On ten servers that's a few megabytes. On hundreds of servers with tens of thousands of members, the cache can outgrow the bot.

The [discord.py intents docs](https://discordpy.readthedocs.io/en/stable/intents.html) say the members intent is privileged and isn't part of the default set, so you enable it explicitly, and that Discord restricts member caching and expects bots to cache as little as they need.

How to cut memory use:

1. Enable only the intents your bot actually uses.
2. In discord.py, limit the member cache with `member_cache_flags` when you create the client, and on big bots skip loading every member at startup with `chunk_guilds_at_startup=False`.
3. In discord.js, cap caches with `makeCache: Options.cacheWithLimits(...)` and drop old messages with `sweepers`.
4. Don't keep message history in memory. Write it to a database.

A small Discord bot runs fine on 1 GB (s1-1, $4.49/mo). For a bot on hundreds of servers, start at 2 GB and watch the trend for a week. Hosting details and the "For bots" image (Python with Telegram and Discord libraries, Node.js with pm2, and a service that keeps the bot running) are on [Discord bot hosting](https://0x.cloud/discord-bot-hosting).


[Create server: s1-1, $4.49/mo](https://0x.cloud/cabinet/create?plan=s1-1)


## How much RAM does n8n need?

There's no single minimum for self-hosted n8n. The reference points come from the [n8n embed prerequisites](https://docs.n8n.io/deploy/host-n8n/deploy-as-an-oem-integration/prerequisites) (checked November 20, 2026):

- memory: 320 MB to 2 GB;
- an idle n8n Cloud instance uses about 100 MB;
- n8n isn't CPU intensive, and memory matters more than CPU;
- database: SQLite or PostgreSQL, 512 MB to 4 GB of SSD.

The docs call these figures illustrative and say your workflows and the data they process decide the real number.

Out-of-memory signs, from the [n8n memory errors page](https://docs.n8n.io/hosting/scaling/memory-errors/): "Execution stopped at this node (n8n may have run out of memory while executing it)", "Connection Lost" or a 503 in the UI, and "Allocation failed - JavaScript heap out of memory" in the logs. Large JSON and binary data, manual executions (n8n copies the data for the UI), concurrent executions and the Code node use the most memory.

Our estimate: n8n with PostgreSQL needs about 2 GB. If your workflows move files, process big spreadsheets or run in parallel, plan on 4 GB.

## How much RAM does a Telegram bot need?

A Telegram bot on long polling or webhooks barely touches the server: it gets an update, does its job and replies. In our test python-telegram-bot started at about 46 MB, Telegraf and grammY at about 57 MB, aiogram at about 162 MB. One bot fits in 1 GB with lots of room left.

Memory grows when the bot:

- keeps conversation state and caches in process memory instead of Redis or a database;
- downloads and processes photos, video or documents (the whole file lands in memory);
- holds large user lists for broadcasts;
- calls an LLM and keeps chat history in memory.

For a bot with an LLM and a database, use 2 GB (s1-2, $7.99/mo). The ready-made setup is on [Telegram bot hosting](https://0x.cloud/telegram-bot-hosting).

## What makes bot memory grow

- **In-process caches.** Dicts of users, states and replies grow forever unless you prune them.
- **Media.** Image processing (Pillow, sharp) and video need memory at least the size of the file.
- **Leaks.** Event listeners never removed, HTTP client sessions never closed, global lists.
- **Multiple processes.** Every bot, queue worker or pm2 replica takes its own memory.
- **Docker.** A container adds little by itself, but each container with its own database or Redis adds theirs.

## How to measure your bot's memory

A measurement on your server beats any table. These commands work on Ubuntu 24.04 and Debian 12:

```bash
# Whole server: total, used, available and swap
free -h

# One process by PID, RSS in kilobytes
ps -o pid,rss,cmd -p 12345

# All Python and Node processes, sorted by memory
ps -eo pid,rss,cmd --sort=-rss | grep -E "python|node" | head

# Peak memory over a whole run: "Maximum resident set size" (in KB)
sudo apt install -y time
/usr/bin/time -v python3 bot.py

# Bot running as a systemd service: see the Memory line
systemctl status mybot

# Docker containers, one snapshot
docker stats --no-stream
```

`htop` shows the same live: RES is process memory, the Mem bar at the top is the server. Watch a full day, not one moment. If RES keeps climbing and never levels off, the bot has a leak.

To keep one bot from taking the server down, add `MemoryMax=300M` to its systemd unit. Per the systemd docs (MemoryMax in systemd.resource-control), going over the limit triggers the OOM killer inside that service only, so everything else keeps running. Add `Restart=always` to the same unit so the bot comes back on its own.

## Swap: a safety net on 1 GB servers

A 1 to 2 GB swap file saves you from rare spikes: the server slows down briefly instead of killing your process. It matters most on 1 GB servers, where `pip install` or `npm install` can briefly use more memory than the bot itself. Step by step: [add swap on Ubuntu](https://0x.cloud/kb/servers/add-swap-ubuntu).

Swap doesn't replace RAM. If your bot lives in swap, move up to s1-2. You can test the bigger size by the hour first: about $0.054725/hour for s1-2 and about $0.030750/hour for s1-1 (the monthly price divided by 730 and multiplied by 5, never more than the monthly price in a calendar month). Delete the server and billing stops, with the rest kept on your balance. All plans are on the [pricing page](https://0x.cloud/pricing).

Or hand it to your agent:


```text
Create an s1-1 server on 0x.cloud with the "For bots" image, add 1 GB of swap, run my discord.js bot as a systemd service with MemoryMax=300M and Restart=always, and after 24 hours show me how much memory it really uses. Show the price with dry_run before creating anything.
```


## Bot RAM FAQ

**Is 1 GB of RAM enough for a Discord bot?**
Yes, for a typical bot on a few dozen servers. In our test discord.js started at about 85 MB and discord.py at about 49 MB, so a 1 GB server leaves plenty of headroom. Bots on hundreds of servers with a full member cache should start at 2 GB.

**How much RAM does n8n need?**
The n8n docs give an example range of 320 MB to 2 GB and say an idle n8n Cloud instance uses about 100 MB, while calling the figures illustrative. Our estimate: 2 GB for n8n with PostgreSQL and real workflows, 4 GB for workflows that move files or run in parallel.

**Why does my Discord bot keep using more memory?**
Usually the cache. The library keeps guilds, members and messages in memory, and that grows with the number of servers and members. Enable only the intents you use, limit the member cache in discord.py and cap message caches in discord.js.

**How do I check how much RAM my bot uses?**
Run ps -o pid,rss,cmd -p PID for one process (in KB), /usr/bin/time -v for the peak over a whole run, free -h for the server and docker stats for containers. Watch it over a full day, not a single moment.

**How many bots can I run on a 2 GB VPS?**
As a rough guide, 5 to 10 simple Python or Node.js bots that don't keep big caches or process media. For a real number, add up each bot's measured peak and leave 300 to 500 MB for the system.


[Create server: s1-1, $4.49/mo](https://0x.cloud/cabinet/create?plan=s1-1)
