Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis / AOF - Magento 2.4.6-p3 #38148

Open
1 of 5 tasks
Nuranto opened this issue Nov 6, 2023 · 22 comments
Open
1 of 5 tasks

Redis / AOF - Magento 2.4.6-p3 #38148

Nuranto opened this issue Nov 6, 2023 · 22 comments
Assignees
Labels
Area: Framework Component: Cache Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P3 May be fixed according to the position in the backlog. Progress: dev in progress Reported on 2.4.6-p3 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it

Comments

@Nuranto
Copy link
Contributor

Nuranto commented Nov 6, 2023

Summary

With redis for session, configured with appendonly=yes (AOF), we noticed that after upgrading from 2.4.6-p2 to 2.4.6-p3, storage was increasing very very fast (More than 5Go used for 300Mo of actual data). Our redis servers were crashing because of that (volume getting full within 24hours...). We guess the session are updated more frequently than before.

A hotfix was to switch to RDB.

I'm not sure it is related to 2.4.6-p3, could be another composer dependency upgrade. But I wanted to let you know, maybe others have experienced this issue too ?

Examples

Proposed solution

No response

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
@Nuranto Nuranto added the Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it label Nov 6, 2023
Copy link

m2-assistant bot commented Nov 6, 2023

Hi @Nuranto. Thank you for your report.
To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:


Join Magento Community Engineering Slack and ask your questions in #github channel.
⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
🕙 You can find the schedule on the Magento Community Calendar page.
📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

@engcom-Bravo engcom-Bravo added the Reported on 2.4.6-p3 Indicates original Magento version for the Issue report. label Nov 6, 2023
@Nuranto
Copy link
Contributor Author

Nuranto commented Nov 8, 2023

Update : We still have issues with RDB. So the issue could be the number of sessions that increased, or the size of them. We'll continue investigate.

@ananth-iyer
Copy link
Member

@Nuranto it could be related to Magento CSP:
Please check: #29964

@Nuranto
Copy link
Contributor Author

Nuranto commented Nov 9, 2023

I'm not sure, this ticket seems related to cache. We only have issues with sessions.

@hostep
Copy link
Contributor

hostep commented Nov 9, 2023

@Nuranto
Copy link
Contributor Author

Nuranto commented Nov 16, 2023

Yes, that was my thought too.
But you're right, redis dependencies have been updated at the same time, I'll look into it, thanks.

@Garde85
Copy link

Garde85 commented Nov 17, 2023

I have a similar issue. After upgrade Magento from 2.3.5 to 2.4.6-p2, Redis memory start to grow very very fast and arrived to 11 GB.
In my case memory saturation seems not to be related to session, because I use 2 different Redis instances: one for sessions and one for caches. Instance that manage sessions does not have any problems, while instance that manage backend cache saturate his memory.
I observer that the isseu seems to be related to 2 type of magento cache:

  • layout
  • block_html

if i flush theese caches, memory size of redis return to (around) 300MB.

@engcom-November engcom-November self-assigned this Dec 7, 2023
Copy link

m2-assistant bot commented Dec 7, 2023

Hi @engcom-November. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • 5. Add label Issue: Confirmed once verification is complete.
  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-November
Copy link
Contributor

Hello @Nuranto,

Thank you for the report and collaboration!

We configured redis for session with readonly, and upgraded from 2.4.6-p2 to the latest 2.4.7-beta2.
But we didn't see any significant increase in redis size.
Please take a look at the screenshot:
This is the reddis size with 2.4.6-p2
image

And this is when upgraded to 2.4.7-beta2
image

Please let us know if we are missing anything.

Thank you.

@engcom-November engcom-November added the Issue: needs update Additional information is require, waiting for response label Dec 7, 2023
@JoostWan
Copy link

Same problem over here will multiple shops and Redis page cache.

@goivvy
Copy link

goivvy commented Dec 19, 2023

@Nuranto Were you able to fix it? What version of redis are you running, was it upgraded along with Magento?

@amcguireweb
Copy link

We're currently updating to 2.4.6-p3 in hopes to solve our Redis issues, this does not sound promising. Has anyone determined the issue yet?

@Nuranto
Copy link
Contributor Author

Nuranto commented Jan 8, 2024

Hi @goivvy, no we did not upgrade redis along with magento. We're running on redis 7.0.14. And we stabilized this by disabling AOF

@hostep
Copy link
Contributor

hostep commented Jan 16, 2024

I just noticed this commit made in core magento that limits 2 of the redis packages to a certain version (according to the commit message - in broken English - it sounds like newer versions of these packages have performance issues): 9369884

@engcom-November
Copy link
Contributor

@Nuranto, @hostep we were not able to reproduce this issue on vanilla 2.4-develop instance with redis AOF turned on.
Are there any additional things required in order to reproduce this issue, for example should we have a large number of data in magento instance or large number of traffic is required?
could you please provide more information on this.

Thank you.

@amcguireweb
Copy link

@Nuranto, @hostep we were not able to reproduce this issue on vanilla 2.4-develop instance with redis AOF turned on. Are there any additional things required in order to reproduce this issue, for example should we have a large number of data in magento instance or large number of traffic is required? could you please provide more information on this.

Thank you.

We're all experiencing the issue. It's not new to the most recent version, it's been a problem through all past versions. I am guessing you installed vanilla magento, with no data, and no traffic? You'll need a large catalog and simulated traffic to reproduce this issue.

@kestraly
Copy link

Currently experiencing this issue on 3 different setups.
I've switched over to RDB, which has indeed solved much of the issue. But I noticed Redis continued to spike. All 3 versions are on Magento 2.4.5 and all 3 versions had "Cache User Defined Attributes" - YES.
Cache EAV types and attributes - whilst enabled seems to grow without limitation. Whilst disabled, the Redis database stabilises

@engcom-Hotel engcom-Hotel added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Component: Cache Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Priority: P3 May be fixed according to the position in the backlog. and removed Issue: needs update Additional information is require, waiting for response labels Nov 5, 2024
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.adobe.com/browse/AC-13309 is successfully created for this GitHub issue.

Copy link

m2-assistant bot commented Nov 5, 2024

✅ Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@engcom-Hotel
Copy link
Contributor

Hello,

As mentioned here #38148 (comment), the issue is unable to reproduce easily, I think we can confirm this issue as so many users are facing the same issue.

We will investigate more on this during the fixing of this issue. We will keep you posted on this.

Thanks

@TalesDuque
Copy link

Hi everyone,

I recently faced the same issue with a very large catalog, with a total of 2+ million products, meaning a lot of PDP layouts.

We came to the conclusion that the ID and SKU specific PDP Layouts were generating individual cache entries for each individual product, which lead to a huge amount of cache keys in Redis after people visited different product pages.

After some time, we were looking at around 5+ million cache keys stored in REDIS, which was causing the issues we saw previously.

We then implemented a solution to disable the feature that allows the individual layouts by ID and SKU, and we're now sitting at only 35k cache keys stored in REDIS after around 15h after the deployment and after the cache was cleared. It is a significant reduction in the amount of cached keys, reducing by a ton the amount of memory used.

This check was done by going into the REDIS CLI client and typing in MEMORY STATS . This returns a "keys.count" array key with the amount of keys used in REDIS.

As a comparison, I ran the check on a smaller website, which has around 90k products, and got the result of around 100k keys. Keep in mind that in this smaller website's case, the SKU/ID specific layouts are still enabled.

The solution consists of implementing plugins on:

Magento\Framework\View\Model\Layout\Merge
and
Magento\Framework\View\EntitySpecificHandlesList

These plugins prevent the addition of the 'CATALOG_PRODUCT_VIEW_ID' and 'CATALOG_PRODUCT_VIEW_SKU' to the layout, further preventing the generation of these individual layout keys in REDIS.

Of course, our solution implies that you cannot create ID/SKU specific layout files by specifying the catalog_product_view_id/sku_... layout, but I'd say it's still recommended to create a custom product type and use it for the purpose of customizing certain PDPs, and it would also make the layout reusable in future products.

@hostep
Copy link
Contributor

hostep commented Mar 21, 2025

Even though my comment isn't session related but cache related, maybe others may find this info useful.

For the people having this Redis issue, can you try to disable Lua mode in the Redis configuration for your default cache in your app/etc/env.php file and see if that improves things?

    'cache' => [
        'frontend' => [
            'default' => [
                'backend' => 'Magento\\Framework\\Cache\\Backend\\Redis',
                'backend_options' => [
                    'use_lua' => '0',                        <=====

Lua was enabled by default in colinmollenhour/cache-backend-redis version 1.17.0 which was released a few weeks before this ticket got created.

We've seen significant improvement in Redis usage by disabling Lua.

See this related discussion about it btw: colinmollenhour/Cm_Cache_Backend_Redis#181


For the issue @TalesDuque mentions, there is this module that does the same: https://github.com/Vendic/module-optimize-cache-size
And also we have this PR that tries to bring in configuration options to enable/disable those in core-magento: #39718

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Framework Component: Cache Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P3 May be fixed according to the position in the backlog. Progress: dev in progress Reported on 2.4.6-p3 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
None yet
Development

No branches or pull requests