It has been several months since the launch of Citus Cloud, and we’d like to share one part of its design with you. In particular, the fundamental u

Using State Machines to Power Citus Cloud (our Database as a Service)

submited by
Style Pass
2025-01-14 16:00:02

It has been several months since the launch of Citus Cloud, and we’d like to share one part of its design with you. In particular, the fundamental unit of organization for our hosted service on top of AWS is concurrent state machines. In what follows we’ll walk through their use and implementation for Citus Cloud.

First, we’d be remiss if we didn’t acknowledge the great influence that working on Heroku Postgres had on the team. There are also a few talks on Heroku Postgres's design that you may find as interesting and useful information.

Citus Cloud is recently written from scratch. Because of this, it's a good time to provide guidance in how one can start writing similar systems.

To orient ourselves, the following is pseudo-code of an abstract state machine, called Server. This state machine is for creating and restarting servers in some cloud provider:

It's worth noting that each state's side effects, the cloud_ operations, are idempotent. They must also raise errors if they fail, to end execution of a state body. In practice, this is easy to adhere to in most cloud APIs.

Leave a Comment