6 Performance Techniques Every Drupal Developer Should Know

September 29, 2015 Published by:

Performance Techniques for Drupal Developer

Drupal is an excellent platform specifically for the high volume, and high traffic websites. When it comes to managing the websites, and offering security, there is no better platform than Drupal. With the Drupal 7 and higher versions, the platform has definitely made improvements in what it has to offer its users. Now, it’s time to invest in the performance improvements for websites based on Drupal. Here are a few performance improvement techniques every Drupal developer should indulge in.

Redefine Server Architecture

Your server architecture should be designed such that it can be scaled in the future. You should ideally have different servers supporting different contexts and roles. This will help make the large websites efficient and remove the bottlenecks, if any. For a large website, you should ideally have two websites- one dedicated towards database handling, and other meant to handle the web services. In case of smaller websites, it is fine if you have a single server. With two different servers, you are able to handle data more efficiently, and your application runs to the best of its ability.

Enhanced Web Server

Continuous and concurrent traffic may be observed along the different servers handling database, and web services. Your web server needs to be efficient enough to handle this concurrent traffic with ease. You need to ensure that the web server is equipped with enough RAM to handle this traffic. You might also need to configure the KeepAlive settings in case you own a very busy website. In some other cases, you may want to disable the KeepAlive settings altogether.

Make APC Mandatory

APC is a PECL module specifically used for PHP, and requires an opcode to enable the cache. It basically stores the precompiled PHP code in the cache, and uses it whenever the code is called. So, it saves the efforts of compiling and calling the code, whenever it is needed. This enhances the overall performance of the site, and reduces the loading time effectively. The allocated memory needs to be increased, when you install APC to your website. For most Drupal sites, you will need minimum 64MB allocated for APC. In some cases, which depend entirely on the modules you have utilized, you may need to allocate more space. With this installed properly, the cache rate improves.

Database Server

When you are planning your server, you need to understand that the server specifications differ for the different applications. Ideally, 4-16 cores and 8 GB RAM should work for your database server. But, in case of heavy applications, this will need to increase. In most cases InnoDB servers combined with 64 GB RAM is what you need to improve the performance of your website. Backend of your application should be InnuDB MySQL.

Your MySQL settings are important in this case as that is what you need to work on to improve the performance of your website. You should ideally set the default storage to InnoDB and the buffer pool size should be set in accordance to the RAM size of your server. Create a RAM disk on the server, using which you can create MySQL tmpdir so that some of the temporary modules and tables use the RAM instead of the disk space. The long query time should be ideally set to 1 second, and you should also set the number for max connections.

You should enable slow log, so that all the slow logs in your application are logged here. With the mysqlreport function, you will get an insight into the performance of all the variables.

Front-End Cache

Front-end cache can typically cause performance improvements which will help your website in cases of increased traffic. It manages to cache the images, JavaScript and CSS that are being requested regularly by your users, thus increasing the performance. Varnish is one such program that enables the front end cache, and can be used successfully in a wide range of settings. If you want to cache only the static settings, then you should ideally use pressflow. The memory requirements for varnish depend on the traffic, data being exchanged and the website for which it is being used. Varnish is typically utilized when there is anonymous traffic on the website.

Profiling Code

Profiling the code and improving the front-end performance will together enhance the Drupal website performance. Here are some tools that can help you with profiling the code

xhprof: This is a PHP profiler with a simple HTML interface. This will make profiling data available for every page loaded. With this, you will be able to note the number of functions being loaded along with the number of times each function is being loaded

yslow: If you want to know the errors in your page, you should use the tool yslow by Yahoo! It will analyze everything from cookies, http requests to the aggregations on your website

Some other tools include Firebug and NewRelic, which also help with profiling the code.

With these performance hacks, you can improve the loading time, and ensure a good uptime for your website. You will also improve the data handling capacity for the larger applications.

Semaphore Software possesses a strong and reliable Drupal Development team, which offers experience and expertise in developing custom Drupal application. Contact us at info@silvertouch.com to know more about our services.