Configuring Automatic Scaling for 1C-Bitrix on Cloud Platforms

Our company is engaged in the development, support and maintenance of Bitrix and Bitrix24 solutions of any complexity. From simple one-page sites to complex online stores, CRM systems with 1C and telephony integration. The experience of developers is confirmed by certificates from the vendor.
Showing 1 of 1All 1626 services
Configuring Automatic Scaling for 1C-Bitrix on Cloud Platforms
Simple
~1 day
Frequently Asked Questions

Our competencies:

Development stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1368
  • image_bitrix-bitrix-24-1c_fixper_448_0.webp
    Website development for FIXPER company
    956
  • image_bitrix-bitrix-24-1c_development_of_an_online_appointment_booking_widget_for_a_medical_center_594_0.webp
    Development based on Bitrix, Bitrix24, 1C for the company Development of an Online Appointment Booking Widget for a Medical Center
    699
  • image_bitrix-bitrix-24-1c_mirsanbel_458_0.webp
    Development based on 1C Enterprise for MIRSANBEL
    843
  • image_crm_dolbimby_434_0.webp
    Website development on CRM Bitrix24 for DOLBIMBY
    737
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    1086

Configuring Automatic Scaling for 1C-Bitrix on Cloud Platforms

We often see projects where a Bitrix site crashes during a promotion. The server can't handle the load, and admins manually spin up copies. Automatic scaling solves this: the number of nodes adjusts automatically—growing under load and shrinking during idle periods. For 1C-Bitrix, this is especially relevant for online stores during sale seasons, event portals, and B2B platforms with daily peaks. Keeping 10 servers for a 3-hour peak is inefficient. Automatic scaling lets you pay only for the resources you actually use. Our experience shows that proper setup reduces infrastructure costs by 2–3 times while maintaining fault tolerance. For example, one client saw costs drop by 40% immediately, and total savings reached 65% after optimization.

Cloud Platforms: Yandex Cloud and VK Cloud

In the Russian segment, the main platforms are Yandex Cloud (Instance Groups) and VK Cloud (Auto Scaling Groups). The architecture mirrors AWS Auto Scaling: virtual machine groups with scaling policies based on metrics (CPU, RPS, memory). How it works:

  • Metric Alert (CPU > 70% for 5 minutes)
  • Scale-out trigger
  • New VM created from golden image
  • Cloud-init: install nginx + php-fpm, mount NFS
  • Health check: VM added to load balancer
  • Traffic distributed to the new node
Parameter Yandex Cloud VK Cloud
Terraform integration Official provider support Limited support
Managed Kubernetes Yes (with autoscaling) Yes (with manual configuration)
Technical support Standard paid Included in tariff

Both platforms provide fault tolerance, but the setup of golden images and cloud-init is identical. A golden image is the standard pattern for stateless architecture. Official Terraform documentation helps with providers.

Why Golden Image Is the Foundation of Autoscaling?

Autoscaling works only if a new VM is ready to accept traffic without manual intervention. The image must include:

  • nginx, php-fpm with required extensions for Bitrix
  • PHP application code (or a mechanism for fast delivery)
  • Script to mount shared storage (/upload/, cache)
  • Script to connect to Redis for sessions
  • Bitrix configuration with correct DB and Redis parameters

Creating a golden image in Yandex Cloud:

# Launch a base VM, configure manually
# After setup, create a disk snapshot
yc compute disk create --snapshot-id <snapshot-id> --name bitrix-golden

# Create an image from the snapshot
yc compute image create \
    --name bitrix-app-v1 \
    --source-disk bitrix-golden \
    --description "Bitrix 1C-Bitrix app node, PHP 8.1"

Cloud-init: Automatic Configuration on VM Startup

Example cloud-init configuration

Cloud-init runs on the first VM boot. It takes care of environment‑specific settings:

# /etc/cloud/cloud.d/bitrix-init.yaml
#cloud-config
runcmd:
  # Mount shared NFS volume
  - echo "nfs-server:/srv/bitrix-shared /var/www/html/upload nfs rw,sync,hard,intr 0 0" >> /etc/fstab
  - mount -a

  # Register the node in consul for service discovery
  - |
    curl -X PUT http://consul:8500/v1/agent/service/register \
      -d '{"name":"bitrix-web","address":"'$(hostname -I | awk '{print $1}')"'"}'

  # Warm up PHP OPcache
  - php /var/www/html/bitrix/cli/health.php --warmup

  # Start services
  - systemctl start nginx php8.1-fpm
  - systemctl enable nginx php8.1-fpm

Configure Bitrix via environment variables (not hardcoded in the image):

// /bitrix/.settings.php — reads from environment
return [
    'connections' => [
        'value' => [
            'default' => [
                'className' => '\\Bitrix\\Main\\DB\\MysqlConnection',
                'host'      => getenv('DB_HOST') ?: 'mysql-master',
                'database'  => getenv('DB_NAME') ?: 'bitrix',
                'login'     => getenv('DB_USER') ?: 'bitrix',
                'password'  => getenv('DB_PASS') ?: '',
            ],
        ],
    ],
    'cache' => [
        'value' => [
            'type'  => 'redis',
            'redis' => [
                'host' => getenv('REDIS_HOST') ?: 'redis-master',
                'port' => (int)(getenv('REDIS_PORT') ?: 6379),
            ],
        ],
    ],
];

We use Redis for session storage. It is 10 times faster than file‑based storage.

Configuring a VM Group in Yandex Cloud (Terraform)

resource "yandex_compute_instance_group" "bitrix_web" {
  name               = "bitrix-web-asg"
  service_account_id = var.service_account_id

  instance_template {
    platform_id = "standard-v3"

    resources {
      cores  = 4
      memory = 8
    }

    boot_disk {
      initialize_params {
        image_id = var.bitrix_golden_image_id
        size     = 50
      }
    }

    network_interface {
      subnet_ids = var.subnet_ids
    }

    metadata = {
      user-data = file("cloud-init.yaml")
    }
  }

  scale_policy {
    auto_scale {
      initial_size    = 2
      min_zone_size   = 1
      max_size        = 10
      measurement_duration = 60   # seconds
      warmup_duration      = 120  # new VM warmup

      cpu_utilization_rule {
        utilization_target = 70 # %
      }
    }
  }

  deploy_policy {
    max_unavailable = 1
    max_expansion   = 2
  }

  load_balancer {
    target_group_name = "bitrix-target-group"
  }
}

How to Deploy Code Without Rebuilding the Image?

Rebuilding the golden image on every deploy is inconvenient. We use a Pull‑on‑start approach: in cloud‑init we add a step to fetch code from an artifact. An environment variable RELEASE_TAG is passed in the VM metadata when the group is created; cloud‑init reads it and downloads the required archive from S3. Deploying becomes just changing the tag in metadata—all new nodes start with the current code.

Here is a step‑by‑step deploy process:

  1. Build the application artifact and upload it to S3.
  2. Update the VM group metadata: set the new tag.
  3. Trigger a rolling update of the group: nodes are recreated one by one with the new tag.
  4. Verify that all nodes are running the new code.

How to Prepare Bitrix for a Stateless Architecture: Checklist

  • Sessions → Redis (not files)
  • Cache → Redis or NFS (not local disk)
  • Files /upload/ → NFS or S3
  • Temporary files, queues → Redis or DB, not /tmp/
  • Cron jobs → run only on one designated node (not all)
  • Bitrix agents → switch to cron mode (BX_CRONTAB=Y) and run from the designated node
  • REMOTE_ADDR → correctly forwarded via X-Forwarded-For from the load balancer

A critical point with cron: if Bitrix agents run on all nodes simultaneously, duplication occurs. Set the bx_crontab_nodes parameter in bitrix/.settings.php or restrict cron to the designated node via iptables.

Monitoring and Alerts

Metrics for autoscaling policies:

Metric Scale-out threshold Scale-in threshold
CPU average across group > 70% for 3 min < 30% for 10 min
Average response time (p95) > 2000 ms < 500 ms
nginx request queue length > 100 < 10
RPS > 500 per node < 100 per node

What You Get

  • Architecture documentation describing all components
  • Access to infrastructure and IaC code (Terraform)
  • Deploy and update instructions
  • Training for your team (2-hour workshop)
  • One month of support after commissioning
  • Full automation: from VM creation to monitoring

Request an infrastructure audit — we will assess your current architecture and propose a migration plan. Get a consultation with a certified engineer to discuss the details of your project.

Case: a client with peak load of 10,000 RPS. After implementing autoscaling, downtime dropped from 15 minutes to zero. Infrastructure costs decreased by 40% due to turning off idle nodes. Our team’s experience: over 50 successful Bitrix projects, 10+ years in development. We guarantee proven reliability and expert support.

Timelines: basic autoscaling with two nodes—3–4 weeks. Production‑ready setup with IaC, monitoring, and runbook—6–10 weeks.

Source: Wikipedia - Autoscaling (https://en.wikipedia.org/wiki/Autoscaling)

1C-Bitrix Clustering

Imagine: a flash sale, 10,000 users simultaneously on the site, the server goes down with a 502 error, carts disappear, managers call support. We have seen this dozens of times. The solution is clustering: load balancing between servers, database replication, and automatic failover. Order an audit of your current infrastructure — in 2 days we will determine if and what kind of cluster is needed. Our experience: 40+ high-load projects on Bitrix.

Why is 1C-Bitrix clustering critical for fault tolerance?

80-90% of requests in a typical project are SELECT. Catalog, product pages, filters — all reads. Master-slave replication routes SELECTs to slave servers, leaving the master for writes only. The 'Web Cluster' module (Business edition and higher) routes requests automatically.

Common stumbling blocks: on master binlog_format = ROW. STATEMENT-based replication with NOW() or UUID() causes inconsistencies — leading to a week of debugging. Unique server-id, binary log enabled. On slave — read_only = ON, relay-log. Initialization via xtrabackup (not mysqldump, which locks tables for half an hour on a 20 GB database).

Metric #1 — Seconds_Behind_Master. If a slave lags by 5+ seconds, a customer places an order, returns to their personal account — and the order is missing (SELECT went to a lagging slave). The module allows manual exclusion of critical queries from slave routing.

Failover: Orchestrator or ProxySQL promote a slave to master in 15-30 seconds. The module supports up to 9 slave connections with configurable weights. Integrity check — pt-table-checksum from Percona Toolkit. Savings from inefficient infrastructure can be up to 40% of the budget, representing a significant annual amount for projects with 50,000+ unique visitors. For more information on replication, refer to MySQL Replication Documentation and Wikipedia: Database Replication.

When is clustering necessary?

Not every project needs it. Specific markers:

  • 50,000-100,000 unique visitors per day — a single server starts returning 502 errors during peak hours
  • Peak spikes of 5-10 times (sales, flash sales) — load grows in minutes, vertical scaling is not enough
  • SLA 99.9% (no more than 8.7 hours of downtime per year) — unattainable with a single server
  • Geographic distribution of users

Sometimes composite caching, SQL optimization, and vertical scaling are sufficient. We will honestly tell you if a cluster is not yet needed. Investments in clustering typically pay off within 3-6 months under peak loads. The average project budget is determined individually.

What does the cluster architecture consist of?

Load balancer. HAProxy, nginx upstream, or cloud LB. Round-robin for even distribution, ip-hash for session stickiness, least connections for adaptive balancing. Health checks remove dead servers from the pool. SSL termination on the balancer offloads web nodes.

Web servers. Identical nginx + php-fpm, each with a full copy of the code. Sessions in Redis/Memcached, not on disk (otherwise users lose their cart when switching servers). In the cloud — auto-scaling: load increases — servers are added, load decreases — they are removed.

Cache. Redis Cluster with data sharding across nodes. Redis Sentinel for small clusters. Memcached is fast but lacks persistence. Configuration in .settings.php — servers, weights, sharding strategy.

File storage. Uploads, images — accessible from each node. NFS for 2-3 servers, but it is a single point of failure. GlusterFS — distributed file system without single point of failure. S3 (MinIO, AWS, Yandex Object Storage) — offload static files to object storage, the Bitrix module works out of the box.

How to ensure failover at each cluster level?

Level Mechanism RTO
Load balancer Keepalived + VRRP < 5 sec
Web servers Health check < 10 sec
MySQL master Orchestrator / ProxySQL < 30 sec
MySQL slave Removal from pool < 5 sec
Redis Sentinel / Cluster failover < 15 sec
Files GlusterFS replication Automatic

The cluster is 5 times more reliable than a single server — if any node fails, the service continues to operate.

What are common clustering setup mistakes?

  • Sessions on files — when a server goes down, users lose cart and authentication.
  • Unmonitored Seconds_Behind_Master — sales suffer and SLA is unmet.
  • Single point of failure at the file storage level (NFS without replication).
  • Lack of replication monitoring — data inconsistencies go undetected.

We include checks for all these points in our audit and testing.

What is the clustering process?

  1. Load audit — load profile, bottlenecks, load testing. We find the ceiling of a single server.
  2. Design — components tailored to requirements and budget. Not everyone needs GlusterFS — sometimes NFS and backups suffice.
  3. Infrastructure — servers, network, firewalls. Ansible for automation — any node can be recreated in minutes.
  4. Migration — transfer with minimal downtime. Components are connected sequentially, each step verified.
  5. Testing — simulation of peak conditions. We crash the master, disconnect a web server, kill Redis — see how the system behaves.
  6. Documentation — architecture diagram, runbook, disaster recovery plans.

What does clustering work include?

Deliverable Description
Current load audit Request profile, bottlenecks, load testing
Project documentation Architecture diagram, runbook, disaster recovery plan
Infrastructure Server, network, firewall setup (Ansible)
Migration Transfer with minimal downtime, phased component connection
Testing Simulation of peak conditions: crash master, disconnect web server, kill Redis
Team training Documentation, 2 weeks of post-implementation consultations
Warranty 6 months of correct cluster operation — if something goes wrong, we fix it within 24 hours

What are the typical timelines?

Task Timeline
Audit and design 1-2 weeks
Basic cluster (2 web + master-slave MySQL) 2-3 weeks
Full cluster with failover at all levels 4-6 weeks
Monitoring + load testing 2-4 weeks

Contact us to get an engineer consultation and a preliminary project estimate within 2 days. We will calculate the cost based on your specific needs. Order an audit to find out the exact architecture and budget.