Horizontal vs vertical scaling
Let's assume you have a small application running on a single server. The simplified architecture would look like this:
Multiple clients send requests to a single server that is responsible for answering them. This approach is fine as long as you don't have big traffic and you are okay with your server being down for a while if any unexpected problem occurs. It might be suitable for your blog or a hobby website, however, there are several issues that are deal-breakers for huge applications. Let's take a look at 2 of them.
The first one is that your server is a single point of failure. Once the server goes down, no one can reach your application.
The second one is scalability. If the traffic is getting bigger, your server might not be able to handle so many requests. The question is how to deal with it. Basically, you can try to scale your server horizontally or vertically.
Vertically - replace the server with a more powerful one
Pros:
- it handles more traffic
- just one server to maintain
- doesn't increase the complexity
Cons:
- still only a single point of failure
Horizontally - instead of replacing the server, add another one(s)
Pros:
- it handles more traffic
- no single point of failure - if one server is down, the load balancer reroutes traffic to other servers
Cons:
- the server has to be "stateless"
- increases the complexity
- more servers to maintain