A single devoted server handles most manufacturing internet functions effectively. In some unspecified time in the future, it doesn’t — both as a result of site visitors has grown past what one server can serve, since you want redundancy so a {hardware} failure doesn’t take the appliance offline, or as a result of your database has change into massive sufficient that it ought to run on devoted {hardware}…
When a Single Server Turns into the Mistaken Reply
The set off factors for shifting to multi-server structure are particular. Basic “we’re rising” reasoning isn’t sufficient — the prices and complexity of multi-server infrastructure are actual, and single-server optimization typically extends the runway additional than groups count on.
Transfer to multi-server structure when:
- Load common persistently exceeds your core depend throughout regular site visitors hours, not simply throughout spikes. A 16-core server with sustained load common above 20 is queuing work.
- Your database and software compete for a similar RAM. Redis caching, MySQL InnoDB buffer pool, PHP-FPM staff, and software reminiscence all share the identical bodily RAM on a single server. In some unspecified time in the future, database efficiency and internet tier efficiency are instantly buying and selling off in opposition to one another.
- A {hardware} failure could be a enterprise incident. If server downtime throughout substitute (sometimes 2-4 hours) would price you materially, you want redundancy.
- Deployment requires downtime. Multi-server setups enable rolling deployments; single-server deployments typically require taking the appliance offline throughout updates.
Tier 1: Net + Database Separation
The primary significant multi-server configuration separates the online software tier from the database tier. This addresses the RAM competition downside and permits every server to be optimized for its function.
Net server: Nginx/Apache, PHP-FPM, software code, Redis cache. CPU-optimized configuration. InMotion’s Important or Elite tier suits most functions at this stage.
Database server: MySQL/PostgreSQL, massive InnoDB buffer pool (70-80% of RAM), optimized disk I/O configuration. Reminiscence-optimized configuration. The Excessive server’s 192GB DDR5 RAM makes a superb devoted database server — a 130-150GB InnoDB buffer pool retains most manufacturing databases solely in-memory.
Community connectivity between the 2 servers issues. Each servers ought to be provisioned in the identical InMotion knowledge heart to make sure low-latency non-public community communication. Software configuration factors database connections to the database server’s non-public IP quite than localhost:
// WordPress wp-config.php
outline('DB_HOST', '10.0.0.2'); // Database server non-public IP
outline('DB_NAME', 'production_db');
outline('DB_USER', 'app_user');
outline('DB_PASSWORD', 'secure_password');
MySQL on the database server ought to bind to the non-public interface and settle for connections solely from the online server IP:
# /and many others/mysql/mysql.conf.d/mysqld.cnf
bind-address = 10.0.0.2
# Grant entry solely from internet server
# GRANT ALL ON production_db.* TO 'app_user'@'10.0.0.1' IDENTIFIED BY 'password';
Tier 2: Load-Balanced Net Tier
When a single internet server is now not ample, including a second internet server behind a load balancer distributes site visitors and offers failover if one internet server fails.
HAProxy is the usual open supply load balancer for this configuration. It runs on a small server (or on the database server if assets allow) and distributes requests throughout the online tier:
international
maxconn 50000
log /dev/log local0
defaults
mode http
timeout join 5s
timeout consumer 30s
timeout server 30s
possibility httplog
frontend web_frontend
bind *:80
bind *:443 ssl crt /and many others/ssl/certs/manufacturing.pem
default_backend web_servers
backend web_servers
steadiness roundrobin
possibility httpchk GET /well being
server web1 10.0.0.1:80 test inter 2s
server web2 10.0.0.2:80 test inter 2s
The choice httpchk directive sends well being test requests to /well being on every internet server each 2 seconds. A server that fails well being checks is faraway from rotation routinely. HAProxy’s configuration information covers the complete well being test configuration together with response code matching and failure thresholds.
Session state should stay exterior the online servers. When load balancing distributes requests throughout a number of internet servers, every request might hit a distinct server. Session knowledge saved in PHP’s default file-based session handler received’t be out there on the opposite server. Retailer periods in Redis on the database server:
# /and many others/php/8.x/fpm/php.ini
session.save_handler = redis
session.save_path = "tcp://10.0.0.3:6379"
All internet servers level to the identical Redis occasion. Any internet server can serve any request, no matter which server dealt with earlier requests from the identical person.
Tier 3: Database Excessive Availability
Net tier redundancy with out database redundancy leaves a single level of failure on the database layer. MySQL replication or clustering offers database-level redundancy.
MySQL Major-Reproduction Replication is the only excessive availability configuration. The first handles all writes; replicas obtain adjustments through binlog replication and might deal with learn queries.
# Major server my.cnf
[mysqld]
server-id = 1
log_bin = /var/log/mysql/mysql-bin.log
binlog_format = ROW
sync_binlog = 1
innodb_flush_log_at_trx_commit = 1
# Reproduction server my.cnf
[mysqld]
server-id = 2
relay-log = /var/log/mysql/relay-bin.log
read_only = 1
For computerized failover (selling a duplicate to major if the first fails), Orchestrator is the usual software for MySQL topology administration. Orchestrator screens replication topology and might execute computerized promotion, with integrations for Consul or ZooKeeper for DNS-based failover coordination.
MySQL InnoDB Cluster offers synchronous replication with computerized failover, at the price of increased write latency (writes have to be acknowledged by a quorum of nodes earlier than committing). For functions the place knowledge loss on failover is unacceptable, InnoDB Cluster’s synchronous mannequin offers stronger ensures than asynchronous replication. MySQL’s Group Replication documentation covers setup and operational issues.
Structure Diagram: Three-Server Manufacturing Setup
[Load Balancer / HAProxy]
10.0.0.0:80,443
/
[Web Server 1] [Web Server 2]
10.0.0.1 10.0.0.2
Nginx + PHP Nginx + PHP
/
[Database Server]
10.0.0.3
MySQL Major + Redis
|
[DB Replica]
10.0.0.4
MySQL Reproduction
This configuration handles:
- Net tier failure: HAProxy removes the failed internet server; the remaining server handles all site visitors
- Database duplicate failure: Software continues writing to major; duplicate reconnects and catches up
- Database major failure: Orchestrator promotes duplicate to major; DNS updates level software to new major
What it doesn’t deal with: load balancer failure. Including HAProxy redundancy with Keepalived (for VIP failover between two HAProxy cases) addresses the final single level of failure.
Shared File Storage Throughout Net Servers
Net functions that enable file uploads (pictures, paperwork, user-generated content material) want these information accessible from all internet servers. Recordsdata uploaded to web1 must be readable from web2.
Three approaches, so as of complexity:
NFS mount: One server exports a listing through NFS; others mount it. Easy, however the NFS server turns into a single level of failure and I/O bottleneck at scale.
GlusterFS: A distributed filesystem that replicates knowledge throughout a number of servers. Extra advanced to configure, however eliminates the one level of failure.
Object storage with CDN front-end: Add information on to S3-compatible object storage (or InMotion’s backup storage as a staging space), serve through CDN. The cleanest structure for brand new functions — no shared filesystem to handle.
For current functions, NFS is commonly the quickest path to multi-server file entry. For functions being designed for multi-server from the beginning, object storage with CDN supply avoids a category of operational complexity solely.
Planning the Development
Multi-server structure doesn’t must be applied all of sudden. The standard development:
- Begin with a well-configured single server (InMotion Important or Excessive relying on workload)
- Separate database to its personal server when RAM competition or I/O competition turns into measurable
- Add a second internet server and cargo balancer when CPU saturation is constant
- Add database replication when enterprise necessities mandate diminished downtime danger
- Add HAProxy redundancy when the load balancer itself turns into the final single level of failure
Every step provides price and operational complexity. Transfer to the subsequent tier when present constraints are measurable, not in anticipation of constraints you haven’t hit but.
Associated studying: Hybrid Infrastructure: Combining Devoted + Cloud | Server Useful resource Monitoring & Efficiency Tuning








