Build high performance Drupal site without spending much


When we install the basic Drupal we get very simple functionality and not so good user experience, we have to dig through 30,000 modules to find the modules we need, install and configure them to achieve the site we actually want. To save the trouble from doing this work, we can take advantage of using Drupal distribution. One of the very good to start with is the Panopoly Drupal distribution it has almost all the modules or functionality that a general website should have.

How to setup Memcache on CentOS 7 for Drupal site

One way to optimize the authenticated users experience in Drupal site is to use Memcache. It works between the database and Drupal. Typically the queries are cached in the database but with Memcache the queries sent from Drupal to database are intercepted by Memcache and it serves them from RAM and this avoid hits to the disk or database. We see often that half of the queries are served by Memcache and we are looking significant improvement in authenticated users hits.

Setup Zend OPcache on CentOS 7

Zend OPcache speeds up the execution of PHP codes. How? We know that PHP is an interpreted language where the instructions are written in a script and needs a process to parse/interpret and execute it. Zend OPcache removes the parse/interpret part by compiling the script to directly executed it by the target machine which makes the execution of your PHP application more faster. This article will show how to setup Zend OPcache on CentOS 7.

Methods to disable Nginx cache when user is authenticated in Drupal

There are some cases we only need Nginx cache enabled for anonymous users. I can show two ways on how to disable Nginx cache when user is authenticated and enable it for anonymous users in Drupal.

Method 1: Using Cookie

This method invloves Drupal custom module to set an identifier in Cookie that a user is authenticated.

The custom module uses hook_user_login() to set "nocache=1" in Cookie if user is logged in and hook_user_logout() to set "nocache=0" if user is logged out. The codes are as follows (you can download the custom module below this article):

How to setup Pagespeed module in Nginx using rpm or yum on CentOS 7

Adding Pagespeed module in Apache is very easy with package manager:

sudo yum install at # if you do not already have 'at' installed
sudo rpm -U mod-pagespeed-*.rpm

... but if we want to add Pagespeed module in Nginx, first thing we think of is compiling its source along with the Pagespeed module. What if Nginx is installed in our server from yum or rpm? The process we need is to repackage RPM and that is what this tutorial will show.

Solution to NGINX upstream servers HTTP keepalive enabled serving wrong URL and content

With HTTP keepalive enabled in NGINX upstream servers reduces latency thus improves performance and it reduces the possibility that the NGINX runs out of ephemeral ports. Following the suggestion given by NGINX doc that the proxy_http_version directive should be set to "1.1" and the "Connection" header field should be cleared: