-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Increase redis session max_concurrency limit from 6 to 32 #29140
Conversation
The default redis session concurrency limit is fairly low. Every magento page load triggers many ansync requests, combined with moderate traffic this causes frequent errors. I see no real drawback increasing this default value. For us this solved the problem completely in production systems. This fixes issue magento#17310 that was wrongly closed by a now deleted user.
Hi @marvinhinz. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
You can find more information about the builds here ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review. For more details, please, review the Magento Contributor Guide documentation. 🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket. 🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
@magento run all tests |
@marvinhinz this case looks really strange and not sure if we really need to fix it. |
Thats actually a real issue. When testing our production systems its not uncommon to open many links with the ctrl key pressed, or using the mouswheelbutton. Also personally some customers tend to do this for e.g. comparing products/prices etc.
No, afaik this happens only with redis session enabled. |
@marvinhinz thank you for the info! will be really useful! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔ Approved.
Failing tests looks not related to changes form this PR.
Hi @ihor-sviziev, thank you for the review. |
In our instances even |
The problems arise because Magento will cause several AJAX requests to be executed after the initial request. E.g. for loading customer sections, or JavaScript modules or any other content, that is loaded asynchronously. And depending on the theme and extensions you have installed, this number may increase drastically. |
What value was sufficient for your projects? I dont think there would be drawbacks increasing it to for example 128? @ihor-sviziev what do you think? |
I think it was set to such small value by default in order to prevent
single customer to send too much requests and causing big load on
production instance
…On Fri, 17 Jul 2020 at 10:53, Fritz Michael Gschwantner < ***@***.***> wrote:
In our instances even 32 was not enough. Why not set it even higher by
default? Is there a drawback?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#29140 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAOJOUNUK7WNWEQOSCBWUETR377N5ANCNFSM4O2IFKFQ>
.
|
@marvinhinz we used @ihor-sviziev but does that make much sense? The requests are not prevented by this. And even if you want to reduce the load on the Redis server this way, then the fallback needs to work, which it currently does not (see #17310). And even if the fallback would work, it would simply increase the I/O load on the server - which is something that using the Redis Session Cache is supposed to avoid. |
✔️ QA Passed Preconditions: Redis server;
Manual testing scenario:
Before: ✖️ Only ~6 will successfully load and others will have errors Check the var/report folder for the start_session error report relating to the tabs that failed. After: ✔️ Browsing pages in the admin area didn't throw an error |
Will this be included in the 2.4 release? :) |
This is something you can already do yourself. It does not fix the original issue. |
I know, but it would be nice if newly installed shops dont run into this issue in the first place. |
I just found that this PR was discussed on the public triage meeting in https://www.youtube.com/watch?v=knegmLW94z4&t=1575s @sdzhepa @VladimirZaets just adding my thoughts about this PR and issue itself. The issue appears not only with requests to the pages itself, but also to AJAX requests on the pages you're just opened opened, so sometimes you don't really need to open 6 pages, but just 2-3. Real use case when this issue reproducing: Another use case - on frontend some customers opening few products in a new tab (usually from desktop) people doing that. About limiting session concurrency - sessions is not the thing for decreasing load on the servers, we should have this limitation on the nginx/phpfpm or even on the WAF level. About this change - it will change only default settings in env.php during magento installation, people still could increase / decrease this value in env.php file: |
@marvinhinz just an idea - what if we'll implement postponed sending of AJAX calls while tab is not active? As result - we'll send less requests in such cases to the backend and this issue probably will be also much less reproducible. We can use for that https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API |
@ihor-sviziev just in case -> https://xumulus.com/magento-2-and-ajax-with-optimistic-session-locking/ I am wondering if it would make sense to implement an option (set through a special parameter using define() maybe?) that would change the session to read-only mode (this would mean disable locking on read and do nothing on write). |
@ihor-sviziev this pr will not resolve the issue, with 32 number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @marvinhinz,
As we discussed with @Nazar65 - this PR actually masks the issue, instead of fixing it.
Proper solution will be introducing optimistic session locking mechanism, as described here #29140 (comment). That's definitely will be much bigger effort than this PR.
Will you be able to update your PR by introducing optimistic session locking mechanism?
@marvinhinz I am closing this PR now due to inactivity. Note: @Nazar65 you can take this issue |
Hi @marvinhinz, thank you for your contribution! |
Description (*)
The default redis session concurrency limit is fairly low. This sometimes triggers error pages for customers who might have opened multiple links in new tabs.
I see no real drawback increasing this default value from 6 to 32.
For us this solved the problem completely in production systems.
Additional investigation is described in #17310 (comment) and #17310 (comment)
Fixed Issues (if relevant)
Manual testing scenarios (*) copied from @chris-pook
Contribution checklist (*)