Scaling using multiple instances
Multiple instances are not required in most cases. See the Overview for details on standard horizontal scaling setups.
When exceeding a couple thousand concurrent connections, the standard PowerSync setup may not scale sufficiently to handle the load. In this case, we recommend you contact us to discuss the options. However, we give a basic overview of using multiple PowerSync instances to scale here.
Each PowerSync “instance” is a single endpoint (URL), that is backed by:
This setup is described in the Overview.
To scale further, multiple copies of this setup can be run, using the same source database.
Since each PowerSync instance maintains its own copy of the bucket data, the exact list of operations and associated checksum will be different between them. This means the same client must connect to the same endpoint every time, otherwise they will have to re-sync all their data every time they switch. Multiple PowerSync instances cannot be load-balanced behind the same subdomain.
To ensure the same user always connects to the same endpoint, we recommend:
hash(user_id) % n
where n
is your number of instances.