Bot sharding capabilities

(#1048) Feature Under consideration api performance

Problem

Right now, bots can seemingly only connect to the gateway with a single shard. /gateway/bot returns shards: 1 and max_concurrency: 1 hardcoded. https://github.com/fluxerapp/fluxer/blob/d5abd1a7e4bbb6a389b7ecdf7b24c573bf71fc88/packages/api/src/gateway/GatewayRequestService.tsx#L86 This means all guilds are served through one WebSocket connection, which creates several scaling issues as bots grow. Separately, with the gateway emitting GUILD_CREATE and GUILD_DELETE for all guilds on every re-connect means bots can't scale effectively.

Proposed solution

Add proper sharding support similar to Discord.
  • Reference the shard field on IDENTIFY and update gateway to route guilds to shards in a deterministic way
  • Have /gateway/bot return a recommended shard count based on the bot's guild count instead of hardcoding 1.

Comments

Sign in with Fluxer to comment and vote.

No comments yet.