flash760 Posted July 26, 2018 Share Posted July 26, 2018 I just (about a month ago) installed v6.2 with a new hosting company. Then suddenly it stopped working. I found that my Apache inodes limit was reached at 250,000. When looking in the ./cache folder, all the entries are from CubeCart 6. Is this as a result of having to clear cache after every update? It has shut my site down, which is unacceptable. Is this a problem y'all have identified and have a fix? Can this folder be emptied without affecting the operation of the site? Here is a typical file name: a6005.sql.4c7082ec64ab2c24bf242509af3d7806.cache Here is the contents of the file: a:2:{s:4:"time";i:1532111718;s:6:"expire";i:86400;} -- CubeCart Cache Split -- b:1; These seem to be calls to sql for product update for something similar. OR are these calls to the database to retrieve product information and this will happen over and over...? Number if files on my site: 129410 ./cache 94436 ./cube 16261 ./images 3232 ./hisstaff.com 1793 ./wp 1694 ./papasknives.com Link to comment Share on other sites More sharing options...
Al Brookbanks Posted July 26, 2018 Share Posted July 26, 2018 I'd suggest using a different cache mechanism. Link to comment Share on other sites More sharing options...
flash760 Posted July 26, 2018 Author Share Posted July 26, 2018 Thanks Al. I guess I thought the posting here in CubeCart Support Forums / Technical Support I would get an answer to my question. Can I clear ./cache without damaging you site? Link to comment Share on other sites More sharing options...
havenswift-hosting Posted July 26, 2018 Share Posted July 26, 2018 There seem to be reports from a handful of sites of vast numbers of cache files but this is an unusual situation and the cause hasnt been discovered. You can certainly delete all of the cache files but these will simply be recreated and while that is happening your site will be much slower and if a lot of cache files are created very quickly it could have a serious impact on the server file system A different cache method would certainly prevent this from happening and either memcached or redis would store all of these in memory - the problem is that almost no hosting company will install REDIS and very few even install memcached - we have both of these available on our CubeCart hosting servers if you are interested Ian Link to comment Share on other sites More sharing options...
Al Brookbanks Posted July 26, 2018 Share Posted July 26, 2018 Just now, havenswift-hosting said: the cause hasnt been discovered Surely its just a MASSIVE inventory? How many products and categories do you have @flash760 Link to comment Share on other sites More sharing options...
flash760 Posted July 26, 2018 Author Share Posted July 26, 2018 Al, approximately 750 items Link to comment Share on other sites More sharing options...
havenswift-hosting Posted July 26, 2018 Share Posted July 26, 2018 5 minutes ago, Al Brookbanks said: Surely its just a MASSIVE inventory? Not in the cases that have been highlighted in posts on here Link to comment Share on other sites More sharing options...
flash760 Posted July 26, 2018 Author Share Posted July 26, 2018 Al, I can't get to admin to count categories but I'd say about 50 Link to comment Share on other sites More sharing options...
Al Brookbanks Posted July 26, 2018 Share Posted July 26, 2018 16 minutes ago, havenswift-hosting said: Not in the cases that have been highlighted in posts on here I don't think there is a bug. The cache just clears less often. Link to comment Share on other sites More sharing options...
Noodleman Posted July 26, 2018 Share Posted July 26, 2018 I had a similar issue recently, but was at the OS level. Use some form of memory caching instead and you'll be fine. Alternatively increase the configured limit of nodes. some hosting providers will limit the number and not allow it to be changed, in which case grab a VPS or managed VPS and configure it as needed. https://support.cubecart.com/Knowledgebase/Article/View/235/41/how-do-i-enable-apc-memcached-redis-or-xcache On the flip side, I have noted that there does appear to be a much larger cache being built than I would expect which makes me suspect some kind of cache system issue. The longer you leave the cache uncleared, the worse it gets. I suspect new cache files are created in place of older ones, yet the older ones never clear and thus over time things build up to excessive levels if not cleared frequently. I assume that if the same page, with the same content is cached multiple times, its should re-use the same cache file. I don't think it does this. Link to comment Share on other sites More sharing options...
Al Brookbanks Posted July 26, 2018 Share Posted July 26, 2018 The cache mechanisms from 6.2 hasn't changed at all. The only difference is that it no longer clears on every admin page load. The code to generate the cache is unchanged as far as I recall. Link to comment Share on other sites More sharing options...
Noodleman Posted July 26, 2018 Share Posted July 26, 2018 I suspect that the frequent clearing of cache in earlier versions masked an issue, and with the recent change it's made that issue more notable. I've not checked into it and it's just a gut feeling / theory, but it ties in with some reports I've had as well. Link to comment Share on other sites More sharing options...
Al Brookbanks Posted July 26, 2018 Share Posted July 26, 2018 Just now, Noodleman said: I suspect that the frequent clearing of cache in earlier versions masked an issue, and with the recent change it's made that issue more notable. I've not checked into it and it's just a gut feeling / theory, but it ties in with some reports I've had as well. The cache is going to get big. Imagine 50 SQL queries cached on product detail page multiplied by 750 items. Well thats 37,500 files for just that bit of the catalog. I suppose the test is to clear the cache and refresh certain pages and see how much it grows. Link to comment Share on other sites More sharing options...
Noodleman Posted July 26, 2018 Share Posted July 26, 2018 So I just did a basic test on my site and it makes me think that the cache is per session (again, just a theory). if I go to my homepage in Chrome, the cache size increased with an additional 11 SQL cache files. if I reload the page, no more files. I then load the same page in Edge, and it reached and built another set of 11 cache files. the only difference is browser, thus session. The content is the same and should be using the cache built from the previous browser load. Over time, this will increase/build up excessive cached items. Shouldn't the existing cached items be reused? this appears to only be caused by SQL cache. page cache is working OK Link to comment Share on other sites More sharing options...
Al Brookbanks Posted July 26, 2018 Share Posted July 26, 2018 Just now, Noodleman said: So I just did a basic test on my site and it makes me think that the cache is per session (again, just a theory). I'd be very surprised if that was the case as there is no session data tied to cache storage at all. Link to comment Share on other sites More sharing options...
Al Brookbanks Posted July 26, 2018 Share Posted July 26, 2018 I just tested across different browsers and the cache only added a few extra files for new queries. I can't see any problems. Link to comment Share on other sites More sharing options...
bsmither Posted July 26, 2018 Share Posted July 26, 2018 From the original post, what directory structure are we looking at? I do not recognize it. CubeCart will use a folder located within its own structure for the caching of its SQL queries and compiled skin templates. It is at: /public_html/subfolder/cache/ and the /skin/ folder within that. Where /public_html/ is the typical name of the web site "docroot" folder, and /subfolder/ may or may not be present - depending if there is some other application at docroot (WordPress, maybe?). For a short duration experiment, in admin, Store Settings, Advanced tab, disable the Cache. After a few days, run your inode report. Compare the results. (Yes, your site will almost imperceptively run slower, and the hits to the database will dramatically increase.) Link to comment Share on other sites More sharing options...
Noodleman Posted August 6, 2018 Share Posted August 6, 2018 I'm still of the opinion something isn't correct... a mid-size store, 3500 products across an estimated 100 categories generates this in 48 hours almost 700,000 cached objects. This makes the "clear cache" button not work as it just can't clear this many files before throwing an error. Link to comment Share on other sites More sharing options...
Al Brookbanks Posted August 6, 2018 Share Posted August 6, 2018 It could potentially be debugged by changing the way the cache file name is stored or a flat file could be written to with each cache write to store the SQL query. CubeCart caches by default so it might be worth checking 3rd party extensions too. The code in CubeCart has a lot of SQL queries.. multipied by 3,500 products could be massive. Let me know if you find anything. I got back from a stag do in Bournemouth last night so a little hazy still today. Link to comment Share on other sites More sharing options...
Noodleman Posted August 6, 2018 Share Posted August 6, 2018 11 minutes ago, Al Brookbanks said: It could potentially be debugged by changing the way the cache file name is stored or a flat file could be written to with each cache write to store the SQL query. CubeCart caches by default so it might be worth checking 3rd party extensions too. The code in CubeCart has a lot of SQL queries.. multipied by 3,500 products could be massive. Let me know if you find anything. I got back from a stag do in Bournemouth last night so a little hazy still today. that seems reasonable. I'll probably go with a cache log. would you mind giving a couple pointers on the correct location for it? Would save me some trial and error Link to comment Share on other sites More sharing options...
Al Brookbanks Posted August 6, 2018 Share Posted August 6, 2018 You could just bop and fwrite above this line of code: https://github.com/cubecart/v6/blob/6.2.0-branch/classes/db/mysqli.class.php#L224 $fp = fopen('query_log.txt', 'a+'); fwrite($fp, $this->_query."\r\n"); fclose($fp); Link to comment Share on other sites More sharing options...
Noodleman Posted August 6, 2018 Share Posted August 6, 2018 Just set this up and I immediately see a problem coming from some modules. SQL queries which have specifically been run to NOT cache are being written to cache. $GLOBALS['db']->query($sql, false, 0, false); Based on around 5 minutes of collecting data, I'm already seeing 3,500 of these non-cached queries being written to cache. Link to comment Share on other sites More sharing options...
Al Brookbanks Posted August 6, 2018 Share Posted August 6, 2018 1 minute ago, Noodleman said: Just set this up and I immediately see a problem coming from some modules. SQL queries which have specifically been run to NOT cache are being written to cache. $GLOBALS['db']->query($sql, false, 0, false); Based on around 5 minutes of collecting data, I'm already seeing 3,500 of these non-cached queries being written to cache. Great. Sounds like progress. Link to comment Share on other sites More sharing options...
Al Brookbanks Posted August 6, 2018 Share Posted August 6, 2018 Can you change: https://github.com/cubecart/v6/blob/6.2.0-branch/classes/db/mysqli.class.php#L224 To: if($cache) $this->_writeCache($this->_result, $this->_query); ... same in mysql class. Link to comment Share on other sites More sharing options...
Noodleman Posted August 6, 2018 Share Posted August 6, 2018 That's definitely helped. I've also wrapped the log write with the same validation. I'm seeing a lot less cache content being created. I'm monitoring for a while and will update later. Thanks Al Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.