
This might be a new topic for some of the readers, while others might already be familiar with it, so lets start with some introduction, so everyone can catch up.
Many site owners have a decent amount of customers, but that doesn’t necessary mean they have a high load on their site.
If customers don’t visit the site all together at the same time, a site might have 10000 customers daily, but a day has 24 hours, which is 1440 minutes. So if an average customer spends around a minute on a website, you might still only have less than 10 customers per minute, which is not a high load and many sites can handle that much with an average hosting.
However, sometimes you promote special offers or bring many new customers from an advertisement campaign, and they might start visiting your site with a higher rate – from 10 customers a minute to 1000 a minute and you better be prepared for that, because otherwise they will see an unresponsive site and waste your marketing efforts.
Also if you are actively blogging, your articles might eventually rank high in search results and lead to unexpectedly large amount of visitors in a short period of time.
Besides, it is important to note, that every user might send multiple requests to your server – visiting pages, loading pagination and submitting forms – each of those actions will be a separate request, so as related resources used on those pages – images, styles and scripts.
Considering that, high load is usually measured in amount of requests, not in amount of visitors.
With that introduction to the topic, lets see how we can manage a large amount of requests while also keeping website fast.
The first line of defense to have a website that can handle many requests is to optimize your code and apply various content serving best practices.
How? By applying these two ideas:
preg_match() a lot – page generation might eventually become slow.Take a look at the screenshot below, this is a query for https://wp-box.org homepage content, you can see the exact SQL in the first column, and processing time in the last column.

But, on the other hand, some queries are slow by default. And you should try avoid using them or look for a hacky solution.Some business logic requirements might leave you no choice, and sometimes you have to use slow queries.
For those there might be no universal advice on speeding them up, its best to identify those bottlenecks and engineer a custom solution, if for some reason you cannot avoid using them. Besides you should consider caching and lazy loading some queries – e.g. you don’t need to perform a search query with page load, you can get the input from search form, show a nice spinner and take your time to load results. This last particular improvement is not a high load technique though, just a barely related UX advice.
This is a very important optimization to reduce load on your server, however you should note that it only applies to GET requests – page loads, template loads, paginated results loads and other content, where you don’t process user input or show user-specific content.
Best practice would be to return content as early as possible, without passing request.to the next layer, so the layers are:
Database replication is a more advanced technique, which many projects would never need, however it comes useful in three situations:
First case is more known with applications like Video Games where miliseconds matter, and if you have a server in USA, but request is coming by user from Asia – every request will have a distance delay, even on well-optimized site.
CDN partly covers these needs, but only for GET requests that can be cached, if you want your uncacheable requests to be really quick, you will need to have a server close to user location. This often is a requirement for E-Commerce and FinTech websites.
This also applies for the second case, you might need additional servers just to handle regional loads, for a website with replicated database amongst all instances.
These cases might be implemented with and without actual load balancing.
Author of this project has faced problems discussed in this article and is developing WP BOX with potential high load in mind.
It might be not the most effective ever solution, because Im trying to keep a balance between effectiveness and ease of usability with reasonable support costs, thus WP BOX is designed to be universal. Code that is written for the project is optimized to be reasonably effective, without sacrificing comfort working with a site on a daily basis.
This website is deployed on Google Compute Engine and using Cloudflare CDN, but it will perform similarly on any other VPS or your local computer.