Tutorial to optimize the performance of Prestashop stores [Nivel intermedio]

(Votes: 84 Average: 4.9)
Published On: 16 de November de 2021Categories: Prestashop, Tutorials

In this intermediate level tutorial, you will learn how to optimize Prestashop stores to increase and improve the performance and loading speed of the site. We will use the Prestashop cache and the server. We will learn basic notions to choose a good web Hosting plan and knowledge to correctly configure the Back-office.

Table of Contents
1. A little introduction about Prestashop and the importance of a good web optimization
2. What are the main elements to take into account to perform the optimization in Prestashop stores?
2.1 Server (Web Hosting)
2.1.1 Choosing the best and most suitable web server for use with Prestashop platforms
2.1.2 The most important server parameters and resources
2.2 Database
2.3 Prestashop platform
2.4 Web images

1. A little introduction about Prestashop and the importance of a good web optimization

Prestashop is one of the most used e-commerce platforms worldwide, and especially at the European level. More and more online stores are developed under this platform, becoming very successful in sales, visits and popularity.

The Prestashop platform stands out for its versatility, ease of use and customization, as well as being endowed with one of the best communities in its official forum for solving problems, advice and help, etc …

We also have to highlight the availability of hundreds of free and paid addons (modules) to expand and improve the functionality of the platform so that your online store meets all the requirements you need for your business.

After several years of experience as official developers of this platform and providing technical support service to customers who have Prestashop online stores, we have verified that very few have their online stores moderately optimized.

It is very important that an online store is optimized as much as possible. This translates into a substantial improvement in web performance, increased loading speed and a notable improvement in the user experience (UX and UI). At the same time, we managed to increase the value of the main metrics, and consequently, we improved SEO. In addition, and very importantly, we will avoid economic losses in sales due to failures and errors from bad or no web optimization.

After this short introduction, which we consider necessary, we are now going to get into the matter.

2. What are the main elements to take into account to perform the optimization in Prestashop stores?

In this tutorial we are going to focus on the explanation of the following web parts that directly intervene in the optimization process:

  • Server (Web Hosting)
  • Database
  • Prestashop platform
  • Web images

2.1 Server (Web Hosting)

The server is one of the most important and crucial elements to ensure the proper functioning and optimization of a Prestashop online store.

As you know, A server is basically a computer (there are from small towers whose use is domestic to large consoles with dozens of racks within complex infrastructures and under strict management and security protocols) Where all the files that make up the online store are stored, its database and all the elements necessary for the interpretation of the server-side language used by the web platform (PHP and MySQL). It is in charge of processing browser requests, making inquiries to the database, interpreting the source code of the platform to return all that information requested to the web browser.

The browser will be in charge of showing the user all that information received by the server in a graphic and visual way so that he can interact on the website.

Having said all the above, we can deduce that the better the quality of the server and the availability of its resources, the higher its speed in processing data and requests, and therefore, the higher its performance. This translates into high web loading speeds, speed in displaying information on the client side, and agility in processing queries to the database. In short, higher server performance generates better SEO results, minimizes the occurrence of errors, improves the user experience and increases customer confidence and online sales.

2.1.1 Choosing the best and most suitable web server for use with Prestashop platforms

We have seen that on numerous occasions, Prestashop online store owners, due to ignorance, tend to hire web servers that are not suitable for use with Prestashop online stores. They tend to fall into the error of hiring web hosting plans from providers that are well known because they invest a lot of capital in marketing and offer hosting services at very low prices. However, these hosting providers do not offer quality servers or optimized for use with online stores that require high resources.

Many of these servers coming from these providers, have few resources, are very limited and for reasons of internal guidelines, they cannot adapt the limits of these resources to each client.

If you are starting in the world of e-commerce, it is possible that at the moment you will not find problems hiring this type of servers. However, as your online store grows, increases its daily visits or you need the installation of a powerful addon (module) that requires server resources, you will start to have serious problems. Even your online store could be inoperative on many occasions due to exceeding limits on the use of server resources.

Next we are going to give you the guidelines and the necessary knowledge so that you can choose the best web server for your Prestashop online store.

Web server type

There are several types of web servers that are served as web hosting plans. The most used are the following:

  • Shared Server (shared web hosting)
  • VPS Server (Virtual Private Server)
  • Dedicated server
  • Cloud Server

These servers are called LAMP Servers (Linux – Apache – MySQL / MariaDB – PHP) because they are based on the use of the most widely used software and languages that are specific for managing websites.

  • Linux operating system
  • Apache server
  • MySQL / MariaDB database server
  • PHP language interpreter

Regarding this topic, we have an article that we published previously, and that explains in much more detail each of these types of web servers. You can visit this article at the following link:

How to choose the best web hosting server for Prestashop online stores

As we explained in the article, if we want our Prestashop online store to work correctly and have a high increase in performance, we will have to hire a VPS or Dedicated web hosting plan , and that this hosting plan allows us to configure the server parameters without restrictions . So we should ask our hosting provider for any restrictions or limitations they may have.

We do not recommend at all the use of shared servers for Prestashop online stores

2.1.2 The most important server parameters and resources

When choosing a web server and configuring its parameters to optimize it for Prestashop stores, we must pay close attention to the following elements:

  • Processor (CPU)
  • Disc type and capacity
  • RAM
  • Traffic limit
  • Apache configuration
  • PHP parameters
Processor (CPU)

CPU processorThe processor is the brain of the server. He is in charge of carrying out all the processes. Its saturation is the first indication that it has reached its limit and cannot continue processing until it is relieved of its workload. For that reason, the better and more powerful the processor, the faster it will process and will not crash easily.

When a CPU reaches more than 90% usage, the server becomes overloaded, slows down, and the loading speed of the online store is greatly reduced. This situation causes the website to load endlessly without showing its elements to the user.

In this sense , we recommend hiring servers with CPUs from 4 cores (4 Core) and with clock speeds of more than 2.0 GHz.

Disk type and capacity

Currently there are two types of disks for data storage: HDD and SSD .

HDD storage disk

The HDD disk is a series of disks that rotate and their data is read and extracted by your reader device. Therefore, the read and write speed is slower than SSD drives.

SSD storage disk

SSD storage disk

SSD (Solid State Disk), compared to HDD (Hard Disk Drive), is much faster. This is because the SSD is a solid disk based on a chip where the data is stored. It is similar to memory sticks.

 

The use of servers with SSD disks is recommended to increase the speed of reading and writing data. This translates into higher performance and loading speed of the online store.

RAM MEMORY

RAMRAM (Random Access Memory) is responsible for storing the data of the processes that are running on the server in real time. So to speak, it is the right hand of the CPU and is in charge of storing the necessary data that the CPU needs during the calculation of the processes. Translated to the server, it is in charge of storing the data of the processes that are executed when the web browser requests the information from the server. When the size of the processes exceeds the value of RAM, it crashes and has the same effect as when a CPU crashes. The user could experience a considerable increase in the loading time of the web page, even to the point that the web browser is blocked trying to load the elements of the site.

In web servers, there is an element called SWAP Memory , and whose objective is to use the server’s hard disk to store these processes and thus not collapse the RAM memory. However, the bypass and swap process is slower than if RAM were physically used to store the processes. If you have contracted a VPS or dedicated web server with a high RAM memory value, we recommend disabling the use of SWAP memory.

Traffic limit

When a user visits a website, as we have explained above, there is a request to the server and a response from it. During this process data is exchanged, and this data has a size.

Web hosting providers usually put monthly traffic limits on their hosting plans. This happens especially when the hosting plan is shared or they are very cheap plans. The monthly traffic limit is the limit of the total value of the sum of all the data transferred between the server and the web browser during a month.

In the event that there is a monthly traffic limit, when the maximum limit is reached, the server will stop processing requests and from that moment the online store is completely inoperative.

It is very important NOT to hire web hosting plans that have a monthly traffic limit.

Apache configuration

Apache is software for web servers (based on the Linux Operating System) that controls the HTTP (Hypertext Transfer Protocol) in requests from the web browser to the server. It is responsible for returning the requested information through this HTTP protocol.

It is very important to pay attention to the optimization of your configuration to be able to take advantage of all the server resources and thus increase the performance of the online store.

The servers that use Apache have a very important file called .htaccess which is the file in charge of storing the Apache configuration. This file is located in the root directory of the Prestashop store . By inserting code inside it, we can do important things such as the use of the server and browser cache, increase web security, deny access to certain IPs, protect directories, use redirects, etc …

To be able to edit this file, advanced knowledge is required, otherwise, an error in the code could cause a 500 server error that would render the online store completely inoperative.

We have put together a specific article that explains in detail how to edit and optimize the .htaccess file with advanced parameters.

How to edit and optimize the .htaccess file

In addition, we have developed the Advanced Editor Htaccess module, which is specific to edit the .htaccess file of Prestashop online stores easily and quickly with a syntax editor. It also includes an option to increase the performance of the store and the use of the site cache.

You can buy it right now from the official Prestashop Addons page, at the following link:

Buy the Advanced Editor Htaccess module
PHP parameters

The web servers have PHP language interpreter software installed , since this is the language used by the vast majority of websites. As with the rest of the components mentioned above, this one can also configure its parameters in order to optimize and increase the performance of the website.

The configuration of the PHP parameters is really one of the most important and decisive parts when it comes to ensuring a good functioning of the web server and avoiding errors or server crashes.

When we hire a shared web hosting, it usually has many limitations when configuring the PHP parameters. In addition, the values of its parameters are usually very low, so they usually cause problems if it is intended to be used with Prestashop online stores. For that reason, we have mentioned that we do not recommend the use of shared web hosting for online stores .

There are many PHP parameters that can be configured. However, we are going to mention the most important ones to take into account:

  • max_execution_time: Sets the maximum time in seconds that a script can run before it ends. The default is usually 30 seconds.
  • max_input_time: Sets the maximum time in seconds that a script can parse input data, such as POST and GET. This is generally increased to allow for large file uploads.
  • memory_limit: It establishes the maximum memory limit that must be used for the processes. Websites that perform long or heavy processes will need a high memory limit value. Depending on the amount of RAM memory available on the server, the value can be increased in proportion.
  • max_post_size: Sets the maximum size allowed for POST requests.
  • max_upload_size: Sets the maximum size allowed for uploading files to the server. For example, from the contact form on the website.
  • max_input_vars: Sets the maximum limit of variables that can be accepted during requests to the server. In the case of online stores, a low value of this parameter can cause problems when displaying translations.
  • allow_url_fopen: This option enables URL type fopen wrappers that allow access to URL objects such as files. The default wrappers are provided for remote file access using the ftp or http protocols. We recommend having this option activated, since there are modules and addons that need to connect with external URLs to carry out their processes.

You can get more information about these parameters in the PHP manual .

We can configure these parameters in several ways:

  • .Htaccess file
  • Php.ini file
  • .User.ini file
  • Through the hosting control panel

For the proper functioning of a Prestashop online store, these parameters should have the following values:

Copy to Clipboard

These values are valid for a Prestashop online store hosted on a server with a normal level of resources and with a RAM memory value from 2GB

Web server for Prestashop. Web hosting optimized for Prestashop and WordPress online stores. High performance web server. Optimized hosting.

Do you want to hire the best server for your Prestashop store?

At Liewebs we offer all our clients high-performance servers optimized for use with the Prestashop and WordPress platforms. Unlimited configuration, with scalable and fully customized web hosting plans for each client.

Hire the best web hosting plan!

2.2 Database

The Prestashop database is made up of tables that are related to each other by associating ID numbers between their elements and columns. These tables are where all the records and data of the online store are stored (orders, customers, addresses, products, categories, etc …). This element is still a file system where data is recorded and stored occupying a certain space.

The databases are managed by database managers (database servers) such as MariaDB and MySQL among others.

During the operational life of the website, the database is in constant use. With each visit to the website, queries are made to view the stored data and show it to the user. In addition, the content is modified, added or eliminated, depending on the tasks carried out in the online store. These processes leave residues or deteriorate the structure of the tables, causing referential integrity errors, obsolete records, fragmented data, etc … Therefore, it could cause a decrease in web performance, even important incidents, in some cases leaving completely the website is inoperative.

For this reason, it is very important to perform regular database maintenance in order to repair, optimize, and clean the tables.

Next, we are going to explain the different parts where more attention needs to be paid when optimizing the database.

Database server configuration

The Database server is a type of server software that allows the organization of information through the use of tables, indexes, and records. It is in charge of managing the queries and access to the information stored in the database tables and the processing and administration of the content.

There are several types of database servers. We show you the best known:

Actually, the most used by web servers are MySQL and MariaDB.

Database servers. MariaDB. MySQL. Database managers.

The first step to be able to optimize the database server is to always have the latest version installed on your server.

It is possible to modify the parameters of these database servers to optimize their performance and thus improve the speed of sending and response in the processing of queries. Thus, the loading speed of the website is noticeably improved.

The parameters can be modified within the specific files for the configuration of these servers. Depending on the server’s operating system, this file may be different. However, the most used is called my.cnf and is usually located in the directory etc / my.cnf

In order to modify it you would need to have access to the server’s file directory.

If you have contracted a shared web hosting plan, you will not have access to this file and you will not be able to ask the hosting provider to configure the files with the values you want.

Next, we show you the instructions to be able to modify the parameters correctly within the my.cnf file:

Instructions for configuring the MariaDB server

Instructions for configuring the MySQL server

Only users with advanced knowledge of mySQL should configure this file, otherwise, if invalid code or values are inserted, the Database server will not be able to start and the website will be inoperative.

On the official Prestashop page, they have published a very interesting article (in Spanish) on how to optimize the parameters of the Database server:

How to optimize PrestaShop 1.7 Database to improve performance?
Cleaning, optimization and repair of the Database tables

For this type of task it is recommended to use modules or software to be able to carry out all these operations automatically and to be able to analyze the state of the database before taking any action.

However, some operations can be carried out manually, their use being very limited. These operations are executed by inserting SQL code queries through database administrators such as phpMyAdmin

Clean dynamic tables

This action is based on removing the data from the dynamic tables of Prestashop. Dynamic tables are tables where data is stored for statistical use, metrics, etc … whose content is not essential for the operation of the online store (visits, connections, logs …). These tables are often filled with logs on a daily basis, becoming considerably large if they are not cleaned frequently.

The Prestashop dynamic tables are:

  • ps_connections
  • ps_connections_source
  • ps_connections_page
  • ps_guest
  • ps_log
  • ps_modules_perfs
  • ps_pagenotfound
  • ps_referrer_cache
  • ps_page_viewed
  • ps_smarty_cache
  • ps_smarty_last_flush
  • ps_smarty_lazy_cache
  • ps_statssearch

To clean these tables we can use the following query:

TRUNCATE TABLE [nombre de la tabla]

What this query does is completely delete all the records from the table, leaving it completely empty.

Practical example:

Copy to Clipboard
Optimize and repair tables

In order to optimize and repair the database tables, a module or software specially designed for this type of process must be used. In order to repair a table that contains referential integrity errors, it is necessary to execute a series of complex processes using SQL. These processes, in their entirety, cannot be executed manually due to their complexity. However, only part of these processes can be done manually using a simple SQL query:

Rearrange the storage structure of the table:

OPTIMIZE TABLE [nombre de la tabla]

Repair a corrupt table (Only in tables with the MyISAM engine):

REPAIR TABLE [nombre de la tabla]

Practical example:

Copy to Clipboard

As we have indicated before, these queries only solve a part of the optimization and repair process of the tables. Therefore, in order to solve referential integrity errors, defragment fragmented data, delete records with invalid values, etc … it will be necessary to do so through a specific module or software.

In that case, we recommend a Prestashop module that we have developed to optimize, repair, clean and carry out periodic maintenance of the Prestashop stores database. The ULTIMATE DATABASE OPTIMIZER module.

The module has an advanced graphical interface to be able to carry out all the actions from a control panel in detail. In addition, it has everything you need to keep your database 100% optimized and repaired.

Module Ultimate Database Optimizer. Expert Prestashop developers. Prestashop Specialists

ULTIMATE DATABASE OPTIMIZER MODULE

Monitor, optimize, repair, defragment and clean the tables. Increase the performance and speed of the web and fix database errors. Advanced functions for comprehensive and periodic maintenance of the database.

Buy Ultimate Database Optimizer module

2.3 Prestashop platform

If we want our Prestashop store to work to the best of its ability, we have to pay close attention to the configuration options that are available in the “Performance” section of the administration panel (Back-office).

Below we will explain each of these options and their recommended choice:

Setting
Smarty

This section shows the options related to the Prestashop template engine.

Build templates

It tells the Prestashop system when to recompile the template files (.tpl extension) to save them in the cache again. If the template files are not recompiled, any changes or modifications made will not be visible. This is because the previously compiled and cached files are still displayed to the web user.

  • Never recompile template files: Template files are not recompiled. This option is recommended if the store is in production and no visual changes will be made at the template file level. It is the option that provides the best performance to the store, improving the loading speed of the site.
  • Recompile templates when files are modified: The system only recompiles template files if it detects that their content has been modified. We recommend this option if you make modifications to the template files from time to time.
  • Force compilation: The system compiles the template files every time the content is displayed to the web user. Significantly reduces the performance of the store. This option is only recommended to have it activated while maintenance, development or major modifications are being carried out on the website.

Cache

This option controls the use of cache files for the content that is displayed in the frontend and queries to the database. It is very important that this option is activated, otherwise you will experience a large decrease in website performance. Disabling it is only recommended for debugging tasks.

Multi-server synchronization

Having several servers to host an online store and thus distribute its load, is a practice used by online stores that have a large volume of products and receive thousands of daily visits (Websites such as Amazon, Ebay, Aliexpress, etc. .).

This option synchronizes the servers where the Prestashop store is hosted to serve the cache files. It should only be activated if you have the store hosted on several servers connected to each other.

Cache type

We have two options:

  • File system: Use the cache through files with the data saved within the store directory.
  • MySQL: Uses the cache through the data stored within specific cache tables in the database.

The fastest and most performance-enhancing option is to choose “File System” . The explanation is that reading the data through queries to the database is an operation that requires more time and consumes more server resources.

Clear cache

The option Clear the cache whenever something has been modified” must be checked so that the system will delete the cache whenever it detects that something has been modified within the content of its files.

Debug mode

This section should only be used for error checking and debugging, as debug mode slows down the loading of store items and displays existing error messages on the frontend. For this reason it is very important to have all your options disabled while the store is in production.

If you have to activate any of these options to debug errors, the store must first be in maintenance mode, otherwise, web users could experience problems and errors while browsing the website.

Optional features

There are certain Prestashop features that can be disabled if they are not being used. In this way, the performance of the store is improved by not having to load these elements.

For example, the use of combinations of products in the store increases the number of queries to be made to the database and therefore increases the response time of the server and the load time of the site. In this case, if the store is not using product combinations, this option can be disabled.

Only deactivate the options that are not being used.

CCC (Combination, Compression and Cache)

This section configures some of the most important options to improve site performance. CCC (Combination, Compression and Cache).

  • “Smart cache” for style sheets (CSS): This option unifies all style sheets with CSS code coming from modules, templates and custom codes and compresses them into a single file to reduce their weight and increase the reading speed of your content.
  • “Smart cache” for JavaScript code: This option unifies all the Javascript codes from modules, templates and custom codes and compresses them into a single file to reduce their weight and increase the reading speed of their content.
  • Apache optimization: Prestashop inserts advanced code in the .htaccess file located in the store directory, to make use of the browser and server cache and compression of the website content through Gzip and Deflate.

We recommend that all these options are activated and only deactivated for debugging or during the development phases of the online store.

Media servers (use only with CCC enabled)

One of the techniques that most improves the performance of the site is to distribute the load of some elements of the web in different servers (CDN servers must be used). This translates into placing elements such as images, templates, and modules on other servers. In this way, when a user visits the store, the browser requests from each of these servers the information they have hosted. This means that the load is not assumed by a single server, but each one assumes the load of its elements.

By configuring this option, the increase in performance and the increase in the loading speed of the web is extraordinary. However, the process of setting up and creating these servers is not straightforward, and if not done correctly, there will be visual problems while loading the site.

We leave you more information on how to configure these options:

Prestashop documentation
Cache

Prestashop caching system

In this section you configure the use of the cache of the server itself where the Prestashop online store is hosted. Unlike the first section “Smarty”, this type of cache is not from Prestashop, but as we have just indicated, it is from the server itself. Therefore, several aspects must be taken into account before proceeding to activate some of these options:

  • The corresponding cache extension must be installed on the server before activating the desired cache system.
  • If the content of the website is constantly changing, new products, images are inserted, or maintenance work is carried out frequently, the use of cache should be disabled and the cache on the server must be cleared (It is not the same as cleaning the Prestashop cache). Otherwise, there may be problems displaying the changes made until the server cache is cleared.

After our experience, we recommend the use of the APC or Xcache cache system because when activating Memcached we have encountered some problems related to the display of web elements and during the processes of adding products to the cart.

To install the cache system extensions on the server, you should check with your hosting provider. In shared hosting plans, it is very likely that they will not allow you to install these extensions.

Prestashop modules

As you already know by now, the Prestashop platform comes with the basic functionalities to be able to operate an online store. However, if you need to extend, add or customize functionalities, these must be done by installing modules / addons.

Installing a module means adding more elements to the online store and increasing the server workload. There are modules that are lightweight and do not cause a large decrease in site performance. However, there are other modules that, due to their code architecture or their functionalities, require a lot of server resources. So in that case, the performance decrease could be noticeable if you don’t have a good server with high resources.

On the other hand, there are also aspects to take into account such as the quality of the module’s code, the use of updated versions, the good reputation of the developers of that module, etc …

In this sense, we give you the following recommendations:

  • Install only official modules from the Prestashop Addons platform (before being published, each module goes through a verification and quality control process to comply with the standards of the official platform).
  • Always keep the module updated to the latest version.
  • Install ONLY the modules that are essential for the operation of the store, complying with the desired requirements.
  • Uninstall or deactivate the rest of the modules that are not being used.
  • Make use of modules that improve the performance of the website, use of cache, optimize the Database, etc … (Be careful when installing modules that improve the use of cache, since some cause visual problems and many incompatibilities with other modules and functionalities of some themes).
Recommended modules that you should have in your Prestashop store

Below we propose a list of modules that we consider to be essential when setting up an online store:

Prestashop update

The Prestashop platform is constantly growing and developing. New versions are released frequently with additional functions, bug fixes, enhancements, etc.

To maintain good performance in the online store and avoid errors, it is very important to always keep the version of your Prestashop online store updated.

To perform the Prestashop version update tasks automatically, the platform has made available to users a specific module called 1-Click Upgrade . This module is ideal for when you need to update minor versions of the platform (example from 1.7.1.1 to 1.7.1.2 or 1.7.2). However, being an automated task, there is the possibility that an error will occur that paralyzes the process and the store is damaged and inoperative.

Therefore, we recommend its use whenever a minor update is intended, the web server is high-performance and has sufficient resources to cope with this process, and the store is not excessively large with a heavy database.

If you need to carry out a major update, for example update your store from Prestashop version 1.6 to 1.7, then you must carry out a manual update, migrating the database tables one by one, adapting it to the new platform.

This process is quite complicated and is only available to Prestashop experts. You can contract this service with us:

Hire the Prestashop update and migration service
Themes (Templates)

Make use of a professional theme and updated to the latest version, determines to a greater extent that your store works well and has a good performance. In addition, this is decisive for SEO, because a template with a good structure complying with the guidelines of the main search engines such as Google, Bing, etc … will significantly improve SEO.

In this case, we only recommend using themes from reputable developers who have a professional layout designer such as Elementor , Visual Composer or similar.

Here is a list of sites and themes recommended by us:

2.4 Web images

Images are one of the main elements of a web page or online store. In the case of online stores, each product must contain one or more images. These elements, like the rest, have a certain size. The more size and dimension an image has, the more workload it generates for the server to be able to process these elements, therefore, the longer the load time will be.

It is very important to optimize the images to be used on the website. For this task there are specific software, web applications or modules.

We have created an article on optimizing web images. You can visit it for more information:

How to optimize the images of your WordPress website or Prestashop online store

And so far this tutorial to learn how to improve the performance of your Prestashop online store. We hope it has been useful for your learning.

If you liked the article, you can rate it by pressing this button

Do you need to optimize your Prestashop online store to increase the performance of your website, increase visits, SEO and increase sales?

 

At Liewebs we offer you a service to optimize Prestashop stores. We guarantee an increase in performance and speed on the website. Improved scores for metrics tools and SEO.

 

Ask us for more information

Artículos relacionados

Échale un vistazo a estos otros artículos relacionados