Discord Bots

Why Discord Bot Latency Matters and Where to Host for the Lowest Ping

What your bot's ping number actually measures, why hosting near Discord's US East infrastructure matters, and when your users' location matters more.

On this page
  1. What “ping” actually measures
  2. Why location matters so much
  3. Does 100 ms actually matter?
  4. When your users’ location matters more
  5. How to measure your own latency
  6. Latency isn’t only network distance
  7. Choosing a location
  8. Summary

Every bot developer eventually adds a /ping command and stares at the number. Some bots show 15 ms, others 150 ms, and the difference is almost entirely about where the bot is hosted. This article explains what that number measures, why it matters, and how to choose a location.

What “ping” actually measures

There are two different latencies in a Discord bot, and it’s worth separating them.

Gateway (WebSocket) latency is the round-trip time of the heartbeat your bot sends to Discord’s gateway. It’s what client.ws.ping returns in discord.js and bot.latency returns in discord.py. It reflects network distance between your server and Discord.

REST latency is how long an API call takes — sending a message, replying to an interaction, editing a role. Every action your bot takes is a REST call, so this is what users feel. It includes the same network distance plus Discord’s processing time.

Both grow with distance. If your bot is far from Discord’s servers, every heartbeat and every reply pays that cost.

Why location matters so much

Here’s the key point people miss: all Discord traffic flows through Discord. When a user in Mumbai runs a command, the event goes from their client to Discord, then from Discord to your bot. Your bot’s reply goes back to Discord, then out to the user.

The user’s location affects their own connection to Discord, which you can’t change. What you can change is the leg between Discord and your bot. Discord’s gateway and API infrastructure is centred on the US East coast, so a bot hosted in Virginia has a short, fast path to it. The same bot hosted in Asia or Europe adds a long intercontinental round trip to every event and every reply.

Bot hosted in Typical gateway latency
US East (Virginia) ~15–20 ms
Western Europe ~80–100 ms
South or Southeast Asia ~150–200+ ms

That’s why Kerit Cloud’s Discord bot plans and free tier run in Virginia by default, with a sub-18 ms WebSocket latency target.

Does 100 ms actually matter?

For a single command, 100 ms is barely noticeable. But latency compounds:

  • Interactions have a 3-second deadline. If your bot has to query a database, call an external API and then reply, distance eats into that budget. Far-away bots hit “The application did not respond” more often.
  • Multi-step actions stack up. A moderation command that deletes messages, adds a role and logs to a channel makes several REST calls in sequence. At 150 ms each, that’s a visible delay.
  • Heartbeat stability. High or jittery latency makes missed heartbeats more likely, which leads to gateway reconnects — and while reconnecting, your bot misses events.
  • Rate-limit timing. Bots that pace themselves against rate limits waste more time waiting when each request takes longer.

For a small utility bot, none of this is dramatic. For a busy moderation or ticket bot, low latency is the difference between feeling instant and feeling sluggish.

When your users’ location matters more

There are real exceptions where hosting close to Discord isn’t the whole story.

Your database or API is elsewhere

If your bot queries a database or third-party API on every command, the bot-to-database round trip matters as much as bot-to-Discord. A bot in Virginia querying a database in Mumbai pays the intercontinental cost on every query instead. Keep the bot and its data in the same region. Kerit Cloud databases are available in multiple regions, and the free database included with paid plans sits alongside your server.

Voice and music bots

Voice works differently. Voice servers are regional, and when your bot joins a voice channel it connects to the voice server for that call. Audio latency depends on the distance between the audio source and that voice server. For music bots, the Lavalink node should be close to your listeners’ voice region — see choosing a Lavalink region. The bot process itself can still live in US East.

A dashboard your users visit

If your bot has a web dashboard, the dashboard’s latency is between your users’ browsers and the web server. You might host the dashboard closer to your audience while the bot stays near Discord.

How to measure your own latency

Add a command that reports both numbers:

// discord.js v14
const sent = Date.now();
await interaction.deferReply();
const roundTrip = Date.now() - sent;
await interaction.editReply(
  `Gateway: ${interaction.client.ws.ping} ms · REST round trip: ${roundTrip} ms`
);

Note that ws.ping reads -1 for the first minute after startup, until the first heartbeat is acknowledged.

Watch the numbers over a day rather than once. A steady 18 ms with occasional spikes is healthy. A number that swings between 40 and 400 ms points to network congestion or an overloaded host — CPU starvation delays heartbeat processing and inflates the figure.

Latency isn’t only network distance

If your bot is close to Discord but still slow, look inside the process:

  • Blocking code. A synchronous file read or CPU-heavy loop in Node.js, or a blocking call like requests.get() in an async Python bot, stalls the event loop. Everything waits, including heartbeats.
  • CPU limits. If the bot is pinned at its CPU allowance, events queue up. Check your panel’s graphs.
  • Slow dependencies. A database without indexes turns a fast command slow regardless of network. Indexes 101 covers the fix.

Choosing a location

For most bots the answer is simple: host the bot in US East, keep its database in the same region, and put audio nodes near your listeners. Consider another region only when your bot is tightly coupled to infrastructure elsewhere.

Kerit Cloud runs Discord bot hosting from Virginia, with additional locations across the US, Canada, India, Germany, Singapore and Malaysia for Lavalink and other services. If you need a specific region for a bot, the team can arrange it — see the Discord bot plans page for current locations.

Summary

Your bot’s ping measures the distance between your server and Discord, and because every event and reply travels through Discord’s US East infrastructure, hosting near it gives the fastest, most stable bot. Keep your database beside the bot, place audio nodes near listeners, and fix blocking code before blaming the network.