Understanding Discord Bot Sharding: A Beginner-Friendly Explanation!

Since this article is intended for beginners, some parts have been written for clarity rather than strict facts.

A bot is an extension of the Discord server, and while many different types have been developed, you may see the word “shard” used when using a large bot.

Bot の情報に「Shard ID」の文字
Dyno のステータスページにも
Disboard のステータスページにも

Unless you have developed a Discord Bot, you probably don’t know this concept of a shard.
Therefore, this article will explain about Bot shards in an easy-to-understand way for beginners.


How the Bot works?

To understand the shard, we first need to understand how Discord’s Bot works.
First, look at this image.

As shown in the figure, Bot and Discord are basically running in a server (think of it as a high-performance computer designed exclusively for running programs) located in a data center or private home somewhere, and they provide services by communicating with each other via a network.

As shown in the figure, a small-scale bot often runs on a single server.
However, when the size of the bot becomes large (approximately 2,000 servers), even with a high-performance server, it will not be able to keep up with the processing with only one communication receiver.
This is where sharding comes in.

What is Sharding?

Sharding increases the number of communication ports as shown in this figure. These receptacles are called shards.
The more shards there are, the more servers can use them at the same time, which is why large scale bot operators have a large number of shards.

In this figure, it appears that the physical servers are separated, but this is not always the case.
The reason is that if you group too many shards together, it will take too much time to recover once the Bot is stopped.

In actual operation, we can set up dozens of shards on a single server and divide them among multiple physical servers, or set up several virtual servers within one huge physical server and create shards among them… We are very flexible.


In this article, we have described the shard in Discord Bot.
Thank you for reading to the end.

  • URLをコピーしました!
  • URLをコピーしました!