Improving Speed of Joomla based Website

Explorations while shifting our servers.

Shyam Sundar Verma , 23 January, 2014

Anyone running an personal website would be aware of the importance of Servers. Behind every domain there is a web server which is called the host. Whenever you type a specific URL in the browser, you gain access to the web server of that website. The files are fetched and displayed in your browser screen.

According to the fact mentioned above a simple logic applies. If the server system is not up to the mark then the websites will always remain slow. Yes, many times the internet connection is also responsible for the sagging of a website response, but that is something beyond our reach. We can never boost up the internet speeds at the other end unless we possess some psychic abilities.

Ways to improve the Website responses.

We researched thoroughly while on the quest to attain the peak performance for our website and we came to a final conclusion that there are only two ways to improve the load time of a website.

  1. Restructuring your website: It’s the process of calculating the overall load time of the website and then removing or modifying the scripts that are the most performance hungry. Well, we discussed the complete process in the blog about restructuring our website.
  2. Overhauling the web servers: This is the prime topic that this blog is about. In this post I wish to share all our team’s findings and experiences that we gained after quite a research. Please read further for the elaborate details of our server shifting process and get the quick benefit.

Type of hostings available :

There are total three types of hosting servers (apart from cloud hosting), that can be used as per your needs.

  1. Managed Virtual Servers : This is a shared physical server with isolated virtual system. Each virtual machine gets guaranteed resources(cpu, disk and memory), to keep it unaffected from others. The overall cost of server maintenance is shared by all of it’s tenants and the hosting company manages most of thing for you.

    This type of service is best for the startup businesses, individuals who have limited capital resources and individuals who do not have the technical expertise to manage a server.
  2. Unmanaged Virtual Servers : Its same as above the only difference is, everything is self managed. The hosting companies are only liable to manage network and access to hosted virtual machine, nothing more. All the tweaking installing and server managing is to be done on the user end.

    This type of hosting is generally opted by the developers or persons who can manage everything by themselves (including hosting security). This is the cheaper as no management cost included.
  3. Dedicated servers : It’s the best out there that money can buy. Dedicated servers allow the clients to leases an entire server not shared with anyone else. This is more flexible than shared hosting, as organizations have full control over the server(s), including choice of operating system, hardware, etc.
    But, with great flexibility, comes a huge price tag. They even demand bigger contract commitments e.g a contract for at least 12 months or more. So, we didn’t opted for it. It is mostly used by the enterprise level websites who demand/require certain personalized constraints for performance, security & access.

Why we shifted our servers ?

Our official website was earlier hosted on Media Temple (Dedicated Managed Virtual). The service was good we never had any issues from them and everything was smooth.

Before restructuring the website as we mentioned in our earlier blog, our response time was around 1000-1200ms, after restructuring website code we were able to slash that to around 800ms.

Achieving this feat should have increased the website’s performance, as we perceived. Instead we found out that when the website faced the simultaneous traffic flow, during the peak hours it became sluggish. We tested our scenario and found out that the server was limiting us from achieving the further performance gains.

Few factors that troubled us mostly were -

  1. Server response under load : We tried many solutions only to get the same sluggish response during the simultaneous traffic.

  2. Costing : Cost to performance ratio was high. Many will argue about their pricings, but when we compared the server response speeds with the costing we paid, found it to be more.

  3. Complex to customize : Setting up extra new features were little complex and time consuming due to the Plesk doing many things behind the screen. Once we even tried to install and use APC (Advanced PhP Cache), but the website became non-functional. We "had to instantly reverted the changes".

  4. Absence of API : Media Temple managed DV does not have any API. So we needed to work manually for many of the tasks.

Where are we now ?

After much permutations and combinations we gained an understanding that a single solution will never be able to suffice our needs. Currently we are using multiple systems to get the best out of our efforts. Below I have listed the same.

  1. DNS Service : Domain Name System (DNS) is used for binding the domain names to your IP. It is generally available at most of the hosting companies. We already had plans to use Cloudflare for CDN and even it’s DNS service also has awesome performance.

    • Cloudflare DNS service is Super fast.
    • Cloudflare helps us in keeping our server’s IP secure, as DNS & IP binding is not broadcasted because Cloudflare works as proxy.
    • Whenever the web server changes its IP, no DNS propagation is required. With the help of an API, incoming web traffic is forwarded to the new IP within fraction of seconds.
    • This service even has a programmable API which is very awesome for us.
  2. Hosting Server : Most of the time while googling for any piece of information related to server setups we noticed a super active community from Digital Ocean. We learned that they are hosting providers, an unmanaged one. Since at our core we are developers, we didn’t hold back the horses and decided to give it a shot. We found out some cool features -

    • Virtual servers retain the same IP address even after reboots.
    • All of the servers are using the Solid State Drive (SSD) Hard disks, which results into super fast servers and minimum hardware failures.
    • Digital ocean have a very stable API, hence it was easy to program servers as per our needs.
    • Significant backing by venture capitalists will ensure Digital Ocean’s longevity in the market.
  3. Deployment : Since last few months we have also been using vagrant in our internal circles for the development purpose. We just love vagrant, as it reduces our pain and saves time during setting up a reliable server.

    This time we decided to build server using Vagrant and Puppet. Here PuPHPet ( A simple GUI to set up virtual machines for Web development) also came handy, a quick and easy way to set up vagrant machines. Even Digital Ocean too supports deployment via vagrant.

    We are using Vagrant to build new identical machine for live, staging, testing and development environment. Obviously within fraction of minutes.

  4. Backup : Previously we were using akeeba for backing up our websites. This time we decided to remove akeeba backup system from our joomla based website.

    We wrote simple phing scripts to build backups and dump them to protected Amazon S3 service. This improved our backup process and it takes now 60-80 seconds, around 4x faster than akeeba backup.

  5. Assets Optimization and delivery : Previously for the sole purpose of optimizing the assets (i.e. static resources like css, js and images) we were using smart optimizer and using cdn plugin from NoNumbers to server these optimized assets via Amazon Cloudfront.

    Now for the above purpose we use only Cloudflare, which optimize the assets and serve them via CDN automatically, without any efforts required at webserver.

    This allows us to save server time which was previously required for assets optimization and cdn rewriting. The process also includes -

    • Automatic assets optimization (minify and gziping).
    • Image optimization and lazy loading.
    • Asynchronously loading all JavaScript.
    • Pre-loading assets for your web pages automatically .
    • Assets caching.
  6. Security and Spam protection : For this crucial subject we are currently relying on Fail2ban and Cloudflare. They help us in securing our servers and applications from malicious hacking attempts as well as spams. There respective task lists includes the following.

    • Fail2ban observes server logs and blocks the suspicious hackers and spammers.
    • Cloudflare has a real-time firewall installed to protect the applications from exploits, XSS, SQL injection attacks.
    • Cloudflare can identify spam users by browser integrity checks and block them as well.

So, this was our complete story for server migration. Yes, we had to perform an in depth research to reach our goal, but I am very happy that we achieved it with success and I could lay out the complete detail and blueprints of our achievements so that anyone in need can get a help.

Lastly I would only say that by using new approach we have slashed the server response time from 800ms to 400ms ☺. Why don't you go for a check and let us know our website’s response time at your end ?

We also use server monitoring services from New Relic , have a look on response time at our web server 30 minutes back.

also take a look at how fast it is at customer end.

blog comments powered by Disqus