Social Network for Web Professionals

Webmaster Blog

Members blog at WebmaisterPro. Covering topics related to online marketing, SEO, web development as well as software reviews.

Optimal Website Speed with Optimal Server Configuration

The first step of website speed optimization start with selecting quality web hosting services and of course server optimization. This guide is written for general purpose, however described techniques work on VPS and above with root access, as well as require deep understanding of server administration.

If you are a blogger or small business website owner, probably you don't need to do that, but if you have large, complicated project with high levels of traffic, then continue reading.

Even some of the most popular CMS and blogging platforms sometimes require some extra boost, for instance high traffic Joomla, Drupal and even WordPress can consume a lot of resources and can be unusable if traffic levels are high.

Now lets start with the essence and the very basics.Ubuntu_Server.png

Choosing Server Operating System

Assuming that we are talking about PHP based project, Windows might to the job, but without a doubt Linux will save a lot of system resources. Picking popular Linux distro can be tricky, I have test most and without a doubt for web project CentOS or Ubuntu LTS would be the right choice. Both have active communities, so if things go wrong it is easy to find reliable support. Best choices CentOS or Ubuntu.

Selecting Webserver

NGINX ServerIn the last couple of years, so many lightweight webserver applications have appeared, though still Apache is the most widely used. Other popular choices and alternative to Apache are LightSpeed, Lighttpd, Hiawatha, Cherokee, etc... One of the main problems of these alternatives is lack of support and documentation. Often dependencies might be missing, so better to choose something else. Fortunately there is an excellent and well supported Apache alternative in the face of Nginx, well supported, light and with numerous benefits (especially when we talk about high traffic websites). For stability Apache is unbeatable, but for high performance definitely Nginx.

PHP Choices

Whole server resources usage very much depends how you run PHP mod_php, fastCGI, PHP-FPM.

Well, mod_php is the oldest and the heaviest, FastCGI is preferred choices for most web hosting providers as it is faster and having smaller memory footprint compared to mod_php.

I personally think that the best one at the moment in terms of speed and low memory usage is PHP-FPM, the main downsides are related that it is not widely used and not known by IT community and it is relatively new. Though there are so many benefits of using it.

Database Management System

MySQL is the most popular choice and actually latest versions are very fast, but still not as fast as NoSQL (but close). MySQL project MariaDBchanged few owners recently and to be honest, I am not sure about the project future.

One of the best and easiest alternatives that is cross compatible with MySQL is MariaDB. MariaDB can work out of the box with some of the most popualr CMS – WordPress, Joomla and Drupal. Additionally you wont need to convert MySQL to MariaDB, just import. MariaDB is faster and lighter than MySQL and can be a real advantage when there are large number of requests. Additionally MariaDB can take benefit of Cassandra Storage Engine (originally built by Facebook), very useful when you need scalability of the project.

Proxy and Static Cache

Without a doubt a great advantage, but in most cases optional step. The options aren't many – Varnish proxy cash require a lot of technical knowledge to run properly. Using Varnish service though would be better option and reasonable investment. Nginx proxy is also a popular choice, especially because large support community.

In some popular web hosting forums and blogs there are articles related to perfect combination - nginx as webserver and varnish as proxy server. Well, things aren't straightforward, Nginx deliver the static files faster than Varnish, but Varnish serve the dynamic content much quicker than Nginx. I've already mentioned, to run Varnish properly a lot of knowledge and work is required.

PHP Dynamic cache

PHP Dynamic cache to many advantages and benefits, as well as many drilldowns, but to use the right one depends on the project. I have to say that Memcache, Redis , APC, etc... can cause a lot of troubles with some of the popular open source CMS.

Which opcode solution you should use? This is a tricky question, but I think APC is all rounder and work with most platforms.

Server Management Panel

No doubt cPanel is choice number one – easy to use, excellent support and everything works out of the box, as well as is configable without need of much knowledge. Sure, it consume a lot of resources, but prevent a lot of headaches. There are many alternatives, but I personally wouldn't use one.

Conclusion

Managing perfect server configuraiton for PHP project may vary, but we end up with

  • Ubuntu 12.04 64bit

  • Nginx

  • PHP-FPM

  • MariaDB

  • APC

  • cPanel

If you run a complicated project based on PHP and there is a lot of traffic, then this would be the best server configuration in most cases.

The main drawback is that probably will require dedicated in-house worker, as most of these aren't supported by majority managed web hosting service providers.

Rate this blog entry:
3
Big Data: The Key to More Effective Mobile Marketi...
WebmaisterPro Looking for Co-Founder or Investor

Related Posts

Comments

 
No comments yet
Already Registered? Login Here
Guest
Friday, 04 December 2020
If you'd like to register, please fill in the username and name fields.

Captcha Image