-
-
Notifications
You must be signed in to change notification settings - Fork 865
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
[Performance] API Platform v3.0 is much slower than V2.6 by orders of magnitude #5236
Comments
As an additional test, I changed the API endpoint that is called in the Command. In the previous test, the API endpoint uses a StateProcessor that decorates the built-in Doctrine processor, as per the documentation. The API endpoint in the second test does not use a decorated state processor, and the resource has fewer resource (Doctrine) relations. V2.6 results: duration 2.8 seconds, average 0.28 seconds per iteration. V3.0 results: duration 6.0 seconds, average 0.6 seconds per iteration. I've tried other endpoints as well, but this is the best performance I was able to get for V3.0. As an aside, I discovered this performance issue when I noticed that the PHPUnit test suite was running much longer with V3.0 than what I was used to with V2.6. |
Just to say the obvious: may the problem be related to the generation of cache? To exclude it, I would:
I would not use the console cache:clear command, but physically delete the folder. |
I've run the command many times. It definitely is not caused by the cache. |
Hi, please try following this comment/thread: #4975 (comment) |
Hi, yes we did performances tests, on the last versions this is the diff 2.6 vs 3.0 for a READ operation: https://blackfire.io/profiles/compare/6bec923c-521f-426c-b7f1-1ab2fb962b80/graph The only PR we found that impacted the performances was #4999 then fixed by #5100. What version are you exactly on? @acirulis wasn't that corrected? Careful about the metadata cache, if you change between 2.6 and 3.0 definitely remove that directory or use |
@acirulis Thank you, the cache config resolved the issue. Much appreciated. 🙏 @soyuka I have already supplied the version numbers. V3.0 POST With Caching Config |
FWIW, it is this cache setting that makes all the difference:
|
Following: #4975 (comment) |
API Platform version(s) affected: 3.0.x
Description
Has anyone done performance testing on V3.0?
I'm getting truly worrying results.
I have a Symfony Command that creates and deletes an API resource in a loop that iterates 10 times. In other words, 10 POST and 10 DELETE API operations.
When run under V2.6, the command has a duration of +- 3.48 seconds, for an average of 0.348 seconds per iteration (one POST and one DELETE).
When run under V3.0, the command has a duration of +- 55.54 seconds, for an average of 5.55 seconds per iteration (one POST and one DELETE).
That is a huge performance difference.
I have a v2.6 branch of my app, and a v3.0 branch of the app, and here are the steps when running the tests:
composer update
to install API Platform 2.6composer update
to install API Platform 3.0Each time that
composer update
runs, it only saysUpgrading api-platform/core (v2.6.8 => v3.0.5)
andDowngrading api-platform/core (v3.0.5 => v2.6.8)
, and it removes and installsfig/link-util
. No other packages are modified.I've repeated this several times with exactly the same results. I've also reversed the order, running V3.0 first and then V2.6, with exactly the same results.
The database is exactly the same, the app is exactly the same, except for having StateProcessors and StateProviders instead of DataPersisters and DataProviders. The state processors and state providers contain the same code that was in the data persisters and data providers. The only other difference between the two branches of the app is the new ApiResource attribute format on the entities in the V3 branch.
The test command calls the same API endpoints with exactly the same parameters and data, and the state of the database is exactly the same.
In the current state I cannot run API Platform V3 in production. It will completely kill my app's performance.
The text was updated successfully, but these errors were encountered: