Sign inSign up

fourat/autoshard-scaler

By fourat

Updated almost 2 years ago

Kubernetes Discord autosharded bot scaler

Image
0

1.4K

fourat/autoshard-scaler repository overview

Kubernetes Discord autosharded bot scaler

This is a K8s StatefulSet autoscaler that uses the Discord's Bot endpoint to get the recommended shards configuration and automatically scale up (or down) the StatefulSet.

This project requires that you already be using Kubernetes, and assume you have some understand of how Kubernetes works.

It also assumes that you have your bot set up to handle changes in the StatefulSet's replica count gracefully. Meaning: if we scale up, all existing shards will need to re-identify with Discord to present the new shard count, and update their local cache as necessary.

It is also important that your bot accepts the following environment variables:

  • SHARDS: Total shards running accross all bot instances,
  • SHARD_IDS: Shard IDs handled by a bot instance, bot-0 must be handling at least shard-0,

An example speaks louder than words:

If we have 12 recommended shards and you set K8S_SHARDS_PER_BOT to 4 (default:1) then we will spin up 4 bots with SHARDS =12 and:

  • bot-0's SHARD_IDS = 0-3
  • bot-1's SHARD_IDS = 4-7
  • bot-2's SHARD_IDS = 8-11

Getting Started

https://github.com/farirat/autoshard-scaler/blob/main/README.rst

Tag summary

Content type

Image

Digest

sha256:40a7a652e

Size

82.9 MB

Last updated

almost 2 years ago

docker pull fourat/autoshard-scaler