Edit history

Earlier versions of Bot sharding capabilities, newest first.

Current version | Edited by Rex
Changes
- Have `/gateway/bot` return a recommended shard count based on the bot's guild count instead of hardcoding 1.Removed: ### Notes (optional)Removed: Removed: _No response_Removed: Removed: ### ChecksRemoved: Removed: - ☑ I searched for existing discussions and didn't find a duplicate.Removed:
Show

Bot sharding capabilities

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.
Original by Rex
Show

Bot sharding capabilities

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.

Notes (optional)

No response

Checks

  • ☑ I searched for existing discussions and didn't find a duplicate.