This is an old revision of the document!


Should I turn on both PageSpeed and LSCache at the same time?

In some cases, you maybe want to know does mod_pagespeed work with LiteSpeed Cache? This article is going to show you the result by testing benchmark experiment.

Before we dive into the differences between LSCache and pagespeed, let's take a quick look at the background of these two function and their general characteristics.

  • LSCache is a server-side page cache. Page caches save time and resources, and they do so by storing the full content of dynamically-generated pages so that static copies may be served to the user. A page cache allows the server to bypass PHP and database queries altogether. It is an output cache for dynamic contents, so the usage is not limited to PHP pages. Unlike Varnish, LiteSpeed cache is built into LiteSpeed's web server, thus eliminating one layer of reverse proxy. This translates into higher efficiency for static contents.
  • Page Speed is an open-source module which automatically applies web performance best practices to pages, and associated assets (CSS, JavaScript, images) without requiring that you modify your existing content or workflow. This module can reduces website loading times by automatically optimizing web pages and the resources within them.

Hardware

  1. Client Spec: 4 core E7-4870 2.40GHz CPU + 4 GB Memory
  2. Server Spec: 4 core E7-4870 2.40GHz CPU + 4 GB Memory

OS and Settings

  1. Client:
    1. CentOS 7*64
  2. Server
    1. CentOS 7*64
    2. LSWS v5.2
      1. Disable Keep alive
      2. Increase max connection 200000
      3. WooCommerce demo data, page size = 68k
    3. WP-Plugin v1.2.0.1
    4. mod_pagespeed rules
      1. pagespeed FileCachePath /tmp/lshttpd/pagespeed;
        pagespeed RewriteLevel CoreFilters;	

Testing Method

There are four cases in our experiment, Case 1: without lscache and mod_pagespeed, Case 2: Only use mod_pagespeed, Case 3: Only use lscache, Case 4: Use both lscache and mod_pagespeed. We send request command with wordpress URL from client side to the Web server.

  1. The method to test these web servers uses ApacheBench (an HTTP server benchmarking tool). In each test, 10,000 requests are made for a 68 KB size page
  2. Before each test the web server in question was restarted to clear out any potential caching or other issues that may interfere with results.
  3. Each test was run with the same concurrent numbers of requests to gauge performance at different cases.
  4. The commands that are used in this test follow this format:
    ab -n 10000 -H "Accept-Encoding: gzip,deflate" -c 10 http://$Server_IP/wordpress/

Comparison on a form

Case LSCache Mod_PageSpeed Requests/s Memory usage(MB) CPU Load 1min
1 X X 16 210 7.33
2 X O 21 300 8.42
3 O X 8152 1 2.50
4 O O 4469 100 3.52
  • CPU Load default average value is 0.3
  • Memory usage on record has already been subtract default value

Comparison on chart

Requests per second

LSCache clearly dominates in the raw number of requests per second it can serve. Due to numbers too much difference between with LSCache and without LSCache, we will show you the chart comparison separately by without cache and with cache.

  • Compare Case 1 and Case 2 by requests number per second, we can see there is 20% increase with mod_pagespeed
  • One will notice from this graph that with LSCache and PageSpeed both enabled that the numbers are lower than that of just LSCache but greater than just PageSpeed. The reason for this is that on a normal load of the webpage, LSWS will serve the cache file and all the static files that are requested without having to do any CPU intensive tasks. When PageSpeed comes into play LSWS will serve the cached page, removing any need of PHP so it will be quicker, but then it has to optimize all the other static content via mod_pagespeed before it gets served to the user. In return one receives optimized static files but at a cost of server resources and less requests per second.

CPU Load

  • Compare all cases by 1 min CPU Load, we can see CPU Load is higher if your mod_pagespeed is enabled than other cases.

Memory usage

  • This is important to measure, especially on a VPS where your memory usage has a hard cap and raising it costs you additional money. Compare all cases by memory usage, we can see there is 30% increase if your mod_pagespeed than nothing enabled.


Remember, the results shown are good only for measuring relative (and not absolute) performance, as the tests were conducted locally on the server.

After going over the benchmark testing of both lscache and mod_pagespeed enabled cases, you may have a better idea of which combination is more suited to your needs.

  1. Using lscache and mod_pagespeed together are still workable, but it will slow down your page loading time and increase CPU and Memory usage, so if your LSWS include LiteSpeed Cache already, then you don't need to enable pagespeed module for faster
  2. If your LSWS not include Cache, then pagespeed does faster your site around 20%. It will takes part of resources and should be avoided in shared hosting environment. More information, please see here
  3. See this article if you want to Add Caching to an Existing License
  • Admin
  • Last modified: 2017/09/13 15:35
  • by Eric Leu