Jump to content

Disabling APC and using memcached


Recommended Posts

I want to remove the APC caching from prestashop 1.6.0.14 in favour of memcached and APC will be removed from the stack, just wondered if anyone had any information on how this is achieved, also if anyone has done similarly and experienced any issues doing this?

 

Link to comment
Share on other sites

Which php-version are you using ? 5.1 ?? I never heard in all my experience years that APC is not compatible with a specific php-version. If you are using php 5.3 onwards APC is the best cache choice.

 

memcache: why you don't should use: it covers only a part of cache, this means not all is cached, besides this cache adds several folders to your webspace, by exploding your disk space unnecessary. The other big problem is that some modules and features do not work with this cache option and make troubles (install, deinstall, configuration not working how it should be).

 

As expert I suggest you to don't replace APC if you are using php version over 5.3+. For php 5.2. I have the same experience. APC or xCache are better in speed - and I suppose you are trying to get speed.

 

The only reason why your provider is telling you this, is a) that his server is not well configured, b ) very old hardware or to c ) separate object cache from script cache for high load servers, when data and scripts are on two different servers. If I where you I will take into consideration to change the provider using up-to-date techniques.

If you change provider, you should ask for fast-cgi + opcode cache which is the state of the art and better as all php cache modules (memcache, APC or xCache). But this technique is suitable for modern fast servers and php 5.4/5.5. Better than this fo caching is to additionally use ngnix, so fast-cgi + opcache + nginx. There is no better cache and speed at the moment available.

 

Anyway: for to change the cache mode on Prestashop back-office you go to tab: "advanced parameters -> performance" and on the last option you can change the cache modus. For to change the cache module should be installed on your server, otherwise Prestashop gives you a warning by saying that it is not installed.

And at least: don't update your Prestashop version to 1.6.1. if you stay on this provider. You will have several troubles with caching system, as the latest PS version needs the opcache configured on your server (native in php versions over 5.4/5.5.) for to work without any problems. And here APC and other are than superfluous, this means the option cache should be disabled at all, as not supported anymore.

Edited by selectshop.at (see edit history)
  • Like 1
Link to comment
Share on other sites

I just noticed you mentioned something about the cache module not working correctly on 1.6.1.1  I have tried several times to setup memcache and keep getting the warning at the top: "To use Memcached, you must install the Memcache PECL extension on your server. http://www.php.net/manual/en/memcache.installation.php"  I have confirmed with my host that it is installed and they are saying it is the software (which I am very inclined to believe). Any other options for caching?  I was using the Express Cache module for a while and then stopped.

 

The issue seems to be with that piece of software as memcache is installed.

root@server1 [~]# pecl install memcache
pecl/memcache is already installed and is the same as the released version 2.2.7

Link to comment
Share on other sites

I just noticed you mentioned something about the cache module not working correctly on 1.6.1.1  I have tried several times to setup memcache and keep getting the warning at the top: "To use Memcached, you must install the Memcache PECL extension on your server. http://www.php.net/manual/en/memcache.installation.php"  I have confirmed with my host that it is installed and they are saying it is the software (which I am very inclined to believe). Any other options for caching?  I was using the Express Cache module for a while and then stopped.

 

The issue seems to be with that piece of software as memcache is installed.

 

root@server1 [~]# pecl install memcache

pecl/memcache is already installed and is the same as the released version 2.2.7

Please read this topic: https://www.prestashop.com/forums/topic/448978-prestashop-1610-a-new-level-of-performances/page-2?do=findComment&comment=2081859, and https://www.prestashop.com/forums/topic/448978-prestashop-1610-a-new-level-of-performances/?do=findComment&comment=2081102

 

Caching modules are not needed anymore if you are using latest php-versions as they support opcache (fastest caching system ever as it is executed on byte, so before anything is executed). You will have no more speed. The only one I didn't yet tested is Varnish, as Prestashop has several problems with it.

 

BTW memcache is not a byte cache like APC xCache, but a data store cache (slow cache). If the same problem with PS 1.6.1. applies to it, I cannot tell you. For several reasons I stopped to use memcache with Prestashop 1.4, as I moved to more modern techniques (fast-cgi + ocache).

Edited by selectshop.at (see edit history)
  • Like 1
Link to comment
Share on other sites

Thank you so much for the reply. I actually have read that article as well as many others by Prestashop but I also use the shop everyday and no it's no where as fast as competitors on the market.  I updated it hoping the newest version would be a lot better and free of bugs but quickly found out it was slower on the front and back-end and has the save button issue from long ago (60 seconds to save a product).  I am trying to find any fix to get the shop working properly before I abandon it completely.  I just found an article online how to improve speed using MySQL rather than the file system and it's changed the speed drastically.  I was hoping I could get a little more speed with the cache mechanism but I guess its listed in performance for no reason now.

 

https://developers.google.com/speed/pagespeed/insights/?url=www.flyclothing.com&tab=desktop

 

Thank you again. :)

Link to comment
Share on other sites

Slow Prestashop = slow server, sorry but I cannot tell you better news on this. Most of the providers do not serve for Prestashop. I personally changed several times to at finally buy a space and install and configure my own server for Prestashop needs. The most servers are configured to serve for all possible software and this is the problem. Prestashop has special needs and a shared server is not really the best for Prestashop.

Link to comment
Share on other sites

Thanks for your reply selectshop, I thought this was weird. basically I contacted them as we keep having an ERR_EMPTY_RESPONSE server not sending data and cannot access front end but back office loads fine, sporadically when we are changing nothing our end, to which the server company has blamed APC caching. We are using 5.3.29 I believe, also we use shared hosting.

 

Any suggestions greatly appreciated as to why this would be happening 

Link to comment
Share on other sites

ERR_EMPTY_RESPONSE - this is a time-out error with no data receive from server. It is a know Chrome browser bug with some networks. Here you find some solutions: https://productforums.google.com/forum/#!topic/chrome/JrKnXhgZiAs

 

And of course you should clear from time to time the browser cache (key F5 on your keyboard), for to avoid spinned cache.

 

If you are having only this error, than of course it is not an server error, but a local caching error. By changing the cache module on server it will not avoid the error, cause it is local and not on server.

Edited by selectshop.at (see edit history)
  • Like 1
Link to comment
Share on other sites

Have disabled APC etc and then have this error

 

[Mon Oct 12 10:29:03 2015] [error] [client 37.187.137.225] PHP Fatal error: Call to undefined function apc_cache_info() in /home/mbarwise/public_html/classes/cache/CacheApc.php on line 37

 

any idea how to stop this error? is it just a case of clearing out following folders?

\cache\smarty\compile

prestashop\cache\smarty\cache
prestashop\themes\yours\cache

  • Like 1
Link to comment
Share on other sites

In /config/settings.inc.php you should have the following lines: (if not available, than someone already manipulated manually this file and it is wrong manipulated).

define('_PS_CACHING_SYSTEM_', 'CacheXcache');    OR APC if you are using APC before
define('_PS_CACHE_ENABLED_', '1');

you should change that files to:

define('_PS_CACHING_SYSTEM_', '');
define('_PS_CACHE_ENABLED_', '0');
Edited by selectshop.at (see edit history)
  • Like 1
Link to comment
Share on other sites

Well something strange going on on your shop. If you had APC activated before than there should be APC and not CacheMemcache. and 0 is the value for off (1 for on).

 

The best is not to make manual changes on files or database at any way, to avoid wrong settings.

from what I remember there is no reference to the cache system on database, but if there is one it should be on table ps_configuration. I cannot check for you cause I'm not in the office at the moment.

Edited by selectshop.at (see edit history)
Link to comment
Share on other sites

The URL of your page is ? Debug modus is turned on ?

 

Turn on debug: https://www.prestashop.com/forums/topic/224525-how-to-turn-on-error-reporting-for-debug-information-blank-page-500-internal-server-error/

 

As I told you, I'm sure there is no reference to the cache system in database, only for smarty cache, which is not the same.

Edited by selectshop.at (see edit history)
Link to comment
Share on other sites

As I told you, there is no reference to cache on database. You cannot turn it of there. I've checked, since I'm now in the office.

 

It will be also make not any sense, cause the cache we are talking about it is a scripting cache, so a byte cache.

Are you having errors ? If yes, please write them here in order we can verify for you.

 

If you turned to memcache, so you will have many folders now on /cache/cachefs. This folders you can delete if you will not use the memcache too.

 

Please also check if your cache is setting correctly: Tab "advanced parameters -> performance -> caching type -> file system  YES. The option SQL should be not activated if you are not using php versions over and incl. 5.4./5.5. and actual SQL versions (5.5). For older php versions and SQL versions the setting SQL cache is useless and could run into several server problems.

Edited by selectshop.at (see edit history)
Link to comment
Share on other sites

Hi!

 

I disagree with you there!

 

 

Firstly, there are two sets of this cache, one is memcache and whoever he's talking about is memcached note (d). it is updated and patched specifically for prestashop, and I use it myself in my store, and it works just fine. So I recommend this memcached.

 

Regards

MacRoy

Link to comment
Share on other sites

Hi Mac Roy, as I told before, all depends from the php-version you are using. And come one, memcache is a very old technique, which of course do not cover well caching. BTW we are talking about two complete different cache functionalities. One is opcode cache and byte based (APC) and the memcache caches DB objects and stores them in RAM.

 

My shop is a really big one (about 10.000 products and 300 filter options with several combinations). I never got more speed by using memcache, so the one for DB objects). Faster was APC.

Now I'm usgin php 5.6. and opcode + fast-cgi + nginx, with this I've got the fastest possibility (without APC or any other cache module). Also by using cloud so parts running on other servers it is not faster.

 

APC is faster cause it is executed before. APC caches chunks of PHP code and stores it in RAM. Then when you need to run that same piece of code again it's already cached and runs from memory lightning faster.

 

EDIT: please see also the contribution of Prestashop developers: https://www.prestashop.com/blog/en/your-prestashop-store-is-twice-as-fast-with-zend-opcache/

Edited by selectshop.at (see edit history)
Link to comment
Share on other sites

You can get Prestashop actually pretty fast if the right server and configuration. If it's extremely slow, it's first of all an issue with the server performance, than with Prestashop. 

 

Some facts:

 

* Using memcache with Prestashop is NOT faster than using it without a cache. 

* Prestashop 1.6.1 has speed improvements and that's the one you should upgrade to asap. 

* The APC setting in Prestashop has NOTHING to do with opcode caching, like some mention here! Prestashop only cares about data caching, not code. 

* PHP 5.3 is extremely outdated and not supported anymore. If your provider still is on it, it's huge time to change provider as a lot other software obviously must be outdated, maybe not even upgraded with very important security fixes.

* PHP 5.5 will bring you a huge speed improvement over older versions.

* Some (bad) PHP configurations could cleanup the cached instances again, so APC caches would be then useless, still the overhead applying though.

 

I have settled on many stores of my customers using them finally WITHOUT any so-calling user cache like APC (or APCu when using the Zend OpCache) alltogether, only with the opcode cache of the newer PHP versions. Why? Because it ends to run better this way. Also,at times there having been caching issues reported from customers not seeing their most updated data in the backend, turning it off has solved these reports alltogether. And with a good server configuration this has no penalties on performance.

 

Important is to have a good mysql caching active, this is as good (or even better) than Prestashop's additional caching, because it is natively integrated in the systems Prestashop is using. 

 

Concluding, I'm reaching times of less than 100ms on some servers without using additional caching in Prestashop or caching modules for it. But I have to repeat, that it's first of all the server on which your site runs on that dictates the max. speed Prestashop can reach. Look at this first, before you look on any other solutions, as all other solutions won't do anything more than the server can do. 

Edited by innovacy (see edit history)
Link to comment
Share on other sites

* The APC setting in Prestashop has NOTHING to do with opcode caching, like some mention here! Prestashop only cares about data caching, not code. 

How exactly is APC working ? Of course, APC is an opcode cache. Sorry, but you should refresh your knowledge about.  http://www.inmotionhosting.com/support/website/what-is/speed-up-php-with-apc

 

 

 

 

 

Concluding, I'm reaching times of less than 100ms on some servers without using additional caching in Prestashop or caching modules for it.

 

This depends on the size of the shop and is the same what I said. I'm using fast-cgi + opcache + nginx and have the best speed available technically (on a shop of 10.000 products and 300 filter options with several of combinations, so about 1.000.000 possible request).

Link to comment
Share on other sites

@selectshop The difference is that when you have APC installed on a server it caches the code. When you enable APC in the back of PRestaShop it tries to use APCu. APC and APCu are different, APC caches code to an Opcache, APCu caches database query results on a user level. That is what the setting in the back of PrestaShop does.

 

As for your filtering, you should look into Algolia. We ripped the whole PrestaShop category functionality out of a shop with 60k products and are using Algolia for all of the filtering / category displaying / searching. It is blazingly fast. 

Link to comment
Share on other sites

 

As for your filtering, you should look into Algolia. We ripped the whole PrestaShop category functionality out of a shop with 60k products and are using Algolia for all of the filtering / category displaying / searching. It is blazingly fast. 

Thanks for info, I'm using another one: http://www.presteamshop.com/es/modulos-prestashop/filter-products-pro.html - Fast and flexible. The native Prestashop module one has several problems with performance.

 

For APC or not: all is said. I don't use it anymore, cause fast-cgi + opcode + nginx is the state of the art for speed, and of course a well configured server (dedicated or VPS on a load balanced network).

Edited by selectshop.at (see edit history)
Link to comment
Share on other sites

How exactly is APC working ? Of course, APC is an opcode cache. Sorry, but you should refresh your knowledge about.  http://www.inmotionhosting.com/support/website/what-is/speed-up-php-with-apc

 

 

No need to refresh anything. I know that APC can be an opcode cache too, but that is not what the setting in Prestashop turns on or off. That's what I said. It is only related to data caching. 

Link to comment
Share on other sites

The german site is a fast site no doubt. What have you done to optimize it? 

 

It's magic powers! Haha, no, joking.

 

It's Prestashop with no additional modules for page caching or such. The speed comes from a good server configuration, part of which is to make sure mysql runs perfectly for Prestashop and some on-site optimizations to make it also feel faster. As example, product images on categories are requested after the site loaded, making sure that especially on long category pages it feels much faster, as images are only loaded as required when scrolling (which of course also avoids hammering the server simultaneously with lots requests). Then of course, some settings in .htaccess for better browser caching of resources and some other things. 

 

It's a play of a lot of factors all together. 

 

We optimized it a lot when we had a groupon campaign last year and thousands of users called it simultaneously... poor servers!!!

Edited by innovacy (see edit history)
Link to comment
Share on other sites

  • 2 years later...
11 hours ago, hakeryk2 said:

@innovacy Could You share with server specifaction and main idea behind he configuration of it? This food site is realy fast and I would like to know those secrets of mysql optimization :)

Well this post is two years old. Which PS version are you using ?

Perhaps this helps you, both PS versions have shops with 10 to 20k products on it and high user traffic:

https://www.prestashop.com/forums/topic/633857-server-requirements-for-ps-17/

https://www.prestashop.com/forums/topic/633856-server-requirements-tested-in-production-for-ps-16/

If you are running php 5.6. you can also try to use memcache for to make some load balancing on traffic, but if you are already using load balancers or are hosting on VPS running on a cloud of servers you will not note any difference.

The fastest server configuration for now is php7 and mariaDB.

Link to comment
Share on other sites

@selectshop.at Thank You for the reply. I am currently running 1.6.1.4 on 5.6 and on VPS. Soo.. I tested memcached but it was even worse then without it. I am still considering swap to MariaDB and PHP7 but I am still looking for some person who will secure my other VPS (I can install apache with nginx as proxy, mariaDB but after that I am just to newbie to secure VPS firewall etc).

Thanks for the related topics! I will check them out!

Link to comment
Share on other sites

Yes, it is worse, because you are on a VPS, which probably is already load balancing. So memcache in this case is not good as stated before.  PS 1.6.1.4 is running without any problems under php7 (third party components could make problems - theme/addons). You need to check this by yourself.

What do you mean to secure server ? This has nothing to do with the initial thread (server caching/server speed).

For myself I'm using non-standard things and tailored to the software in use (WP and PS). VPS is secured by provider form ddos-attacks and that's was. Basic things like SSH, SSL should be a must have.

Link to comment
Share on other sites

1 hour ago, selectshop.at said:

What do you mean to secure server ? This has nothing to do with the initial thread (server caching/server speed).

 

I just assume that my skills in configurning VPS are not enough to provide secure web hosting for website. I don't think that installing apache and nginx proxy, maria db will be enough to run a website on it because probably it needs some secure tweaks. But this is offtopic.

Thank You for your information about this memcached stuff on VPS. It is really helpfull to not touch it again.

I enabled opcache on my  VPS right now but I didn't notice any significant performance improvements.

So there is only need to upgrade php to PHP 7 and see how this will go.

Link to comment
Share on other sites

It depends on the php-version you are using. For opcache you can also do some performances settings. (see my links mentioned above). For php 5.6. best is use ngnix proxied over apache for to get speed and opcache with fast.cgi. For php7 I'm using only opcache and all other things native, without any optimization ;)

Link to comment
Share on other sites

  • 3 years later...

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...