status-sharding questions

hey so I have setup my manager like this:
const manager = new ClusterManager(path.join(__dirname, 'bot.js'), {
mode: 'process',
token: process.env.token,
totalClusters: 1,
spawnOptions: {
timeout: 30000,
delay: 8000,
},
});
const manager = new ClusterManager(path.join(__dirname, 'bot.js'), {
mode: 'process',
token: process.env.token,
totalClusters: 1,
spawnOptions: {
timeout: 30000,
delay: 8000,
},
});
And my bot is almost at 1.9k servers. In the docs it says that if I dont provide the option for "totalShards", it will auto calculate that. Now my questions: 1. How how does it calculate that? Like what guilds per shard-amount is it calculating? 2. If my bot would reach the amount to need a second shard, will it "autospawn" or do I need to restart my bot then
10 Replies
Digital
Digital9mo ago
so for first the first, discord has /gateway/bot endpoint that is being fetched which returns recommended amout of shards for second it wont auto spawn a second shard because we dont actually know live count of guilds your bot has, in order to do that we would need to fetch that discord's endpoint every minute or what not, so yeah, but general rule of thumb is 1k servers per shard, and then 7 shards per cluster, of course you can scale more shards per cluster but that all depends on your hardware since more shards = more memory but less cpu
notvexi
notvexiOP9mo ago
so I should already have 2 shards with my 3rd almost starting?
Digital
Digital9mo ago
uh kinda, i mean if i were in that scenario i would just have set like 4 shards and 2 clusters
notvexi
notvexiOP9mo ago
why 2 clusters tho
Digital
Digital9mo ago
cuz distribution, its just preference
notvexi
notvexiOP9mo ago
of performance?
Digital
Digital9mo ago
not sure how's performance in that case
notvexi
notvexiOP9mo ago
okay and last question. if I were to fetch idk with a "cron.schedule" every 30min / 1hour, the guild count and divide it by 1000, etc. and detect that a new shard should spawn, how do I do that
Digital
Digital9mo ago
i mean why would you do that either way tho, its just generally recommended to restart fully and let all shards connect at once, you should start worrying about live reclustering when you reach millions of servers
notvexi
notvexiOP9mo ago
:Okay:

Did you find this page helpful?