Skip to content

Scaling

The Frameleaf server is built so that several copies can run side by side. Maybe you have a gaming PC you’d like to use for transcoding and thumbnails, or a small cluster of machines you want to put to work.

The one requirement is that every copy uses the same shared infrastructure:

  • the same PostgreSQL database
  • the same Redis (the redis service, which runs Valkey in the provided Compose file)
  • the same files, mounted at the same path in every container

How you scale across machines depends a lot on your setup. On Kubernetes it can be as simple as raising the number of replicas; elsewhere you may need network tunnels or NFS mounts so every machine reaches the database, Redis and storage. There are no step-by-step instructions for every environment, so you’ll need to be comfortable with your own infrastructure.

Each server container runs an API worker, a job worker and an edge worker for remote access. If you’re adding machines only to get through background work faster, turn off the API on them with FRAMELEAF_WORKERS_EXCLUDE: 'api'. See Split the server into containers.

Machine learning scales separately: run more machine learning containers and put a load balancer in front of them. See Remote machine learning and Workers and where jobs run.

You can scale down just as easily. All state lives in PostgreSQL, Redis and the file system, so it’s safe to stop a server container, for example to free your GPU for a game. As long as one container runs the API worker, you can still browse Frameleaf, and jobs wait until a worker is available to process them.

When a container stops, running jobs get a short grace period and then go back to waiting. See Stopping the server.