Skip to content

refreshAcl in Authentication plugin slows down all adminhtml requests #39843

@ilnytskyi

Description

@ilnytskyi

Preconditions and environment

  • Magento version 2.4.7+
  • Plugin Magento\Backend\App\Action\Plugin\Authentication enabled
  • Have 17000+ rules in from in Magento\Authorization\Model\Acl\Loader\Rule::getRulesArray

Image

Steps to reproduce

  1. Perform any adminhtml requests.
  2. See that Magento\Backend\App\Action\Plugin\Authentication::aroundDispatch calls the $this->_auth->getAuthStorage()->refreshAcl(); line https://github.com/magento/magento2/blame/2.4-develop/app/code/Magento/Backend/App/Action/Plugin/Authentication.php#L144
  3. The call goes till the Magento\Authorization\Model\Acl\Loader\Rule::applyPermissionsAccordingToRules that adds about 200ms to total response time.

Image

Expected result

  1. Plugin Authentication::aroundDispatch does not slow down admin requests

Actual result

  1. Plugin Authentication::aroundDispatch slows down admin requests

Additional information

Unfortunately it's unclear why this plugin is needed or why it triggers refreshAcl via $this->_auth->getAuthStorage()->refreshAcl();
The code added many years ago probably just as migration from Magento 1.
Image

Release note

Fixed 200ms performance degradation in adminhtml area caused by Magento\Backend\App\Action\Plugin\Authentication::aroundDispatch plugin.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: FrameworkComponent: Framework/AppIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P3May be fixed according to the position in the backlog.Reported on 2.4.7Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

    Type

    No type

    Projects

    Status

    Ready for Development

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions