Separate instance of container for each shard
Is there any way to shard my bot in multiple processes? like running multiple docker containers for each shard?
2 Replies
- 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!So I have to maintain a central script that'll spawn the containers..
And is this approach recommended? cuz afaik it'll take more memory this way.. Also, in traditional sharding - it'll be 1 process but on multiple threads right? so performance will be same?
@Qjuh but it'll run all shards on a single process right? I feel it depends on bot if their code blocks the cpu or not but I wanted to run multiple shards on multiple threads.
Idk what worker mode means, is it different threads? cuz at the end js is single threaded
I hope you can help me understnad the internal process of djs
Also, please ping once you reply 😄
Thanks for the info, I'll read more about js workers. My understanding was that it's single threaded but not sure how it's managing concurrent read/writes to shared memory or other problems with multi threading.