Skip to content

[Performance] API Platform v3.0 is much slower than V2.6 by orders of magnitude #5236

Description

@gnito-org

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:

  • checkout the v2.6 branch of the app
  • run composer update to install API Platform 2.6
  • run the test command (takes 3.48 seconds)
  • checkout the v3.0 branch of the app
  • run composer update to install API Platform 3.0
  • run the test command (takes 55.54 seconds)

Each time that composer update runs, it only says Upgrading api-platform/core (v2.6.8 => v3.0.5) and Downgrading api-platform/core (v3.0.5 => v2.6.8), and it removes and installs fig/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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions