All Collections
Speeding Up Your Store
Speeding Up Your Store

Learn how to speed up your online store.

Olga Tereshina avatar
Written by Olga Tereshina
Updated over a week ago

With each release, we measure X-Cart's performance using the t2.micro AWS instance as a server (1 CPU, 1 PHP Thread, 512Mb RAM). We use an X-Cart installation with 2000 products, 100 categories (10 root categories, each containing 10 sub-categories), 1000 users, and 1000 orders. We also use the JMeter application that emulates 3 concurrent users who make 50 requests.

During our tests, we measure the Time to Last Byte parameter, the time between the moment a browser makes a request to a page, and the moment the HTML code of this page is fully received. Acceptable page load times for us are:

  • Home page: faster than 1.5 sec;

  • Category page: faster than 1.5 sec;

  • Product page: faster than 2 sec.

Also, it is possible to use to test performance.

Step 1. Enable CSS, JS Aggregation and Widget Caching

The following options must be enabled in your store's Admin area:

  • Aggregate CSS files,

  • Aggregate JS files,

  • Use widget cache

To check it, please refer to the following pages:

  • X-Cart 5.4.x - Look & Feel > Performance

  • X-Cart 5.5.x - Settings > Performance

The first two options allow X-Cart to compound most CSS files into one and most JS files into one. This way, a client's browser will only send a few requests to your server (2-5 requests instead of 50~100) to get all the CSS styles and JS scripts.

NOTE: When X-Cart aggregates CSS and JS files, the result is cached. If you change your JS/CSS files directly in the file system after they have been included in the cache, you will not see the functionality or style changes you have made. To make your changes visible, clear the aggregation cache using the Clear aggregation cache button on that page.

The Use widget cache option enables the internal cache of viewer classes, which is a great way to speed up opening pages with static data, like product or category pages. It allows skipping some calculations if no changes have been made to the content.

NOTE: When X-Cart uses a widgets cache, the static content of product lists is stored in a temporary cache. After editing the content (modifying the product descriptions, titles, or photos), you should clear the widgets cache with the Clear widgets cache button in the Look & Feel > Performance section to make these changes visible in the frontend right away. If you do not clear it, the changes will be updated anyway, which may require more time.

If you have custom mods, you may also consider making some of their widgets cached.

Step 2. Disable Any Unused Add-ons

Every installed and enabled add-on increases the PHP load time, so if you disable all the add-ons you are not using, it will speed up your store. See more info on how to disable an add-on in Add-ons Management.

Step 3. Use CDN for Your Store

CDN does not reduce the time X-Cart scripts take to work, but it delivers images, CSS, and JS files to the client's browser more quickly. Overall, your pages will be rendered faster.

Add-on example:

Step 4. Use Compression

The control panel of your hosting provider may have the option to enable compression of HTML code (for instance, cPanel has the Optimize website option). You should enable it.

If you manage your host yourself, you should enable the zlib compression in PHP. If you are using Apache install mod_deflate (Apache 2.0.x) or mod_gzip (Apache 1.3.x).

Besides, in case all static files are served directly by Nginx on your site, you can enable the gzip compression for static files by specifying additional directives in your nginx configuration file, for example:

# enable gzip compression
gzip on;
gzip_min_length 1100;
gzip_buffers 4 32k;
gzip_types text/plain application/x-javascript application/javascript text/xml text/css;
gzip_vary on;
# end gzip configuration

Step 5. Use a Recent PHP Version (8.0)

We've run many tests to see if X-Cart works better on later PHP versions like PHP 8, and it really does! Typically you can get a two times speedup simply by installing PHP 8.0, supported starting from in X-Cart 5.5.0.x.

For earlier versions of X-Cart, you can use PHP 5.5+ as they are incompatible with PHP 8.

Step 6. Install Native mbstring Extension (PHP)

Though X-Cart has Symfony mbstring polyfill, it works slower than the native extension (especially if the "Send PDF versions of the invoices in the attachment" option is enabled). Installing a native mbstring extension can significantly speed up your store during certain operations.

Related pages:

Did this answer your question?