Optimize your server for high traffic WordPress installation

If you run a high traffic WordPress installation you will want to optimize WordPress and your server to run as efficiently as possible. This article gives a general overview of the avenues to pursue. It’s not a detailed technical explanation of each aspect.

WordPress Logo

The optimization techniques available to you will depend on your hosting setup. This article is divided into categories according to hosting type.

1) Shared Hosting :

This is the most common type of hosting. Your site will be hosted on a server along with many others. The hosting company manages the web server for you, so you have very little control over server settings and so on. The areas most relevant to this type of hosting are :

  • Caching : WordPress caching is the fastest way to improve performance. Plugins like W3 Total Cache or WP Super Cache can be easily installed and will cache your WordPress posts and pages as static files. These static files are then served to users, reducing the processing load on the server. This can improve performance several hundred times over for fairly static pages.
  • WordPress Performance : The first and easiest way to improve WordPress performance is plugins. Deactivate and delete any unnecessary plugins. Try selectively disabling plugins to measure server performance. Is one of your plugins significantly affecting your site’s performance?
    Then you can look at optimizing plugins. Are plugins coded inefficiently? Do they repeat unnecessary database queries? WordPress has its own caching system, so generally speaking, using functions like get_option(), update_option() and so on will be faster than writing SQL.

2) Virtual / Dedicated Server :

In this hosting scenario you have control over your own server. The server might be a dedicated piece of hardware or one of many virtual servers sharing the same physical hardware. The key thing is, you have control over the server settings. In addition to the areas above Caching and WordPress performance, you can follow the below techniques to optimize your server :

  • Server Optimization :

    DNS: If you host your DNS on external servers this will reduce the load on your primary web server. It’s a simple change, but it will offload some traffic and cpu load.

    Web Server: Your web server can be configured to increase performance. There are a range of techniques from web server caching to setting cache headers to reduce load per visitor. Search for your specific web server optimizations (for example, search for “apache optimization” for more info).

    PHP: There are various PHP accelerators available which can dramatically improve performance of your PHP files. This will apply to all PHP files, not just your WordPress installation. Search for PHP optimization for more information, f.e. APC.

    MySQL: MySQL optimization is a black art in itself. A few simple changes to the query cache settings can have a dramatic effect on WordPress performance because WordPress repeats a lot of queries on every request. Search for mysql optimization for more.

  • Offloading :

    Static Content : Any static files can be offloaded to another server. For example, any static images, JavaScript or CSS files can be moved to a different server. This is a common technique in very high performance systems (Google, Flickr, YouTube, etc) but can also be helpful for smaller sites where a single server is struggling. Also, moving this content onto different hostnames can lay the groundwork for multiple servers in the future.Some web servers are optimized to serve static files and can do so far more efficiently than more complex web servers like Apache, for example publicfile or lighttpd.

    Multiple Hostnames : There can also be user improvements by splitting static files between multiple hostnames. Most browser will only make 2 simultaneous requests to a server, so if you page requires 16 files they will be requested 2 at a time. If you spread that between 4 host names they will be requested 8 at a time. This can reduce page loading times for the user, but it can increase server load by creating more simultaneous requests. Also, known is “pipelining” can often saturate the visitor’s internet connection if overused.

    Offloading images is the easiest and simplest place to start. All images files could be evenly split between three hostnames (assets1.yoursite.com, assets2.yoursite.com, assets3.yoursite.com for example). As traffic grows, these hostnames could be moved to your own server. Note: Avoid picking a hostname at random as this will affect browser caching and result in more traffic and may also create excessive DNS lookups which do carry a performance penalty.

    Likewise any static JavaScript and CSS files can be offloaded to separate hostnames or servers.

Source : http://codex.wordpress.org

How to learn PHP ?

php-logo

What is PHP ?

PHP (PHP: Hypertext Preprocessor) is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. PHP is now installed on more than 244 million websites and 2.1 million web servers. With the growing use of PHP it is a plus point to learn this easy programming language.

What do I need ?

To execute PHP files you need to setup a Apache web server. There are various tools available which can help you setup apache web server up and running within minutes. One such tool is AMPPS. Download ampps and install it on your Windows or Mac desktop and you have apache server running to start off with learning PHP.

Where can I find tutorials ?

There are thousands of tutorials available over the internet but it is best to use the PHP manuals or learn over w3schools. You can access the PHP manuals at http://www.php.net/manual/en/. For new learners it is good to start with w3schools as it provides chapter-wise tutorials, you can start with the basics and then go on with the advanced functions.

How long does it take ?

PHP is a easy programming language to learn as compared to other languages. It does not require prior programming knowledge, however if you have a programming background it is a piece of a cake to master PHP. It usually does not take long if you are determined to learn it, you can learn PHP even in a weeks time. Practicing contributes much towards the speedy learning, only referring to the theories does not benefit you. You will need to practice PHP thoroughly to get the hang of it.

What else do I need to know ?

Learning PHP can help you code but you need to know MySQL, html and little bit of CSS to create a website. MySQL helps you to create a database connectivity required in case you want to make a dynamic website. Html and CSS are required to make you webpage look attractive.

Once you are done with these technologies you are ready to make your own website. There are also hundreds of PHP scripts available which you can simply install it on your web server to create your website AMPPS comes with Softaculous auto installer which is an addon to install such scripts with a click of a button.