Logic question

I have a bot that is in about 20k servers and serves somewhere around 21m users. It uses presence intent to give roles to users when they add a specific custom status. My idea was to split the bot up like so due to the fact that i'm getting slammed and won't to even distribute the load of the bot. This was my idea, but I realized would this even work as how would I add the roles to the users from the worker considering I cant use the same shard.
No description
Solution:
If you mean rest as in http server then yes @sapphire/plugin-api but that doesn't take away the above. At the end of the day sapphire and discordjs are going to spawn 1 parent process with 1 token and route everything through that process. For true scalability however you'd want multiple processes.
Jump to solution
6 Replies
Jaymart
JaymartOP6mo ago
oh wait a second im stupid af. I can just use rest within the workers lmao don't need to actually connect to the gateway :kekw: so with that does sapphire have anything for Rest?
Favna
Favna6mo ago
It would work but you'll probably want to drop sapphire and in fact discordjs altogether for their overhead. You'd probably want to make your own thing with @discordjs/core so each section can be as small as possible. You'll also probably be best off using something like kubernetes for your scaling and infrastructure. Furthermore for your service to service communication I strongly recommend a message queueing system like https://www.rabbitmq.com/
Solution
Favna
Favna6mo ago
If you mean rest as in http server then yes @sapphire/plugin-api but that doesn't take away the above. At the end of the day sapphire and discordjs are going to spawn 1 parent process with 1 token and route everything through that process. For true scalability however you'd want multiple processes.
Jaymart
JaymartOP6mo ago
yeah im currently using railway and okay yeah I just found djs/core was using it for rest but your point about dropping sapphire also for the overhead just makes the most sense tbf lol. I appreciate your input.
Favna
Favna6mo ago
I've never used railway myself so if it works then great
Jaymart
JaymartOP6mo ago
and also using rabbitmq, I took a couple hours just to plan it all out :kekw: cause the bot is a pain in the ass
Want results from more Discord servers?
Add your server