4 Common Server Setups For Your Web Application
There are so, so, many possibilities you may consider when designing your infrastructure, each with its distinct advantages and disadvantages. Here we’ll cover 4 of the most popular combinations, and explain the pros and cons of each.
To start with, take the following bullet points and think for a moment how your architecture may differ vs another if you made each one the top priority when designing it:
- ease of management
- cost
- reliability
- performance
- scalability
- availability
Everything on one server
All components sits on a single system. For a typical modern web application, this would include all of the parts needed to run the app, such as a web server, database server, and the application code itself. A very common setup of these components would be the LAMP stack, which is an acronym for Linux, Apache, MySQL, PHP (Python, Perl), and is used at all levels, entry to enterprise, just with tweaks for the latter.
When to use it?
If you’re just after a quick and simple set up to host your basic app/site, then you’re gonna struggle to find anything easier to get started with. A tried and tested workhorse.
Advantages
- Simple! With some hosting providers you can set this up in just a few clicks
Disadvantages
- All your eggs in one basket. If this server goes offline, so does your site/app
- Not very easy to scale horizontally
- All components competing for the same limited resources
Separate Database Server
Splitting out the database component of your infrastructure from the rest of it (and this will be an ongoing theme) allows you to isolate the resources available to each of these components. This makes capacity planning much easier, and can also give you some fault tolerance in more advanced configurations. This is almost always the first infrastructure upgrade we see people spring for and we often recommend it ourselves. It’s a quick win, and pretty easy to do.
When to use it?
When you’re looking for your first set of upgrades for your infrastructure, your database layer is struggling, or you’d like better separation between your web and database components.
Advantages
- Simple upgrade from a single server set up
- Better separation between resources, leading to easier scaling
Disadvantages
- Additional cost over single server
- A little more complex than a single server setup
- More areas, primarily network performance, need to be considered
Caching Layer
Caching content can make an absolutely massive difference to site performance and scalability. Caching involves storing in memory a (usually) commonly requested asset, think a logo or a web page, so that it can be served to a visitor without having to be generated and/or loaded from the disk every time.
Two of the most popular pieces of software used in caching are Memcached and Redis, both of which are key-value stores. This means that each piece of cached data has a key, which is essentially a name used to identify the data, and a value, which is the data itself. As explained above, these values are returned to a visitor instead of having to generate the data fresh again.
Plugins for Redis/Memcached support exist for most popular CMSes, allowing for very easy integration with an existing set up. See this tutorial for an example of integrating WordPress with Redis
When to use it?
When you’re serving a lot of static content, such as images, CSS or Javascript.
Advantages
- Alleviates load on your application servers
- Big performance increases for little effort
Disadvantages
- Can be difficult to tune correctly
Load Balancing
The clue is in the name. In this set up, the load is balanced between multiple servers, allowing them all to serve a portion of the traffic. This also has the benefit of added redundancy, in that if one of the servers were to go offline, the other server(s) around around to handle the load.
When to use it?
When redundancy is important, and when scaling individual servers any higher becomes an unreasonable process.
Advantages
- Increased redundancy
- Scaling with zero downtime by adding in additional servers to the pool
Disadvantages
- Single point of failure. If the load balancer goes down, all traffic to your site will go down
- Additional complexity. A prime example is with sessions, and ensuring that visitors have a consistent web experience regardless of which app server handles their request
Summary
Managing infrastructure can be hard, especially when you get to the advanced levels such as load balancing and auto-scaling, but there are also very positive results to be had from not huge amounts of work. Planning for the future and considering the differing needs of the many parts of your app can save you a lot of heartache and expense down the line. Still unsure? Contact us and we’ll be happy to help.
Feature image credit CWCS Managed Hosting – CC BY 2.0
Leave a Reply
Want to join the discussion?Feel free to contribute!