With growing software projects there may be a need to support a bigger number of users. In such cases, ideally, you should include the possibility of high loading into the software architecture. However, several approaches can be applied for existing projects, too. Our experience in website development of high load projects is described below.
First step of optimization is clusterization of web nodes. A number of web nodes can be set in one cluster with one load balancer. That will increase the number of users that can use the website at the same time. This group of linked servers working together can give a better performance and availability than a single server provides.
Load balancing is linking multiple servers together to share the job execution workload, cache and request handling. Logically, from the user side, they are multiple machines, but functioning as a single virtual machine, so user cannot see if there is a cluster or not. Requests initiated by the user are managed and distributed among all the standalone computers to form a cluster. This results in balanced computational processing among different machines, which will improve the performance of the cluster system.
The most effective way to optimize each separate server is caching.
There are two types of cache for web instances:
-
-
- caching server response. For this purpose we can use some kind of HTTP accelerator. For example, it can be Varnish with Nginx in the back end. When a request comes to the server, Varnish makes a lookup. If the page has already been opened by other users, this page is in cache and Varnish just returns it. Otherwise, Varnish sends a request to Nginx, receives the page, caches it and returns the response to user. Varnish must be configured for caching only static, not personal pages. (e.g. About, Home Page, etc.)
-
-
- caching database server response. All website data are stored in a database. We can cache the results of some big (or even huge) database queries and store the results in Memcache. It helps to modify database loading and speeds up the website.
Another point of pages loading optimization is minification of stylesheets and JavaScript files. Minification is a process in which files are compressed by deletion of unnecessary spaces and by replacing long variable names by short ones.
All user session data and static files must be moved to separate servers.
A CDN can be used for files. CDN (Content Delivery Network) a distribution system of web servers on the Internet that accelerates the delivery of different files to users around the world. The CDN replicates the content files in several servers located in geographically dispersed datacenters. So, users in different regions can access the nearest data center and get a file at a high speed. Most CDNs are third-party services.
A MongoDB instance can be used for storing a user session. It is a NoSQL database that can be used for this purpose.
The easiest way to increase the capacity of a MySQL database is to upgrade the server hardware. Most often, this means adding a CPU and/or RAM, but can also include disk I/O capacity. It works only for dedicated servers.
A database can also be scaled in other ways. We propose such approaches:
– The Master-Master replication. The Master-Master distributes query processing and data storage across multiple nodes to eliminate single points of failure and allow almost unlimited scaling.
– The Master-Slave replication. Two or more database instances are used, one instance is the master and the others are slaves. All write requests (adding new data or modifying existing) are routed to the master instance, then copied to the slaves. Read operations are routed to the slave instances. In the event of a failure of the master, one of the slave instances must be designated as the new master and update operations rerouted.
DevOps consulting services can help you increase quality of software delivery on your project.
As for me, I can hardly understand most of the processes and terms described.
But as an owner of an e-store, I understand what means when you have more customers than can serve.
It’s a tricky game – marketing!! You are firstly searching for someone who wants to buy your products, put money in ads, social media, apps, invent these bonuses and discounts.
But after all, they invade your servers, and the system falls. You are just watching, blinking, and can’t do anything.
Thanks for the article. We should think about the increasing number of our users in advance.
I agree with the colleague above. It’s a big mistake to order a website or an app, get it built, and relax waiting for easy revenues. Each platform demands updates, support services.
If you asked me at least two years ago, whether my company pays for DevOps services, I’d have answered: “NO”. I couldn’t’ imagine what these guys earn their bread for then.
But….now I’m sure it’s the same story as with cars or houses. You can’t leave your digital platforms without care and use them day and night.
First, you pay for building a website, design, features like pop-ups and 24/7 support.
Then you manage to get in touch with mobile users, differ from competitors and offer something unique – interesting and useful for people.
If you a startupper you can easily get your head burst with thoughts and friendly advice.
I’m sure a smart businessman must move step by step. You can’t predict everything.
You get a website – ok.
Be happy and work with it, and don’t think too forward. In a year technology may change. And you’ll need something extremely different to stay profitable.