Jump to content

How to speed up Prestashop 1.5.2?


diedm

Recommended Posts

I'm experiencing a big issue about speed of prestashop 1.5.2.

The average time of each page is about 3/4 seconds.

Recently I've changed hosting provider and I don't know if the problem is related to the moving.

I used the standard procedure reccomended in the documentation to move to the new provider.

So, for the moment my shop is only a catalog, without any shopping feature active, but my customer will ask to activate the shopping on line very soon.

 

My provider doesn't give possibility to use memcache or other cache system, and seems that fscache doesn't give results expected.

 

I thing that the main issue is related to DB, but I don't know how to analyze this.

 

Meanwhile I adopted this workround that really speed everything.

 

In index.php page (root) before this statement

 

require(dirname(__FILE__).'/config/config.inc.php');

 

I added this lines:

 

 

$cachefile = './cache2/'.basename($_SERVER['REQUEST_URI']);
$cachefilecontrol = './cache2/control';
//Serve from the cache if it is younger than $cachetime
if (file_exists($cachefile) && (filemtime($cachefilecontrol) < filemtime($cachefile))) {
include($cachefile);
echo "<!-- Cached ".date('jS F Y H:i', filemtime($cachefile))." -->";
exit;
}
ob_start(); // start the output buffer

 

and after this line:

 

Dispatcher::getInstance()->dispatch();

 

I added this lines:

 

$fp = fopen($cachefile, 'w'); // open the cache file for writing
fwrite($fp, ob_get_contents()); // save the contents of output buffer to the file
fclose($fp); // close the file
ob_end_flush(); // Send the output to the browser

 

The first time that a page is requested, the script create a static serialized page in the folder "cache2" (new folder created in root folder) whereas in the subsequent request the script verify if the file already exist and serve it directly form the folder "cache2".

You have to manually create a simple file (without extension) named "control" in "cache2" folder.

This file is used by the script to verify when you have made last modification to the site.

 

Every time that you change something in the catalog you have to "touch" "control" file otherwise new version of the cache file don't be created.

 

This script is very useful if you use Prestashop only as catalog and You change your catalog very rarely but will be unusable when I will activate the shopping cart and other features for shopping online.

 

Have You any suggestions on how to speed up Prestashop?

I have already applied all suggestion from the guide and disabled all unecessary modules.

 

Thanks for suggestion

 

Diedm

Link to comment
Share on other sites

  • 2 weeks later...

Well, you can always optimize your webserver itself. Optimizing my webserver (apache2) gave me 20% speed improvement. I assume you are using apache2 as your webserver.

 

Some links: (or you can google)

 

http://www.ibm.com/developerworks/linux/library/l-tune-lamp-2/index.html

 

http://serverfault.com/questions/231904/how-can-i-optimize-apache-to-use-1gb-of-ram-on-my-website

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...