Blog image

Turbo-Charging Your PrestaShop: 10X-100X Faster with LiteSpeed + CyberPanel

According to a W3Techs survey of all sites where the CMS is known, 1.5% of them are using PrestaShop. We know that there are a lot of WordPress + Woocommerce solutions out there (from Cache plugins to managed hosting providers) but what about PrestaShop?

 

Did you know, in only 3 steps, you can set up a blazing fast PresaShop store?

 

  1. Install CyberPanel.
  2. Install PrestaShop using CyberPanel auto-installer.
  3. Install LSCache module for PrestaShop.

With LiteSpeed and CyberPanel, and only few clicks, you are ready to launch your store! Not only that, you have set up your system for high performance by utilizing the LSCache plugin for PrestaShop.

 

PrestaShop is great open source software for people to launch their stores and start selling online. But heavy software such as PrestaShop can be a drain on server resources. And often, people trying to set up an online presence do not know much about optimizing their stack for better performance. Such people know how to run a business but don’t know much about system administration and optimization. Luckily CyberPanel and LiteSpeed make it easier.

 

This article is all about speeding up your store, so lets dig deep into it.


Why LiteSpeed Web Server?

People always ask why LiteSpeed Web Server? The reason for using LiteSpeed Web Server is the performance you get out of the box. Sometimes you can improve Apache’s performance as well, but for that you need to be an expert and do a lot of optimizations. And even then, it will be nowhere near to LiteSpeed. LiteSpeed’s secret weapon is LSCache and the LiteSpeed Cache Module for PrestaShop.


How LSCache works and why it is different?

So, why do we use LSCache and how it is different compared to other caching solutions? First and foremost is the ease of use and setup. And the second thing is the speed difference. LiteSpeed Web Server Enterprise has an ESI ( Hole punching ) feature built in.

 

The main page and public block of a store is cached and served to all users. Private-blocks are cached and served to individual users via ESI blocks. Cached pages are saved to disk, leaving RAM for other important tasks. This means that using SSD or NVME can improve performance as well.

 

Let see how easy it is to set up a PrestaShop store.


Step 1: Install CyberPanel Enterprise

Open the command line terminal of your VPS and run

 

sh <(curl https://cyberpanel.net/install-ent.sh || wget -O - https://cyberpanel.net/install-ent.sh)

To learn more about installation you can read this installation knowledge base article. A Starter License is totally free with a limit of 1 domain and 2GB RAM. It will be enough if you are just starting out.

If you have an established store, you can use the Starter License to set up your store, and later upgrade to Site Owner or Site Owner Plus licenses.


Step 2: Create Your First Website in CyberPanel

In your CyberPanel you can create as many websites you want, your license determines how many of them can be active. So, if you are using a Starter License, only 1 top-level domain will work. Make sure your license matches your needed number of domains.

 

 

From the left side bar click ‘Create Website’ under Websites. Fill in all of the boxes on the right. For your convenience a Default package is already created on a plain install of CyberPanel, so you don’t need to create one. However if needed, you can create your own package too.  After the website is created make sure it appears on the list of websites.

 


Step 3: Install PrestaShop via One-Click Auto Installer

Once the website is created, launch the website panel, where you can install PrestaShop.

 

 

Or, go directly to

 

https://< IP Address >:8090/websites/example.com

 

Once the web panel for the domain is launched, scroll down and click Prestashop under Application Installer. A new browser window will open.

 

 

Fill all of the details as needed and click Install Now. This will take some time and then your PrestaShop store will be ready for you to install the cache module.


Step 4: Install LiteSpeed Cache Module for PrestaShop

Once PrestaShop is successfully installed, navigate to http://domain.com/admin, and enter your administrative login details from the installation step. (Step 3)

 

Before moving forward, download the cache plugin locally to your computer from this link.

 

 

Once you are logged in to the PrestaShop admin dashboard, click Module & Services from left sidebar and then upload the cache plugin that you have just downloaded. In just a few seconds, the plugin will be installed. After installation is successful, click the Configure button. For most basic configurations you must enable the cache.

 

 

Make sure the cache is turned on. This is the most basic configuration. It gives you a lot of other options that you can configure as per your requirements.


Benchmarks LiteSpeed vs NGINX (Apache Backend)

Don’t take our word for it, lets run some benchmarks. With NGINX we’ve got to run Apache as a back end due to rewrite rules. However, this extra layer is not needed with LiteSpeed because LiteSpeed can directly read Apache-style rewrite rules.

 

For benchmarks we are using h2load

 

h2load -t1 -H 'Accept-Encoding: gzip' -c20 -n500 $domain

Hardware Setup:

 

  • 1 vCPU.
  • 2GB Ram.
  • 50GB SSD

 

NGINX (with Apache Backend)

 

First run

 

[root@p ~]# h2load -t1 -H 'Accept-Encoding: gzip' -c20 -n500 $domain
starting benchmark...
spawning thread #0: 20 total client(s). 500 total requests
TLS Protocol: TLSv1.2
Cipher: ECDHE-RSA-AES256-GCM-SHA384
Server Temp Key: ECDH P-256 256 bits
Application protocol: http/1.1
progress: 10% done
progress: 20% done
progress: 30% done
progress: 40% done
progress: 50% done
progress: 60% done
progress: 70% done
progress: 80% done
progress: 90% done
progress: 100% done

finished in 279.74s, 1.79 req/s, 15.46KB/s
requests: 500 total, 500 started, 500 done, 500 succeeded, 0 failed, 0 errored, 0 timeout
status codes: 500 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 4.22MB (4428576) total, 718.98KB (736236) headers (space savings 0.00%), 3.48MB (3644340) data
                     min         max         mean         sd        +/- sd
time for request:      9.94s      14.84s      11.18s       1.00s    83.40%
time for connect:   242.93ms    248.59ms    245.65ms      1.89ms    55.00%
time to 1st byte:     10.63s      12.10s      10.85s    413.04ms    85.00%
req/s           :       0.09        0.09        0.09        0.00    95.00%
Second run

 

[root@p ~]# h2load -t1 -H 'Accept-Encoding: gzip' -c20 -n500 $domain
starting benchmark...
spawning thread #0: 20 total client(s). 500 total requests
TLS Protocol: TLSv1.2
Cipher: ECDHE-RSA-AES256-GCM-SHA384
Server Temp Key: ECDH P-256 256 bits
Application protocol: http/1.1
progress: 10% done
progress: 20% done
progress: 30% done
progress: 40% done
progress: 50% done
progress: 60% done
progress: 70% done
progress: 80% done
progress: 90% done
progress: 100% done

finished in 278.33s, 1.80 req/s, 15.54KB/s
requests: 500 total, 500 started, 500 done, 500 succeeded, 0 failed, 0 errored, 0 timeout
status codes: 500 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 4.22MB (4429029) total, 719.28KB (736544) headers (space savings 0.00%), 3.48MB (3644485) data
                     min         max         mean         sd        +/- sd
time for request:      5.37s      21.10s      11.06s       2.16s    91.20%
time for connect:   150.93ms    284.90ms    223.36ms     66.73ms    55.00%
time to 1st byte:      7.52s      14.99s      10.46s       3.08s    70.00%
req/s           :       0.09        0.09        0.09        0.00    55.00%
Third run

 

[root@p ~]# h2load -t1 -H 'Accept-Encoding: gzip' -c20 -n500 $domain
starting benchmark...
spawning thread #0: 20 total client(s). 500 total requests
TLS Protocol: TLSv1.2
Cipher: ECDHE-RSA-AES256-GCM-SHA384
Server Temp Key: ECDH P-256 256 bits
Application protocol: http/1.1
progress: 10% done
progress: 20% done
progress: 30% done
progress: 40% done
progress: 50% done
progress: 60% done
progress: 70% done
progress: 80% done
progress: 90% done
progress: 100% done

finished in 263.38s, 1.90 req/s, 16.43KB/s
requests: 500 total, 500 started, 500 done, 500 succeeded, 0 failed, 0 errored, 0 timeout
status codes: 500 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 4.23MB (4430861) total, 721.12KB (738424) headers (space savings 0.00%), 3.48MB (3644437) data
                     min         max         mean         sd        +/- sd
time for request:      5.06s      15.77s      10.44s       1.17s    90.40%
time for connect:   256.74ms    261.48ms    258.83ms      1.56ms    55.00%
time to 1st byte:      8.10s      16.03s      11.35s       3.25s    75.00%
req/s           :       0.09        0.10        0.10        0.00    50.00%

Average total time taken: 273.3 seconds.

LiteSpeed Web Server

 

First run

 

[root@vest ~]# h2load -t1 -H 'Accept-Encoding: gzip' -c100 -n1000 $domain
starting benchmark...
spawning thread #0: 100 total client(s). 1000 total requests
TLS Protocol: TLSv1.2
Cipher: ECDHE-RSA-AES256-GCM-SHA384
Server Temp Key: ECDH P-256 256 bits
Application protocol: h2
progress: 10% done
progress: 20% done
progress: 30% done
progress: 40% done
progress: 50% done
progress: 60% done
progress: 70% done
progress: 80% done
progress: 90% done
progress: 100% done

finished in 344.42ms, 2903.41 req/s, 25.38MB/s
requests: 1000 total, 1000 started, 1000 done, 1000 succeeded, 0 failed, 0 errored, 0 timeout
status codes: 1000 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 8.74MB (9166200) total, 42.29KB (43300) headers (space savings 89.86%), 8.66MB (9082000) data
                     min         max         mean         sd        +/- sd
time for request:     2.65ms     62.52ms     18.24ms      7.52ms    82.40%
time for connect:    51.38ms    171.92ms    134.42ms     31.28ms    74.00%
time to 1st byte:    94.63ms    180.83ms    159.79ms     19.86ms    80.00%
req/s           :      29.88       37.13       31.62        1.69    83.00%
Second Run

 

[root@vest ~]# h2load -t1 -H 'Accept-Encoding: gzip' -c100 -n1000 $domain
starting benchmark...
spawning thread #0: 100 total client(s). 1000 total requests
TLS Protocol: TLSv1.2
Cipher: ECDHE-RSA-AES256-GCM-SHA384
Server Temp Key: ECDH P-256 256 bits
Application protocol: h2
progress: 10% done
progress: 20% done
progress: 30% done
progress: 40% done
progress: 50% done
progress: 60% done
progress: 70% done
progress: 80% done
progress: 90% done
progress: 100% done

finished in 333.66ms, 2997.10 req/s, 26.20MB/s
requests: 1000 total, 1000 started, 1000 done, 1000 succeeded, 0 failed, 0 errored, 0 timeout
status codes: 1000 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 8.74MB (9166200) total, 42.29KB (43300) headers (space savings 89.86%), 8.66MB (9082000) data
                     min         max         mean         sd        +/- sd
time for request:     3.18ms     45.14ms     15.56ms      9.03ms    76.50%
time for connect:    42.69ms    235.21ms    145.69ms     60.61ms    52.00%
time to 1st byte:    78.25ms    244.87ms    168.46ms     58.45ms    49.00%
req/s           :      30.43       38.68       33.33        2.37    68.00%
Third run

 

[root@vest ~]# h2load -t1 -H 'Accept-Encoding: gzip' -c100 -n1000 $domain
starting benchmark...
spawning thread #0: 100 total client(s). 1000 total requests
TLS Protocol: TLSv1.2
Cipher: ECDHE-RSA-AES256-GCM-SHA384
Server Temp Key: ECDH P-256 256 bits
Application protocol: h2
progress: 10% done
progress: 20% done
progress: 30% done
progress: 40% done
progress: 50% done
progress: 60% done
progress: 70% done
progress: 80% done
progress: 90% done
progress: 100% done

finished in 330.43ms, 3026.33 req/s, 26.46MB/s
requests: 1000 total, 1000 started, 1000 done, 1000 succeeded, 0 failed, 0 errored, 0 timeout
status codes: 1000 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 8.74MB (9168500) total, 44.53KB (45600) headers (space savings 89.32%), 8.66MB (9082000) data
                     min         max         mean         sd        +/- sd
time for request:     2.58ms     48.05ms     15.97ms      8.75ms    86.30%
time for connect:    33.55ms    198.28ms    141.86ms     50.06ms    64.00%
time to 1st byte:    79.26ms    207.18ms    165.30ms     45.96ms    78.00%
req/s           :      30.81       39.02       33.27        2.26    70.00%

Average total time taken: 335 milliseconds (Yes, milliseconds)


LiteSpeed is FAST!

You might wonder why the LiteSpeed result was so fast. Let’s see how the NGINX stack handles the requests:

  1. Request comes in, NGINX forwards this request to the Apache backend.
  2. Apache forks, the fork processes this PHP request, and returns the response to NGINX.
  3. NGINX sends the response back to browser.

 

You can see that many layers are involved. However let see what happens with LiteSpeed Stack:

 

  1. Request comes in, LiteSpeed checks if the page exists in its cache.
  2. If page is in cache, the cache page is sent back to browser without doing anything.
  3. Otherwise LiteSpeed forks PHP and process this request.

 

So, the request is only sent to the PHP backend the first time. Later, all requests are served from cache. This removes a lot of extra layers.

Some people might argue that we can optimize the NGINX stack to get better performance. It is true the NGINX stack can be improved/optimized, but still it will not come closer to what can be achieved with caching. Plus, we can also further optimize the LiteSpeed stack too.

 

At the end of the day, not everyone is a sysadmin with lots of experience to optimize everything. LiteSpeed + LSCache gives you this performance out of the box with no further optimization required.

Author's page
Cyber Panel

Leave a Reply