Service Replicas is a feature that allows you to create multiple replicas of your services, enhancing availability and fault tolerance for your Nhost apps. By distributing user requests among replicas, your apps can handle more traffic and provide a better user experience. This documentation touches on the key aspects of Service Replicas in the context of the Nhost Cloud Platform.
To read the announcement, check out our blog post.
Replicas can be configured for the following services:
Currently, we don't support replicas for Postgres.
Configuring Service Replicas
To configure Service Replicas for your project, follow these steps:
- Navigate to your project's settings in the Nhost Dashboard.
- Click on "Compute Resources".
- Locate the "Replicas" slider for each service (Hasura, Auth, and Storage).
- Adjust the number of replicas for each service as needed.
- Save your changes.
Please note that when setting multiple replicas for a service, the 1:2 ratio between CPU and RAM for that service has to be respected. With only one replica, this ratio does not need to be respected at the service level.
- Improved fault tolerance: Multiple replicas ensure that if one instance crashes duo to an unexpected issue, the other replicas can continue to serve user requests.
- Improved availability: Distributing user requests among multiple replicas allows your apps to handle more traffic and maintain a high level of performance.
- Load balancing: Distributing workloads evenly among replicas to prevent bottlenecks and ensure smooth performance during peak times.
Pricing is based on the size of each replica and the total number of replicas you have configured for each service:
- If you allocate 1 vCPU and 2 GiB of RAM to the auth service, for example, the cost for a single replica is $50.
- If you configure 3 replicas for auth, the total cost for all replicas would be $150 (3 replicas x $50 per replica).
Please note that Service Replicas is available only for projects on the Pro plan or higher.
- Postgres replication: As mentioned earlier, we do not have support for multiple replicas of Postgres. This feature may be added in the future.
- Resource ratio: When configuring multiple replicas for a service, you must adhere to the 1:2 ratio between CPU and RAM for that service.
For more information on compute resources and scaling your apps, refer to our documentation on Compute Resources.