我的公司正在使用 PrestaShop 1.4.9.0,我们的数据库中有约 170000 个产品,约 3000 个客户,约 5000 个订单。我们同时有大约 50 名访客,但我们预计 future 几周的访客数量会增加 4-8 倍。
您有什么建议可以改善此 PrestaShop 的响应时间?
请您参考如下方法:
检查性能
中的缓存
并将其放入Memcached
(如果尚未)。还可以使用 PHP Profiler
检查性能并根据结果解决任何问题。还有很重要的一点就是函数file_exists
PS validator坚持用 Tools::file_exists_cache
替换 file_exists
/**
* file_exists() wrapper with cache to speedup performance
*
* @param string $filename File name
* @return boolean Cached result of file_exists($filename)
*/
protected static $file_exists_cache = array();
public static function file_exists_cache($filename)
{
if (!isset(self::$file_exists_cache[$filename]))
self::$file_exists_cache[$filename] = file_exists($filename);
return self::$file_exists_cache[$filename];
}
此代码来自PS1.6,应添加到classes/Tools.php
中的Tools
类中,如果您发现该方法已经存在,只需替换它即可
不管怎样,Profiler是解决此类问题的关键 我个人使用PHPed Profiler
(商业)