Scalability Tuning
This guide provides instructions on how to tune your Supervisely installation for better performance and scalability. It covers two main aspects:
Increasing the number of replicas for key services
Tuning the PostgreSQL database for better performance
Increasing Service Replicas
For high-load environments, you can increase the number of replicas for certain services to improve throughput and availability.
Creating a docker-compose.override.yml
To increase the number of replicas for the api
and api-public
services, create a docker-compose.override.yml
file in the Supervisely installation directory:
Create or edit the docker-compose.override.yml
file with the following content:
After creating or modifying this file, apply the changes by redeploying the services:
This configuration will start 3 replicas each of the api
and api-public
services, which will improve the stability and performance of the Supervisely platform.
POSTGRES_POOL_MAX
is the maximum number of connections to the PostgreSQL database that each service can use. You can adjust this value based on your server's available resources.
PostgreSQL Database Tuning
The PostgreSQL database is a critical component of Supervisely. Proper tuning can significantly improve overall system performance.
Locating the PostgreSQL Configuration
The PostgreSQL data directory can be found at:
The main configuration file is postgresql.conf
, which contains various settings that can be tuned.
Increasing Connection Limits
To increase the PostgreSQL connection limit to 1000:
Edit the
postgresql.conf
file:
Find and modify the following parameters:
Tuning PostgreSQL Based on Available RAM
PostgreSQL performance is heavily dependent on available memory. Here are recommended settings based on your server's total RAM:
For servers with 8GB RAM:
For servers with 16GB RAM:
For servers with 32GB RAM:
For servers with 64GB RAM or more:
Additional Important PostgreSQL Parameters
Applying PostgreSQL Changes
After making changes to the PostgreSQL configuration, restart the database service:
Increasing PostgreSQL Container Memory Limit
After tuning the PostgreSQL configuration, you may need to increase the container memory limit to accommodate the new settings.
To increase the PostgreSQL container memory limit, create or edit the docker-compose.override.yml
file:
Add or modify the PostgreSQL service configuration:
This setting allocates up to 16GB of memory to the PostgreSQL container. Adjust this value based on your server's total RAM.
You also need to adjust the POSTGRES_SHM_SIZE
parameter in the .env
file to match the new shared_buffers
value:
Find and modify the following parameter:
After making these changes, apply them by redeploying the services:
Last updated
Was this helpful?