Discord Bot on Render Free Tier: Limits & Fixes
In this article
Render's free tier can keep a Discord bot online 24/7, but it spins down after 15 minutes of inactivity, so the bot only responds when a user sends a message first. You can work around this with a free uptime monitor, but you cannot run a bot that needs continuous background tasks or real-time events without paying.
How Render's Free Tier Works
Render is a cloud platform that hosts web services, static sites, and background workers. Its free tier is designed for testing and low-traffic apps, not production workloads. The key limitation is the 15-minute inactivity spin-down: if your service receives no incoming requests, Render pauses it. When a request arrives, Render restarts the service, which typically takes 30–60 seconds for a Node.js or Python bot. During that cold start, the bot is offline and will miss messages.
For a Discord bot, this means the bot only wakes up when Discord sends an interaction or message event to your webhook (if you use interactions) or when your bot's gateway connection is re-established. Since Discord uses a WebSocket connection for real-time events, a spun-down service loses that connection. The bot effectively goes offline until something pings the webhook URL, which then triggers a restart.
What the Free Tier Can Do
- Respond to slash commands – If you use Discord's interaction webhook, the bot can wake up and respond within a few seconds, though the first response may be delayed by the cold start.
- Run lightweight commands – Simple commands like
!ping,!help, or fetching data from an API work fine once the bot is awake. - Handle low traffic – If your server has a handful of users and messages are infrequent, the bot will be offline most of the time but will still function when called.
- Use a free uptime monitor – Services like UptimeRobot (free tier) can ping your bot's URL every 5 minutes, preventing the spin-down. This keeps the bot awake 24/7, but it consumes the free tier's 750 hours per month (which is actually 24/7 for a single service).
What the Free Tier Can't Do
- Maintain a persistent WebSocket connection – Discord bots rely on a gateway connection to receive events like message edits, member joins, or voice state changes. A spun-down service loses this connection, so the bot cannot receive those events in real time.
- Run background tasks reliably – Scheduled tasks (e.g., a daily reminder) won't fire if the service is asleep. Even with an uptime monitor, the bot only runs when the monitor pings it, which may not align with your schedule.
- Handle high concurrency – The free tier has limited CPU and memory (512 MB RAM). A bot that processes many commands simultaneously may hit rate limits or crash.
- Use persistent storage – Render's free tier provides a ephemeral filesystem; any files you write are lost when the service restarts. You'd need an external database like MongoDB Atlas or a free PostgreSQL instance to store data.
- Stay online during Render maintenance – Free services are not guaranteed uptime; Render may restart them at any time.
How to Keep the Bot Awake (Without Paying)
The most common trick is to use a free cron-job service to ping your bot's URL every few minutes. Here's a step-by-step approach:
- Deploy your bot as a web service on Render, not a background worker. The web service gives you a public URL.
- Set up an uptime monitor like UptimeRobot (free) or cron-job.org. Configure it to send an HTTP GET request to your bot's URL every 5 minutes.
- In your bot code, make sure it responds to HTTP requests (e.g., a simple Express server) so the ping doesn't cause an error.
- Once the monitor is active, Render will not spin down the service because it receives a request every 5 minutes.
This method works, but it has caveats: the free tier allows 750 hours per month, which is exactly 31 days, so a single service can run 24/7. However, if you have multiple services, you'll exceed the limit and Render will throttle them.
Common Problems and Solutions
- Bot goes offline after 15 minutes – This is the spin-down. Use an uptime monitor or upgrade to a paid plan.
- Bot responds slowly – Cold starts take time. You can reduce this by using a lightweight framework and keeping dependencies minimal.
- Bot crashes with memory errors – Free tier has 512 MB RAM. Optimize your code to avoid memory leaks, and consider using a smaller language runtime like Node.js instead of Java.
- WebSocket connection drops – Even with an uptime monitor, the bot's gateway connection may drop if Render restarts the service. Your bot should have auto-reconnect logic (most Discord libraries do this by default).
- Data loss on restart – Use an external database. For small bots, a free tier of MongoDB Atlas or a free PostgreSQL instance works.
Comparing Free vs Paid Tiers
Render's paid plans start at $7 per month for a service with 512 MB RAM and no spin-down. The key differences are:
- No spin-down – The bot stays online 24/7, maintaining its WebSocket connection.
- More CPU and memory – Paid services get 1 GB RAM (or more) and dedicated CPU.
- Persistent disk – Paid plans include a small persistent disk (e.g., 1 GB) that survives restarts.
- Custom domains and SSL – Not needed for a bot, but available.
For a serious bot with many users, the paid tier is worth it. For a hobby bot, the free tier with an uptime monitor is often sufficient.
Alternatives to Render for Free Hosting
If Render's limitations are too restrictive, consider these alternatives:
- Oracle Cloud Free Tier – Offers a permanently free VM with 1 GB RAM and 10 GB storage. You can run a bot 24/7 without spin-down, but it requires more setup (SSH, systemd).
- Fly.io – Has a free allowance that includes 3 shared VMs with 256 MB RAM each. No spin-down, but you must manage your own Docker image.
- Railway – Offers a $5 trial credit, but no permanent free tier. Good for short-term projects.
- Replit – Free tier has a public URL, but the bot sleeps when the tab is closed. You can use a similar uptime monitor trick, but it's less reliable.
Each option has trade-offs in terms of setup complexity, uptime, and cost. For a beginner, Render's free tier is the easiest to start with.
Frequently Asked Questions
Will my bot stay online if I use an uptime monitor?
Yes, an uptime monitor that pings your bot's URL every 5 minutes prevents Render from spinning down the service. The bot will stay awake and maintain its gateway connection, so it can receive events in real time. However, the free tier's 750 hours limit means you can only run one service 24/7; if you have multiple services, they will be throttled.
Why does my bot take 30 seconds to respond sometimes?
That's the cold start. When Render spins down a service, it needs to restart the container, which takes 30–60 seconds. If a user sends a command during that time, the bot won't respond until the restart completes. Using an uptime monitor eliminates this delay because the service never spins down.
Can I use a free database with Render?
Yes, Render's free tier doesn't include a database, but you can use an external free database like MongoDB Atlas (500 MB free), Supabase (500 MB free), or a free PostgreSQL instance from ElephantSQL. Just make sure your bot's code connects to the external database, not local files.
Is there any way to get a persistent WebSocket connection on the free tier?
Only if you keep the service awake with an uptime monitor. The WebSocket connection is maintained as long as the service is running. Without a monitor, the service sleeps and the connection drops.
What happens if I exceed the free tier's 750 hours?
Render will throttle your service, meaning it may spin down more aggressively or stop responding until the next month. You can check your usage in the Render dashboard. If you hit the limit, you'll need to upgrade to a paid plan or wait for the month to reset.