Increase Prestashop performance


First of all you have to move your shop from shared hosting to VPS or dedicate server. Here you can read how to run Prestashop with docker. With this setup (own server) you can modify many things.

One of this thing is to setup Redis as a Php session handler. Store and manage data in memory is signified faster then on hard drive (even if it’s SSD).

Run Redis

One of the easiest way to run Redis is to use docker image. Just run a command:

docker run -d -p 6379:6379 redis

If you prefer install and run Redis on your local machine, refer to the documentation.

Php session handler

To tell Php to use Redis instead of regular files as session handler you have to add those lines to your php.ini file:

session.save_handler = redis
session.save_path = "tcp://${REDIS_HOST}:6379?auth=${REDIS_HOST_PASSWORD}"

With this setup it will works but you can get other issues with session. Redis session handler does not locking sessions by default. This causes a race condition problem. To prevent an issue add next lines to php.ini:

redis.session.locking_enabled = 1
redis.session.lock_retries = -1
redis.session.lock_wait_time = 10000

Now just restart you server (if using apache) just php-fpm and you’re done.

Easy way to use this feature is to run this stock.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.