#Replicated/Sharded Command Handling

1 messages · Page 1 of 1 (latest)

knotty acorn
#

I have 2 replicas of my bot and when I send a command, both replicas respond.

I have implemented a "leader" strategy where one of the replicas is chosen as the pod that will respond to commands.

I would like to load balance this.

How does one go about round robin'ing commands to replicas?

celest cliff
#

why do you have 2 replicas? Should just use the DiscordShardedClient instead

knotty acorn
#

i'd like to be able to scale horizontally. multi host rather than one host with multiple shards. i'd rather throw more hosts at a scale issue than more cpu/ram on an individual box

#

also, if the bot goes down, there's no backup. it is just down. with replication, if one replica fails, no big deal

quiet socket
#

And have it so that each instance is started with two arguments, the current shard id and total number of shards.

#

Be warned that this approach increases memory usage by a lot since each shard will need to be initialized separately

#

For example my bot had 8 shards at around 32gb of usage, after using only sharded client and one instance it uses only 6.

knotty acorn
#

THANK YOU THIS MAKES SENSE