magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.56k stars 9.32k forks source link

[Magento 2.1.6] Page Cache make growing size more and more #9458

Closed jurpro closed 7 years ago

jurpro commented 7 years ago

Hello. I have a problem with cache on Magento 2.1.x Accourding my hosting provider services, the script of Magento 2.1.x more bigger and bigger size day by day. For example, last week the size of all files and folders is 400 MB, 2 days later 500 MB, and now 2 GB, and may be in a month it size approximately 32 GB.

This is problem for me when I need to upgrade to the latest version of Magento 2.1.x or the latest version theme, I need to backup all files but the system is very slow.

Preconditions

Make a backup files for Magento system

Steps to reproduce

  1. Open Cpanel, then Files Explorer
  2. Make a backup file for Magento system such as ZIP files.

Expected result

  1. The backup file successful such as magento.zip

Actual result

  1. Long time for result zip files.
  2. Or If unsuccesful there is only file with something like this: zzYYhMmB, xxTgBhM

According to my hosting service support, there is a bigger files on : /home/xxxxx/public_html/var/page_cache day by day.

I wish, next version, Magento can fix this problem.

Here is the answer from my Hosting:

Hi there,

In my last reply I showed where most the data was used which is here:

And in /home/xxxx/public_html/var/page_cache

There is 16G used:

978M ./mage--5 984M ./mage--7 993M ./mage--9 1001M ./mage--b 979M ./mage--8 985M ./mage--f 983M ./mage--1 1000M ./mage--a 982M ./mage--2 992M ./mage--6 994M ./mage--3 1004M ./mage--e 1000M ./mage--4 1019M ./mage--0 987M ./mage--d 981M ./mage--c 90M ./mage-tags 16G .

Note these are page cache files and can be deleted, it seems your script does not clean up cache files and the size of the folder is growing constantly.

choukalos commented 7 years ago

What specific version of Magento are you on?

How many Sku's do you have on your store? #Sku's will drive page cache and block cache growth.

It's possible images being resized are also probably increasing storage space - when you import product photos we don't re-size the images until the store takes traffic. Your store is getting traffic and triggering the image resizes. You'll have a # of image resizes based on the # of different images your theme uses.

Have you tried flushing your cache? That should clean up the cache files from var/. You'd want to do that after you upgraded anyway so there's no harm in doing it before to reduce your backup time.

korostii commented 7 years ago

Note these are page cache files and can be deleted, it seems your script does not clean up cache files and the size of the folder is growing constantly.

So, have you tried doing that? It's completely safe to delete everything under var if you need storage space.

Besides, when you do that backup of yours, it might be a good idea to skip the var and pub\media\catalog\product\cache\ folders from the archive.

jurpro commented 7 years ago

Magento version 2.1.6 but I had this problem since 2.1.4 and 2.1.5

Hi @choukalos and @korostii thank you for your advice. Today I tried what you ask me. I do flush chace storage. I never do that, because if I click that button, there is a warning "The cache storage may contain additional data. Are you sure that you want to flush it?" So, I never do that.

Thank you so much. Now, it on light capacity.

My suggest, how if the warning for the flush cache storage is add with something like this, "this flush can reduce storage capacity from bla bla bla bla..." just like that. So, everyone will doing it to make more space on their disk sever.

Thank you again

magento-engcom-team commented 7 years ago

@jurpro, thank you for your report. This seems to be correct Magento behavior. Please refer to the Community Forums or the Magento Stack Exchange site for advice or general discussion about this. Otherwise you may submit Pull Request with the suggested changes.

nplinhho commented 5 years ago

I have the same issue on Magento 2.3.0

My store includes about 8000 products, it always increases about 10GB each week, and have to flush them at the end of week.

hostep commented 5 years ago

If you use file based caching, then yes, the full page cache keeps growing and growing until you manually flush it. Magento currently has no mechanism to keep it under control. You could try switching to Varnish as an alternative? Also see: https://github.com/magento/magento2/issues/16375#issuecomment-409571521

nplinhho commented 5 years ago

If you use file based caching, then yes, the full page cache keeps growing and growing until you manually flush it. Magento currently has no mechanism to keep it under control. You could try switching to Varnish as an alternative? Also see: #16375 (comment)

Because our hosting provider doesn't support Varnish. BTW, Varnish sometime has issue and not stable on data response. So it is not my solution for FPC.

hostep commented 5 years ago

Ok, then you could ask the hosting for more disk space so you don't need to flush it so often. Or just keep doing what you are doing and flushing the page cache every week. If that works for you then you currently have a solution for the problem 👍

MagePsycho commented 5 years ago

Just wondering why it keeps on increasing the disk space. Even if it increases it should increase to a few MBs, not in GBs. Is there a better way to manage var/page-cache/ in hosting with limited space?

opentechiz commented 5 years ago

Just wondering why it keeps on increasing the disk space. Even if it increases it should increase to a few MBs, not in GBs. Is there a better way to manage var/page-cache/ in hosting with limited space?

I think it is because layered navigation pages which are discovered more time to time

drinkingsouls commented 3 years ago

Magento 2.4x, my store is 8000+ product. Magento 2 cache fills server every week, 30GB+ cache. Did anyone have any solutions to this?

AddoSolutions commented 3 years ago

Same issue here, we have a relatively small catalog (~2500) and just had to clear var/page_cache which was over 52GB. This seems like a memory-leak for HDDs, possibly a DDoS attack? @magento-engcom-team This is not expected behavior

amitvkhajanchi commented 3 years ago

I have same issue. I just migrated from Magento 2.3.3 -> 2.4.1 this week and configured Varnish. I have about 5000 products on catalog and have 6 store views (US, FR, UK, DE, IT, ES) etc. I had to put in a cron to flush my cache every 2 hours... as it was growing to 100GB (magento2/var/cache). I disabled FPC in app/etc/env.php but cache seems to be still growing at alarmingly quick speed....

I am using Ubuntu 20.04 LTS PHP 7.4 Nginx 1.8 Elasticsearch 6.5 Redis 5

Any suggestions?

korostii commented 2 years ago

FYI anyone whom this may concern: this "non-issue" is supposedly being fixed in 2.4.4, at least according to the beta's releases notes. Would be nice to see a pull request or some commits linked in case anyone would like to backport this change to older versions....

amcguireweb commented 1 year ago

FYI anyone whom this may concern: this "non-issue" is supposedly being fixed in 2.4.4, at least according to the beta's releases notes. Would be nice to see a pull request or some commits linked in case anyone would like to backport this change to older versions....

Is there anywhere we can see what was changed to fix this issue? We'd like to backport it.

JMLucas96 commented 10 months ago

Same issue @amcguireweb you finde where we can see what was changed?