Designing Database Architecture – Single Node Web Server Architecture
02/07/2022Designing Database Architecture – Horizontal Scaling with MySQL Replication
02/07/2022Single Server Deployment and Vertical Scaling
Provisioning a LAMP stack on a single node can be done in two steps
- Deploy a Linux server, then install the other three software packages via your distribution’s package manager. Once the stack is provisioned, your web application’s code should be installed and configured. This work can often be automated with open source tooling; for example, WP-CLI can be used to install WordPress on a server
- You need to consider the network security and availability of your server. Many cloud providers offer network filtering to prevent or reduce the impact of denial-of-service and other kinds of network attacks. However, it’s still important to fine-tune your network security configuration with a firewall.
In this section’s example architecture, the firewall is a process that runs on your server. The firewall intercepts network packets when they are first processed by the operating system and only allows traffic on certain network ports to proceed. For a web application, your firewall would allow HTTP (port 80) and HTTPS (port 443) traffic. Linux and other operating systems have built-in firewall options, like iptables, ufw, and FirewallD
Single Node LAMP Stack with Cloud Firewall
The resulting setup has one server running the LAMP stack where network traffic is filtered by a firewall also
running on the server There are limitations for this setup:
- Growth and scaling: With one server, you’re confined to that server’s memory, compute, and disk space resources. If your website starts seeing more traffic, you might need to increase the memory, compute, and/or disk space of the server to handle the load This is referred to as vertical scaling This process can vary in difficulty, depending on your cloud provider’s tooling, or on hardware availability for on-premise deployments. Vertical scaling can only offer a limited solution for capacity, as there are upper limits on the resources for a single server.
- Availability: Operating a single server means that there is a single point of failure for your web application. If the server needs hardware maintenance, or if one of the software components in the stack halts unexpectedly, then your web application will not be available To some extent, the issue of traffic growth can be addressed by moving the database to its own server, as in the following diagram:
Vertical Scaling with Separate Web and Database Nodes
By doing this, the compute, memory, and disk space needs of your web server and database can be adjusted independently This is still an example of vertical scaling, and it does not resolve availability issues.