π‘ Idea Behind the Scaling
Suppose I have a business application and I want to access it from anywhere over the internet, so I can make money. So, how I supposed to do that? I know you are brilliant and you have the answer. Yes!! I will rent a machine from a cloud provider and host it traditionally.
After some days my app becomes very popular and so many people are using it. Now the real problem begins. People are facing downtime and I am losing customers π€¦. So, I asked one of my friends and he told me to scale up the machine to solve the problem.
π₯ What is Scalability?
Scalability is able to handle more requests with a bigger machine or adding more machines. There are two types of scaling,
- Vertical Scaling
- Horizontal Scaling
Vertical Scaling
In one sentence, Buying a bigger machine called vertical scaling. I mean a single machine serves all the requests.
Horizontal Scaling
Adding more than one machine is called horizontal scaling. I mean you have already a machine and you add more machines with it to serve the requests.
π» Pros and Cons
Horizontal | Vertical |
---|---|
1. Load balancer required | 1. N/A |
2. Call over the network (Little Slower) | 2. Interprocess communication (Faster) |
3. No problem until all the servers crash | 3. Single point of failure |
4. Data Inconsistency | 4. Consistent |
5. Nicely scale up according to need | 5. Hardware limits at some point. |
π Conclusion
So, now the big question is Which one should we use β My answer is Both. This actually depends on the system you are designing. Both the scaling system have some good sides. You just need to think about how much big a system you are going to build and how many requests you need to serve in each second and is it consistent to use this model. That it. You'll have your answer.
Top comments (2)
Do you have experience with for example AWS cloud services? The first company I worked at hosted PHP websites shared on the same machine.
If one website pulled 100% load all websites would slow down. And if only one is, for example, sending e-mails to a lot of customers that one website could blacklist a whole lot of e-mail addresses based on IP address.
Those where rough times I can tell you π
Yes, I have experience using aws. When I use single server for multiple services I use docker. Usually i always use docker. But it's to use single VM for multiple services.