Skip to content

Can I horizontally scale a discord.js bot? #5780

Closed Locked Answered by kyranet
heyAyushh asked this question in Q&A
Discussion options

You must be logged in to vote

To horizontally scale a Discord bot within a server, you need to use a Sharding Manager, more information in the guide.

As for scaling it across different servers... that's a lot trickier and I don't know a sharder that does this.


Not really related to the issue at hand but... within the same server, you can alternative do any of the following:

  • Separate the express server from the bot, and make them communicate in an alternative way.
  • Use a much more scalable HTTP framework, fastify has a plugin called fastify-piscina which supports worker threads, which are more efficient than separate processes as they share information quicker and share the same memory.

Generally speaking, discord.js…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@heyAyushh
Comment options

@kyranet
Comment options

@heyAyushh
Comment options

Answer selected by kyranet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants