How to build an architecture that will handle high loads
Diana Maltseva Apr 20
When developing a software system, make sure it will be able to easily withstand high loads. Even if your project is rather small, in some moment you may need to scale.
For example, if you run a marketing campaign and many users joined the system as a result, or a new additional feature unexpectedly brought a plenty of users, or you just expand your project.
Certainly, if your plan is to create an Uber-like app or something like that (implying millions of users and millions of events per day, e.g., payments), you do need to focus on the scalability and high performance of your application.
Otherwise, you will definitely face the following problems:
- Slow or endless page loading
- Random errors
- Disconnected connections from the web server
- Partial content loading (e.g., when there are no some images)
- Reduced user activity and customer losses
A few words about high loads:
- Highload begins when one physical server is unable and/or can't effectively process data
- If one instance serves 10,000 connections at the same time – it’s high load Highload is about a simultaneous service of thousands and millions of users
- If you deploy your application on Amazon Web Services, Microsoft Azure, or Google Cloud Platform, you’re maintaining a high load architecture
Principles of creating apps that can handle high loads
Dynamics & Flexibility
When developing large-scale web applications, the main focus should be made on flexibility. Having a flexible architecture, you will be able to make changes and extensions much easier, which means reduced costs, time, and efforts. Keep in mind, that flexibility is the most important characteristic of any fast-growing software system.
Gradual project growth
It’s difficult to predict the audience size for the years to come, so it’s better to move focus to scalability. The same goes for the application architecture. Gradual solutions are the basis for successful software development.
If you're running a new application, it makes no sense to immediately provide an infrastructure that can handle millions of users and process millions of events a day. Use the cloud to host new projects, as it enables to make the server cost lowes and facilitates their management as well.
Also, many cloud hosting services provide private network services, allowing developers to safely use multiple servers in the cloud and make the system scaling.
Scaling of any web application is a gradual process involving 4 steps:
- Load analysis
- Determination of the areas most affected by the loads
- The transfer of these areas to individual nodes and their optimization
- Load analysis (again)
Make sure that the application proportionally scales across servers as traffic flow grows. Stateless everything, load balancing, 90% cached, content delivery network, and so on – and you have a high load architecture.
However, cost-effectiveness is the key. Imagine that you have 100 thousands of users and one server. So, in order to obtain 120 thousands of users, you need to place another server. Quite complicated, isn’t it?
So, you should take one step behind and think – which part of the system causes a problem under load? If it’s a database, choose a high-scalable one before starting the project. Or take even several databases, for example, one for writes, one for reads (CQRS).
Defining and resolving performance issues in advance and without drastically increasing infrastructure costs – this is high load all about.