Skip to content

Discord bots

How much RAM does a Discord bot need?

Realistic memory figures for bots of every size, what actually uses the RAM, and how to cut it down.

Choosing a hosting plan starts with one question: how much memory does my bot need? The honest answer is "less than you think", as long as you don't cache everything. Here are realistic figures and the settings that make the biggest difference.

Rough guide

BotTypical RAMNotes
Small bot, up to a few hundred servers100MB to 512MBSlash commands, moderation, utilities
Medium bot, a few thousand servers512MB to 2GBBigger caches, database work, image generation
Large or sharded bot2GB to 8GB+Several shards, member caching, heavy features
Music bot (audio in the bot)1GB+ and lots of CPUMoving audio to Lavalink makes the bot much lighter

These are estimates, not promises. The real number depends on your intents, caches and code. The only way to know for sure is to watch your bot's memory graph for a few days.

What uses the memory

The runtime

Node.js and Python each take a baseline amount of memory before your bot does anything. It's small, but it's why a "hello world" bot never uses zero.

The cache

This is the big one. Discord libraries keep guilds, channels, roles, members, messages and presences in memory, so they don't have to ask Discord again. More servers and more intents mean more cached objects. The GuildMembers and GuildPresences intents are especially expensive, because they can mean caching every member of every server.

Your own data

Arrays and maps that only grow, such as cooldown lists, XP tracking or message logs, slowly fill memory. Store that kind of data in a database instead of keeping it all in memory.

Reducing memory in discord.js

discord.js lets you limit and sweep its caches when you create the client:

const { Client, GatewayIntentBits, Options } = require('discord.js');

const client = new Client({
    intents: [GatewayIntentBits.Guilds],
    makeCache: Options.cacheWithLimits({
        ...Options.DefaultMakeCacheSettings,
        MessageManager: 50,
        ReactionManager: 0,
    }),
    sweepers: {
        ...Options.DefaultSweeperSettings,
        messages: { interval: 3600, lifetime: 1800 },
    },
});

Reducing memory in discord.py

In discord.py, lower the message cache and avoid fetching every member at startup if you don't need them:

bot = commands.Bot(
    command_prefix="!",
    intents=intents,
    max_messages=100,               # default is 1000
    chunk_guilds_at_startup=False,  # don't download every member on login
    member_cache_flags=discord.MemberCacheFlags.from_intents(intents),
)

When do you need sharding?

Discord requires sharding once a bot is in 2,500 servers: each shard is a separate gateway connection handling part of your servers. Sharding doesn't reduce the total memory much, but it spreads the work, and many large bots run shards across several processes. If you're approaching that size, plan for a bigger plan or a VPS.

CPU matters too

Most bots are idle most of the time and use very little CPU. The exceptions are image generation, heavy database queries and audio. If your bot plays music, a Lavalink node takes the CPU-heavy work away from the bot.

Our advice

Start on a small plan, enable only the intents you need, limit your caches and watch the graphs. When memory consistently sits above 80% of your plan, upgrade. On Zettako's Discord bot hosting that takes seconds, and your files stay exactly where they are.

Start small, upgrade any time

Bot plans from 512MB of RAM, with upgrades in seconds when your bot grows.

Starting at €2.46EUR/mo