Skip to content

Slow Performance of ProductMetadata::getVersion #24025

Closed
@beberlei

Description

@beberlei

Preconditions (*)

Any Magento 2 version.

Steps to reproduce (*)

  1. Have a more complex composer.json with source checked repositories (git checkouts for example).
  2. A plugin that calls ProductMetadata::getVersion to check for Magento version.

Expected result (*)

Calling ProductMetadata::getVersion, I expected it to be a function returning a constant. Super-fast.

Actual result (*)

147ms in this case with 7 calls to proc_open, calling svn, git, hg to retrieve versions of source packages. In addition the PHP based JSON Parser is triggered for ~15ms. This overhead is present regardless f all packages were dist or source based and their version were known.

This output is from Tideways callgraph profiler:

tideways_magento2_getversion

This is related to the closed #23242 ticket that wasn't reproduced.

This performance issue is especially critical, because they way plugins check the magento version, this overhead is usually present in all requests to a Magento 2 shop.

Metadata

Metadata

Assignees

Labels

Component: Framework/AppFixed in 2.3.xThe issue has been fixed in 2.3 release lineFixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions