Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal Sharding #1414

Closed
bdistin opened this issue Apr 25, 2017 · 8 comments · Fixed by #2902
Closed

Internal Sharding #1414

bdistin opened this issue Apr 25, 2017 · 8 comments · Fixed by #2902

Comments

@bdistin
Copy link
Contributor

bdistin commented Apr 25, 2017

Starting with v12.0.0 add an option for internal sharding. This would be different than the traditional sharding manager, in that your one Discord Client/process would handle sharding with discord rather than spawning multiple processes with their own Discord Client instances each.

Benefits:

  • Memory for small/mid sized bots would be less than the sum of traditional sharding shards due to the following reasons:
    • The base instance of your bot with all dependencies before anything is cached, is not duplicated for each shard.
    • Users which are shared with guilds of different shards aren't duplicated across caches (because it is one collection for users, instead of one for each shard).
  • It is easier and more efficient to manage, in that to perform simple tasks you do not have to broadcast eval to all shards, and do the computations to eliminate duplications from your results. For instance, getting the number of unique users your bot has across all shards.
  • It is easier to implement for the bot dev. Work In Progress implementations/PRs from @GusCaplan has been as easy as setting the client option shardCount to an integer (number of shards) or as the string 'auto' to automatically determine how many internal shards should be created.
  • Still has the benefit of Traditional sharding over not sharding, in which if a websocket disconnects or receives a 1000 code and cannot reconnect or resume, the other shards remain up and unaffected by the outage.

Drawbacks:

  • Not viable for large/very large bots due to the single threaded nature of JavaScript. Such bots should use traditional sharding.

Sizes in this issue are based on the frequency of events handled, not via number of guilds.

@iCrawl iCrawl added this to the 12.0.0 milestone Apr 25, 2017
@amishshah
Copy link
Member

This seems good, shouldn't be too hard to implement once the WebSocket rewrite is merged into master as it's mainly just a case of creating more WebSocketConnections 👍

@LetsDoughNut
Copy link

LetsDoughNut commented Jun 6, 2017

So will bots be auto-sharding now or will the option to turn on / off internal sharding be a thing?

@PassTheMayo
Copy link

PassTheMayo commented Jun 6, 2017

+1 (sorry if this is spam)

@devsnek
Copy link
Member

devsnek commented Jun 6, 2017

this is being handled by #1501

P.S. @CakeNetwork internal sharding will be off by default

@PassTheMayo
Copy link

PassTheMayo commented Nov 1, 2017

@DiscordDonut That would probably be true. I don't see any reason why it would be turned off by normal.

EDIT: Just now saw devsnek's comment.

@Gawdl3y
Copy link
Member

Gawdl3y commented Nov 1, 2017

It would be turned off by default because it's dumb.

@kashalls
Copy link

Is this still in progress?

@DevYukine
Copy link
Contributor

look at the Internal Sharding branch, this branch is currently in testing of some bots from D.js staff and after they are sure that it works correct without bugs they will merge it into master.

@Lewdcario Lewdcario mentioned this issue Oct 24, 2018
5 tasks
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants