ShardlyHQ
Newsroom
Engineering
09 Apr 2026

Rewriting the shard supervisor: what we learned running other people's bots

A post-mortem-shaped look at why process managers designed for web servers make poor gateway supervisors, and what we replaced ours with.

Source code on a screen, shallow depth of field

A Discord bot is not a web server. It holds a long-lived connection, it is rate limited on reconnect, and it fails in ways a health check on a port will never notice. For a year we ran shards under a general-purpose process manager and papered over the difference. This is what that cost, and what we did about it.

The failure mode nobody watches

The interesting failure is not a crash. It is a shard that stays up, keeps its socket open, and quietly stops receiving events. A restart-on-exit supervisor sees a healthy process and does nothing, and the first person to notice is a customer whose commands stopped working an hour ago.

What replaced it

  • Liveness is measured from gateway heartbeat acknowledgements, not process state.
  • Restarts are budgeted per shard so a reconnect storm cannot self-inflict a rate limit.
  • Resharding is scheduled against guild count with hysteresis, so growth does not cause flapping.
  • Every restart writes a reason to the customer-visible log, because 'it restarted' is not an answer.
If the customer has to tell you your platform is broken, the monitoring was decorative.
Platform engineering, Shardly

Media enquiries. Shardly answers press within one business day at hello@shardlyhq.xyz. Logos, boilerplate and company facts are available in the press room.

More about the company.

Who we are, how the platform is put together, and what we have committed to — all on this site, none of it behind a form.