How are you guys realizing horizontal scaling with djs?

Hey everyone! We're facing a bit of a puzzle on our end. Tired of the server upgrade routine, we're playing around with the idea of spreading our workload across smaller servers for a more horizontal setup. The potential perk? It could be a game-changer for our budget. Now, here's where it gets interesting. Djs, isn't quite on board with the whole selective shard handling thing straight out of the box, unlike some other libraries like Serenity for Rust. We're not stressing about it, though. We're just curious – how are you handling this in your setups? Any ideas or solutions you've stumbled upon? Let's have a chat about it. ^^ Appreciate it a ton for joining the conversation! Best, conny.
4 Replies
d.js toolkit
d.js toolkit6mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
conny.
conny.6mo ago
Oh my this is a thing by now? To be completely honest, i haven't looked into shard handler changes since djs12 or so hmm to be fair, i still can't find that in djs's guides. However, i will try it out. This might be exactly what we're looking for. thank you! Thats very interesting, where are ClientOptions being utalized? I thought this might be a part of the ShardManager, is it not? They don't really. But would i still be able to use a sharded model, to - f.e. - just half my workload? So to say run 50% on one server and on another the rest? Yes haha but you told me the shard manager is not required. can i still use it tho? It's honestly just way i have done it since ever. There is no explicit reasoning behind it. How would i run such an infrastructure? I would get rid of the sharding manager and "plop" the shard informations into the client options instead? like this for example? oh right excuse my scepticism, i've been working with the shard manager all this time and apparently i could've spared me some valuable time. Just for my curiosity tho, if i wanted to use the shard manager, i would now declare that information in the client directly right? i would assume i would use the property hightlighted in my screenshot? The worked mode is enabled by default when utalizing the method mentioned above? (Shard list in client constructor) Currently we're talking 22 shards with approx. 33k servers in total. We're just playing with the idea to make sure we're clear for the future ^^ how could i change that? Would using the shard manager set to worker mode not be a simpler solution for the same outcome? might be a silly load of questions im dropping here, excuse me haha
d.js docs
d.js docs6mo ago
interface WebsocketOptions WebSocket options (these are left as snake_case to match the API)
conny.
conny.6mo ago
i can't help but to feel like im trying to imitate what the shard manager would already do by itself regardless, do you have an example of an implemented custom build strategy function for me? thank you! ❤️