SuperCacher Options Using Varnish

 

We have mentioned in an earlier post that you can also use reverse proxy caching with Varnish to improve your site performance. Varnish cache is a web accelerator promising “really, really fast” site loading.

Their website says:

“Varnish Cache is really, really fast. It typically speeds up delivery with a factor of 300 - 1000x, depending on your architecture... It is usually bound by the speed of the network, effectively turning performance into a non-issue. We've seen Varnish delivering 20 Gbps on regular off-the-shelf hardware.”

SiteGround has developed SuperCacher services made exclusive to their customers. It includes four different caching options and two of them are Varnish-based. We are going to take a look further on the first three options: Static Cache, Dynamic cache and Memcached.

To access this you need to login to your cPanel and look for SuperCacher under Advanced panel. On the SuperCacher page you’ll see the three options.

  

1. Varnish Static Cache Option

Varnish caches all of your site’s static content such as CSS files and HTML documents into your server’s RAM to reduce time of data retrieval. As a default, this option is enabled for all SiteGround shared accounts.

To enable, select Static Cache and click on the switch button to turn this feature ON.

  

The site will automatically update every 24 hours with Flush cache option but take note that if you made changes on the site that needs to be live immediately then you have to Flush your static cache manually.

To do this simply click on Flush button on the Static cache tab. Another way to access this is under SuperCacher Status on cPanel homepage.

  

 

2. Varnish Dynamic Cache Option

This and the first static option uses the same concept in caching your site content to server memory instead of server HDD thus reducing site load tremendously. The only difference is as the name itself suggests it caches dynamic content. But you have to note that enabling Dynamic cache automatically enables static caching as well.

Before running dynamic cache you have to install the appropriate plugin for your site. You can find this plugin on Varnish Dynamic Cache tab.

 

Now that you have downloaded the plugin let us run through its installation.

How to Configure in Joomla

Login to your Joomla admin and go to Extension Manager. Once in Extension Manager tab click on Choose File to upload the jSGCache file then install.

  

Go to Extensions > Plugin Manager look for jSGCache and click on the icon under status to enable.

  

You can now go back to your cPanel to enable Dynamic caching option.

How to Configure in Magento

Before heading on to configuration, make sure that Magento Compiler is disabled. Then navigate to System > Magento Connect > Magento Connect Manager.

  

Enter your login details if required. Once on Magento Connect Manager page click on Browse and upload the file previously downloaded. Install this plugin and return to admin dashboard when finished.

 

To enable SuperCacher extension go to System > Configuration > SuperCacher options. Follow the options shown below:

 

When done, remember to enable Magento Compiler again then proceed to enabling Varnish Dynamic Cache option by going back to cPanel SuperCacher option.

Flush Cache

This option allows Flush caching for different applications you have installed. Same with static caching, you can enable this on Varnish Dynamic cache tab on SuperCacher.

 

3. Memcached Option

This is best used for websites running heavy database queries as advised by SiteGround. Results from database queries are stored making it more accessible with loading speed kept at the lowest loading time possible for the subsequent visitors. We rarely use this for our Joomla sites but Memcached option is readily available in Joomla and Magento CMS platforms. You just have to enable it to work.

On your cPanel and under SuperCacher choose Memcached option, click on the switch button to Enable Memory Cache to ON.

You need to take note of the Service IP address and port that will be provided on the same page after you enable this option.

How to Configure in Joomla

You need to edit Joomla configuration.php file inside public_html/joomla folder. Locate this code:

public $caching = '0';public $cache_handler = 'file';

Then replace with:

public $caching = '2';
public $cache_handler = 'memcache';
public $memcache_server_host = 'localhost';
public $memcache_server_port = '11211';

Remember to use the correct port number for your hosting account.

Check the following settings shown in the image and save the changes.

  

How to Configure in Magento

Locate and open Magento local.xml file and look for the following code: This is usually found at the bottom.

  

Right before '/config' line, add the following:

 

 

Remember and make sure to replace port number with the correct port number of your hosting account. Save the file.

Here’s a screenshot on how you can edit the file via cPanel’s Code Editor tool.

 

Flush Cache

Same with the two previous cache options, you can enable Flush cache by clicking its button on Memory Cache tab.