---
title: IIoT Platform scaling
section: Operations
weight: 1
description: Vertical and horizontal scaling strategies for the IIoT Platform — container orchestration, database optimization, caching, and frontend scaling.
related:
  - architecture/scalability
  - operations
  - operations/backup-and-restore
  - architecture
---

import Alert from '@/components/docs/Alert.astro';

As the number of users, the volume of data, and the count of devices grow, the IIoT Platform needs to scale. The architecture it is built on and its underlying scaling potential are covered in [System scalability](/en/platform/v3/architecture/scalability); this page focuses on the practical strategies for scaling a production deployment.

<Alert type="info">
  This section discusses scaling scenarios that keep the system performing reliably even under
  extreme loads.
</Alert>

## Platform scaling strategies

```mermaid
flowchart LR
subgraph subGraph0["IIoT Platform Scaling Strategies"]
F["Vertical Scaling"]
A["Application Servers (Ruby on Rails)"]
G["Horizontal Scaling"]
B["Data Collection Servers (GO)"]
C["PostgreSQL Database"]
H["Database Optimization"]
D["Docker/Kubernetes"]
E["Frontend Scaling"]
end
A --> F & G
B --> F & G
C --> F & G & H
D --> B & A
E -- Efficient_Distribution --> D
```

### Vertical and horizontal scaling

The platform supports two complementary scaling approaches: vertical scaling adds resources to existing servers, while horizontal scaling adds more servers.

#### Vertical scaling

- **Server resource upgrade**:
  - Add CPU, RAM, and SSD storage to the application servers (Ruby on Rails) and the data collection servers (Go).
  - Increase PostgreSQL performance through more powerful disk arrays and index optimization.

- **Benefits**: Simple to implement, with minimal changes to the architecture.
- **Limitations**: The physical limits of individual servers and the high cost.

#### Horizontal scaling

- **Adding new servers**:
  - Ruby on Rails: deploy additional application instances behind a load balancer (for example, Nginx or HAProxy).
  - Go servers: scale easily thanks to multi-threading and built-in support for horizontal scaling.
  - PostgreSQL: replicate and shard the data to balance the load.
- **Benefits**: High fault tolerance and effectively unlimited scalability.
- **Limitations**: The added complexity of managing a distributed system.

## Using Kubernetes/Docker Compose for container orchestration

### Migration to Kubernetes/Docker Compose

- **Application containerization**:
  - The Ruby on Rails and Go servers are packaged into Docker containers.
  - Kubernetes/Docker Compose manages the deployment, scaling, and monitoring of those containers.
- **Automatic scaling**:
  - The Horizontal Pod Autoscaler (HPA) automatically increases the number of pods based on load.
  - The Cluster Autoscaler adds new nodes to the cluster when resources become scarce.
- **Benefits**: High flexibility, automation, and fault tolerance.

### Example architecture on Kubernetes

- **Ingress Controller**: routes requests to the Ruby on Rails and Go servers.
- **StatefulSets**: manage stateful PostgreSQL replicas.
- **Service Mesh**: uses Istio or Linkerd to manage traffic and improve security.

### Database optimization

The database tier scales through a combination of replication, sharding, and caching.

#### PostgreSQL replication and sharding

- **Replication**:
  - Configure master-slave replication to distribute the read load.
  - Use tools such as Patroni to manage replication automatically.
- **Sharding**:
  - Split data across multiple PostgreSQL clusters to distribute the write load.
  - Use Citus to scale PostgreSQL horizontally.

#### Caching

- **Redis or Memcached**:
  - Cache frequently requested data to reduce the database load.
  - Integrate with Ruby on Rails via `ActiveSupport::Cache`.

## Frontend scaling

- **Client-side caching**:
  - Use Service Workers and the Cache API to cache static resources.

- **CDN (Content Delivery Network)**:
  - Distribute static files through a CDN to reduce the load on the servers.

## Advantages of the proposed solution

- **High fault tolerance**: thanks to Kubernetes/Docker Compose and PostgreSQL replication.
- **Flexibility**: new servers and microservices are easy to add.
- **Automation**: scaling requires minimal human intervention.
- **Cost-effectiveness**: resource usage is optimized through automatic scaling.

The scaling scenario described above lets the telemetry system handle growing loads effectively, providing high performance, fault tolerance, and flexibility. By adopting these modern technologies, the platform is ready for future challenges.
