Thanks to visit codestin.com
Credit goes to github.com

Skip to content

In dev with yaml/xml config, serialization & validator files are parsed on each request that require them #35096

Closed
@bastnic

Description

@bastnic

Description
This is a performance issue in dev environment.
When using yaml/xml files for validator and serialization definition, they are parsed on each request needing them. So every serialization for every GET in an api and validation+serialization for every modifier request. That's a LOT when the API increase in complexity.

FrameworkExtension register for ClassMetadataFactory a ChainLoader with a set of YmalFileLoader (one for each yaml file). And almost the same for Validator stack.

At runtime, when we need these metadata, all files are parsed to get the correct one.

In production we have a CacheClassMetadataFactory (that is not yet optimized but at least avoid parsing yaml at each requests).

For every config files others than validation / serialization we have a set of check with filemtime that prevent parsing them. We could add this type of algorithm:

  • at warmup, give the same list of files that are given to the ChainLoader to a class responsible of filemtime-ing them and save the max date of these files somewhere
  • at kernel boot, check for these files
  • use CacheClassMetadataFactory by default (but without a phparrayadapter), and save the max date of these files
  • if the max date is newer, clear the pool caches.

The performance in dev for every person playing with serializer / validator yaml files would be tremendous.

In APIP, they have their own set of YamlExtractor, cached stuff in dev and a warmer that clear these cache (https://github.com/api-platform/core/blob/master/src/Bridge/Symfony/Bundle/CacheWarmer/CachePoolClearerCacheWarmer.php). All sorts of hacks that could be totally removed if Symfony provided some optimizatoin for external config related to metadata.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions