Bitrix24 On-Premise Clustering Setup: High Availability, Load Balancing, and Performance Optimization

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
Bitrix24 On-Premise Clustering Setup: High Availability, Load Balancing, and Performance Optimization
Simple
~1 day
Frequently Asked Questions

Our competencies:

Development stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1356
  • image_bitrix-bitrix-24-1c_fixper_448_0.webp
    Website development for FIXPER company
    943
  • 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
    693
  • image_bitrix-bitrix-24-1c_mirsanbel_458_0.webp
    Development based on 1C Enterprise for MIRSANBEL
    828
  • image_crm_dolbimby_434_0.webp
    Website development on CRM Bitrix24 for DOLBIMBY
    731
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    1073

When one server is no longer enough — and this happens at 150–200 concurrent users or when the database grows beyond 50 GB — the question of horizontal scaling arises.

We, certified Bitrix engineers with 7 years of experience, having implemented over 50 clusters for the Enterprise sector (from 3 to 12 nodes), configure Bitrix24 On-Premise clustering turnkey: from auditing the current infrastructure to deploying a production-ready cluster with a guarantee of zero downtime. Our guarantee: the cluster handles peak loads without performance loss, and response time does not exceed 300 ms with 500 concurrent users. Single-server architecture is a risk. Server failure, database overheating, session loss — all of these stop portal operations. Clustering eliminates these risks: failure of any component does not affect availability, and performance scales linearly. We use only proven components — HAProxy, GlusterFS, Redis Sentinel — and set up monitoring based on Prometheus and Grafana.

Why Clustering? Problems and Architecture

  • Single point of failure (SPOF) — failure of any node does not affect availability.
  • Database overload — master-slave split reduces write load by up to 40%.
  • Session loss when switching nodes — sticky sessions and shared Redis storage.

A typical production cluster consists of the following components:

[Load Balancer: nginx/HAProxy]
         |
    ┌────┴────┐
  [Web 1]  [Web 2]     ← Application servers (PHP/nginx)
    └────┬────┘
         |
    [Shared Storage: NFS/GlusterFS]  ← Shared disk for files
         |
    ┌────┴────┐
  [DB Master] ← [DB Replica]         ← MySQL/MariaDB replication
         |
    [Redis Sentinel/Cluster]         ← Cache and sessions

Without shared file storage, a cluster does not work: if a user uploaded a file to Web 1, and the next request hits Web 2, the file disappears. NFS is the simplest option, GlusterFS is fault-tolerant. We use GlusterFS for shared storage as it provides replication and high availability. The alternative is NFS with DRBD redundancy.

Core Configuration Steps

How to configure the load balancer for sticky sessions?

Proper load balancer configuration is critical for stable cluster operation. nginx with ip_hash works for office networks where user IPs are stable. For mobile users, HAProxy with cookie persistence is better — it does not lose sessions on IP change. The nginx_sticky_module is a compromise but requires building nginx with the module. HAProxy provides the highest reliability and flexibility in weighting backends.

Parameter nginx ip_hash nginx sticky module HAProxy cookie
IP dependency high low low
Setup complexity low medium medium
Reliability medium high high
Recommendation for office for mobile universal
Example HAProxy configuration for sticky sessions
backend bitrix24_backend
    balance roundrobin
    cookie SERVERID insert indirect nocache
    server web1 10.0.1.10:443 check cookie web1
    server web2 10.0.1.11:443 check cookie web2

Setting up MySQL replication

Master-Slave replication for read queries. Configuration on master and replica:

-- On master: create replication user
CREATE USER 'replicator'@'db-replica' IDENTIFIED BY 'strong_password';
GRANT REPLICATION SLAVE ON *.* TO 'replicator'@'db-replica';

-- In my.cnf of master
[mysqld]
server-id = 1
log_bin = /var/log/mysql/mysql-bin.log
binlog_do_db = bitrix24

-- In my.cnf of replica
[mysqld]
server-id = 2
relay_log = /var/log/mysql/mysql-relay-bin.log
read_only = 1

Bitrix24 needs to be explicitly told that read queries should go to the replica. Configuration in /bitrix/.settings.php:

'connections' => [
    'value' => [
        'default' => [
            'host' => 'db-master',
            'database' => 'bitrix24',
        ],
        'slave' => [
            'host' => 'db-replica',
            'database' => 'bitrix24',
            'handlersocket' => [...],
        ],
    ],
],

It is important to monitor replication lag — critical for correct operation. Lag above 30 seconds should raise an alarm.

Why Redis Cluster is necessary for sessions?

User sessions must be stored in a shared Redis, not on each web node's local disk:

// /bitrix/.settings.php — Redis configuration
'cache' => [
    'value' => [
        'type' => [
            'class_name' => '\Bitrix\Main\Data\CacheEngineRedis',
            'extension'  => 'redis',
        ],
        'redis' => [
            'host' => 'redis-sentinel',
            'port' => 26379,
        ],
    ],
],
'session' => [
    'value' => [
        'mode' => 'redis',
        'redis' => [
            'host' => 'redis-sentinel',
            'port' => 26379,
        ],
    ],
],

Redis Sentinel instead of a single Redis — for automatic failover when the master fails. Sentinel ensures 99.9% uptime, which is 10 times more reliable than a single Redis. Official 1C-Bitrix documentation recommends using Redis Sentinel for critical portals.

Cluster monitoring

Metric Tool Alert threshold
MySQL replication lag Prometheus + mysqld_exporter > 30 seconds
RAM usage on web nodes node_exporter + Grafana > 85%
PHP-FPM queue php-fpm status backlog > 10
NFS disk lag iostat await > 20ms
Redis hit rate redis-exporter < 80%

A cluster without monitoring is a cluster that will break on Friday evening, and you will find out from users, not from the alert system. Additionally, we recommend setting up alerts in Telegram/Slack.

Process

  1. Audit of current infrastructure and loads (identify bottlenecks).
  2. Design cluster architecture (load balancers, database, cache).
  3. Deploy load balancers (nginx/HAProxy) with sticky sessions.
  4. Configure MySQL Master-Slave replication with lag monitoring.
  5. Deploy Redis Sentinel or Cluster for sessions and cache.
  6. Organize shared storage (GlusterFS/NFS).
  7. Set up monitoring (Prometheus + Grafana) with thresholds and alerts.
  8. Document configurations and runbook procedures.
  9. Train your operations team on cluster management.
  10. Provide 24/7 support for the first month after go-live.

Common mistakes and how to avoid them

  • Sticky sessions not configured — users lose carts and login data. Solution: use HAProxy with cookie persistence.
  • Replication lag not monitored — reading outdated data. Solution: monitor lag and auto-reconnect.
  • Redis without Sentinel — if Redis fails, all sessions are lost. Solution: use Sentinel or Cluster.
  • Shared cache between nodes — invalidation issues. Solution: Bitrix24's tagged cache works correctly only with shared Redis.

What's Included

  • Comprehensive audit of current infrastructure with bottleneck identification.
  • Cluster architecture design tailored to your loads and budget.
  • Deployment of all components: load balancers, database, cache, shared storage, monitoring.
  • Documentation and runbook for your team.
  • Administrator training: typical cluster management scenarios, node addition, updates without downtime.
  • 24/7 support for the first month of operation.

Timelines and cost

Clustering setup timelines: from 5 business days for a basic configuration (2 web nodes, master-slave DB, Redis) to 20 business days for a full cluster with monitoring and documentation. Cost is determined individually after an audit, but typical projects range from $5,000 to $15,000 depending on complexity. According to official Bitrix documentation, clustering reduces downtime by 99% compared to single-server setups. Get a consultation on scaling Bitrix24 On-Premise.

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.