X

Horizontal scaling : Right way for a high traffic wordpress website

As we know quality content and lot of unique articles is the best bet to drive traffic to a website . But along with the traffic on lovely pieces of text comes more twisted and resource intensive database queries which may not be liked by the server .  These queries can sometimes be “HOT TO HANDLE”  and may kill it in case of uneven traffic spikes.

Now we are left with only two options to save our “DEAR WORDPRESS BLOGGING SYSTEM” either we scale our server vertically or horizontally :

1. Vertical Scaling Brief

2. Horizontal scaling Brief

All you must be yawning until now , what the crap … this article sucks and the author is only talking about blah blah.  We will take some scenarios on how can we scale WORDPRESS  CMS and cut to the chase.

Scenario 1

Problem : You are experiencing a heavy load on database server due to heavy mysql writes because of which read operations are slower and getting affected . It is also assumed web server (Apache or Nginx or any other) is separate

Solution :

Conclusion : It will give a redundancy at Mysql database level for which Hyperdb plugin is famous for. In case slave server fails all the queries will get redirected to Master. In case Master fails write operation will get blocked as slave doesnt allow to write to DB but the blog or site will always remain up.

Note : Do not ever think of creating master-master mysql server using its native replication tool , it is not an ideal solution and data consistency is not guaranteed.  If it is really necessary it is better to go for a third party mysql clustering tool or DRBD like solution.

Scenario 2

Problem : You are hosting Webserver and Mysql server on same machine and want to scale out with redundancy and load distribution. It is assumed you have an option of load balancer too (Either in a data center or public cloud service provider like Amazon or Linode)

Solution :

Conclusion : It will give redundancy at both application and database level.

Scenario 3

Problem : You are hosting Webserver and Mysql server on same machine and want to scale out with redundancy and load distribution. It is assumed you do not have a load balancer but each server is mapped to unique WAN IP

Solution :

Conclusion : It will give redundancy at both application and database level.

Their can be thousands more scenarios but it should be enough to get you started.

Tip :

Server scaling totally depends on the application structure and how the coding is done. Resource utilization on various CMS ie. wordpress,joomla,drupal etc can be brought down by using Object Caching and Page Level Caching. Both are very Important

Secret Ingredients for Running WordPress :

Batcache Plugin : For Page Level Caching

Memcached Object Cache Plugin: For Object Level Caching (It is not outdated , still if you have a doubt download it from vip quickstart enviornment)

HyperDB : For scaling WordPress horizontally

Quickstart Test Bed : Automattic has provided a test bed on git which replicates their environment. It can be a good start for understanding the best way to run the blog

Also I found Nginx Helper plugin to be better then batcache in case Nginx webserver was being used but for it to work Nginx cache purge module must be loaded.

  • Tags: scale wordpress, scaling wordpress, wordpress, wordpress architecture,