Running Multiple Discord Bots on a Single VPS

Published on | Updated on

How to efficiently run multiple Discord bots on one VPS. Covers process management, resource isolation, shared databases, and monitoring multiple bots.

Written by Jochem, Infrastructure Expert, 5-10 years experience in game server hosting, VPS infrastructure, and 24/7 streaming solutions. Read author bio →

Hosting each bot on a separate server wastes money. A single VPS can run dozens of bots efficiently with proper management.

Architecture

VPS (4 cores, 8GB RAM)
  ├── Bot 1 (Music Bot) - Node.js
  ├── Bot 2 (Moderation Bot) - Python
  ├── Bot 3 (Economy Bot) - Node.js
  ├── MariaDB (shared database)
  └── Nginx (dashboard reverse proxy)

Process Management with PM2

PM2 manages all your bots, regardless of language:

# Node.js bots
pm2 start bots/music-bot/index.js --name "music-bot"
pm2 start bots/economy-bot/index.js --name "economy-bot"

# Python bots
pm2 start bots/mod-bot/bot.py --name "mod-bot" --interpreter python3

# View all bots
pm2 status

# Restart a specific bot
pm2 restart music-bot

# View logs
pm2 logs mod-bot

PM2 Ecosystem File

Create ecosystem.config.js for declarative management:

module.exports = {
    apps: [
        {
            name: 'music-bot',
            script: 'bots/music-bot/index.js',
            max_memory_restart: '300M',
            env: { NODE_ENV: 'production', BOT_TOKEN: 'token1' }
        },
        {
            name: 'economy-bot',
            script: 'bots/economy-bot/index.js',
            max_memory_restart: '200M',
            env: { NODE_ENV: 'production', BOT_TOKEN: 'token2' }
        },
        {
            name: 'mod-bot',
            script: 'bots/mod-bot/bot.py',
            interpreter: 'python3',
            max_memory_restart: '200M',
            env: { BOT_TOKEN: 'token3' }
        }
    ]
};

Start all: pm2 start ecosystem.config.js

Resource Allocation

Memory Budget

Plan your RAM:

  • OS overhead: 500MB-1GB
  • MariaDB: 500MB-1GB
  • Bot 1: 200-400MB
  • Bot 2: 200-400MB
  • Bot 3: 200-400MB
  • Buffer: 1-2GB

Total: 4-8GB covers 3-5 bots comfortably.

CPU

Most Discord bots are idle 95% of the time. They spike briefly when processing commands, then idle again. 3-5 bots on a 4-core VPS rarely compete for CPU.

A Space-Node Discord bot plan with up to 1GB RAM runs 5+ bots without performance issues.

Shared Database

Single MariaDB Instance

CREATE DATABASE music_bot;
CREATE DATABASE economy_bot;
CREATE DATABASE mod_bot;

CREATE USER 'music'@'localhost' IDENTIFIED BY 'pass1';
CREATE USER 'economy'@'localhost' IDENTIFIED BY 'pass2';
CREATE USER 'mod'@'localhost' IDENTIFIED BY 'pass3';

GRANT ALL ON music_bot.* TO 'music'@'localhost';
GRANT ALL ON economy_bot.* TO 'economy'@'localhost';
GRANT ALL ON mod_bot.* TO 'mod'@'localhost';

Each bot has its own database and credentials. No cross-bot data access.

Monitoring

PM2 Dashboard

pm2 monit  # Terminal-based monitoring
pm2 plus   # Web-based monitoring (PM2's paid service)

Custom Health Check

#!/bin/bash
# health_check.sh
for bot in music-bot economy-bot mod-bot; do
    status=$(pm2 jlist | python3 -c "import sys,json; bots=json.load(sys.stdin); [print(b['pm2_env']['status']) for b in bots if b['name']=='$bot']")
    if [ "$status" != "online" ]; then
        echo "ALERT: $bot is $status"
        pm2 restart $bot
    fi
done

Run via cron every 5 minutes:

*/5 * * * * /scripts/health_check.sh >> /var/log/bot_health.log 2>&1

Directory Structure

/home/bots/
  ├── music-bot/
  │   ├── index.js
  │   ├── package.json
  │   └── .env
  ├── economy-bot/
  │   ├── index.js
  │   ├── package.json
  │   └── .env
  ├── mod-bot/
  │   ├── bot.py
  │   ├── requirements.txt
  │   └── .env
  └── ecosystem.config.js

When to Separate

Move a bot to its own server when:

  • It consistently uses more than 1GB RAM
  • CPU spikes from one bot affect others
  • The bot serves 5,000+ servers
  • You need to scale independently

For most community bots, a single VPS handles everything efficiently and costs a fraction of separate hosting for each bot.

Quick 2026 Answer

Running Multiple Discord Bots on a Single VPS should focus on keeping the bot online and easy to restart. A Discord bot is a long running process, so the basics are logs, process management, environment variables and safe token storage. Do those well before adding more commands.

Discord Bot Checklist

  1. Store the bot token in an environment file, not inside code.
  2. Use PM2, systemd or Docker to restart after crashes.
  3. Log gateway disconnects and command errors.
  4. Keep dependencies updated on a test copy first.
  5. Watch memory use if the bot joins many servers.
  6. Keep slash command registration scripts separate from the main bot.

Common Mistakes

The biggest mistake is leaving the bot running only in a terminal window. It works until SSH closes, the VPS reboots or the process crashes at night. Use a process manager and test reboot behavior once.

Another mistake is hiding errors. If logs do not show failed REST calls, missing intents or rate limits, the bot will look random to users.

Where to Go Next

For hosting and bot uptime, use Discord bot 24/7 hosting, Discord bot PM2 process management, Discord Gateway intents. Useful screenshots are PM2 status, a clean environment file example without secrets and a log showing the bot reconnecting.

Real Test Routine

The real test for Running Multiple Discord Bots on a Single VPS is whether the bot comes back after failure without you touching it. Stop the process, restart the VPS and trigger one command. If the bot does not return cleanly, it is not ready for a public server.

Check PM2, systemd or Docker status after reboot. Confirm logs show a clean Gateway connection. Test one slash command, one button or menu if the bot uses interactions, and one background task if it has timers. If your bot stores data, confirm the database path and backup location.

Rate limits and missing intents can look like random bugs. Log the exact REST error, Gateway event and command name. That makes support much easier than a vague report that the bot went offline.

When to Upgrade the VPS

Upgrade when memory rises over time, commands respond slowly, the bot handles many guilds or you add side services like a web dashboard, database or music worker. Keep the bot and database close together when possible, and never put tokens in screenshots.

Screenshot or Generated Image Target

A useful supporting image for this page should show the actual setting, console, panel or workflow being discussed. Avoid a generic stock image if possible. A simple generated diagram is fine when it explains the flow better than a screenshot.

  1. Capture the main settings screen or config file.
  2. Add one close crop of the important value.
  3. Add one result screenshot after the fix or setup is working.
  4. Keep private IPs, tokens, emails and customer names hidden.
Jochem

About the Author

Jochem, Infrastructure Expert, expert in game server hosting, VPS infrastructure, and 24/7 streaming solutions with 5-10 years experience.

Since 2023
500+ servers hosted
4.8/5 avg rating

I specialize in Minecraft, FiveM, Rust, and 24/7 streaming infrastructure, operating enterprise-grade AMD Ryzen 9 hardware in Netherlands datacenters.

View my full bio and credentials →

Keep Your Bot Online 24/7

Reliable Discord bot hosting powered by enterprise AMD Ryzen 9 hardware. Start free, upgrade anytime with guaranteed uptime.