Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[FrameworkBundle] Wire PhpArrayAdapter with a new cache warmer for annotations#18533

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed

Conversation

@tgalopin
Copy link
Contributor

@tgalopintgalopin commentedApr 13, 2016
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?WIP
Fixed tickets-
LicenseMIT
Doc PR-

Depends on#18825 and#18823

This PR implements the usage of the new OpCacheAdapter in the annotations caching system. The idea to use this adapter as much as possible in Symfony (validator, serializer, ...). These other implementations will be the object of different PRs.

*/
protected function doFetch(array $ids)
{
$this->loadFile();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Given calling a method is anheavy process, you can save CPU by callingloadFile only when needed

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@nicolas-grekas just told me that :)

// Validates that the dumped code is valid (ie. no __set_state())
$this->values = eval($dump);

$dump = "<?php\n\n" . $dump;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

missing\n at the end

@stof
Copy link
Member

Deprecate configuration keys for annotations caching in all concerned services (validator, serializer, Doctrine ORM)

As your adapter is read-only, this cannot work unless you rewrite most logic. There is nothing ensuring thatall the cache is of these services is warmed up by the cache warmer, and services using them are not writing all their cache in a single batch (the ORM does not for instance)

@stof
Copy link
Member

Introduce a unified configuration key to enable/disable annotations cache everywhere

We already have a single annotation cache.

I'm quite sure you are confusing the annotation cache and the cache for metadata of each of these services (which must be separate as they store unrelated data, and which can be built from other sources that annotations)

@mkdir($directory, 0777, true);
}

if (!file_exists($directory)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

you should move this condition block after the mkdir

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

That's a good point, I'll do that tomorrow

@tgalopintgalopinforce-pushed theannotations-opcache branch 2 times, most recently fromd8de715 to088afb1CompareJune 30, 2016 11:55
@tgalopintgalopinforce-pushed theannotations-opcache branch 2 times, most recently from4f2d5c2 to91d992dCompareJuly 29, 2016 07:47
@tgalopin
Copy link
ContributorAuthor

With Blackfire it's really hard to highlight the performance gain because it's small. Withab -n 1000 -c 100 against aphp -S on the standard edition, I get a median of 280ms per request with the patch and 285ms with Doctrine APCu.

To sum up, the benefit provided by this PR are:

  • annotations can be warmed up offline
  • on PHP 7, there is no need for user extension to get maximum performances
  • on PHP 7 again, we are not sensitive to APCu memory fragmentation
  • last but not least, global performance is the same if not slightly better

@nicolas-grekas
Copy link
Member

Status: reviewed

@fabpot
Copy link
Member

Thank you@tgalopin.

fabpot added a commit that referenced this pull requestJul 30, 2016
…tated classes to compile using patterns (tgalopin)This PR was merged into the 3.2-dev branch.Discussion----------[HttpKernel] Allow bundles to declare classes and annotated classes to compile using patterns| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -This PR introduces a simple system of patterns based on wildcards for classes to cache in the HttpKernel dependency injections extensions. This system started to be implemented in#18533 but I split it up here to use it also in the classes to compile.Commits-------1be7424 [HttpKernel] Allow usage of patterns in classes and annotations to cache
tgalopin pushed a commit to tgalopin/symfony that referenced this pull requestAug 1, 2016
…nd annotated classes to compile using patterns (tgalopin)This PR was merged into the 3.2-dev branch.Discussion----------[HttpKernel] Allow bundles to declare classes and annotated classes to compile using patterns| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -This PR introduces a simple system of patterns based on wildcards for classes to cache in the HttpKernel dependency injections extensions. This system started to be implemented insymfony#18533 but I split it up here to use it also in the classes to compile.Commits-------1be7424 [HttpKernel] Allow usage of patterns in classes and annotations to cache
tgalopin pushed a commit to tgalopin/symfony that referenced this pull requestAug 2, 2016
…nd annotated classes to compile using patterns (tgalopin)This PR was merged into the 3.2-dev branch.Discussion----------[HttpKernel] Allow bundles to declare classes and annotated classes to compile using patterns| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -This PR introduces a simple system of patterns based on wildcards for classes to cache in the HttpKernel dependency injections extensions. This system started to be implemented insymfony#18533 but I split it up here to use it also in the classes to compile.Commits-------1be7424 [HttpKernel] Allow usage of patterns in classes and annotations to cache
fabpot added a commit that referenced this pull requestSep 14, 2016
…zer based on PhpArrayAdapter (tgalopin)This PR was merged into the 3.2-dev branch.Discussion----------[FrameworkBundle] Introduce a cache warmer for Serializer based on PhpArrayAdapter| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -Following the cache warmer for annotations (#18533) and for the validator (#19485), this PR introduces a cache warmer for the Serializer YAML and XML metadata configuration (mainly groups).Based on the PhpArrayAdapter, it uses the naming conventions (Resources/config/serialization) to find the files and compile them into a single PHP file stored in the cache directory. This file uses shared memory on PHP 7.The benefit of this PR are the same than the ones of the previous PR:- serialization metadata cache can be warmed up offline- on PHP 7, there is no need for user extension to get maximum performances (ie. if you use this PR and the other one, you probably won't need to enable APCu to have great performances)- on PHP 7 again, we are not sensitive to APCu memory fragmentationlast but not least, global performance is slightly better (I get 30us per class gain in Blackfire)As previous work on the Serializer cache system introduced issues (see96e418a), it would be interesting to pay careful attention to the backward compatibility during the review (ping @Ener-Getick).Commits-------810f469 [FrameworkBundle] Introduce a cache warmer for Serializer based on PhpArrayAdapter
fabpot added a commit that referenced this pull requestSep 14, 2016
…or based on PhpArrayAdapter (tgalopin)This PR was merged into the 3.2-dev branch.Discussion----------[FrameworkBundle] Introduce a cache warmer for Validator based on PhpArrayAdapter| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | yes| Tests pass?   | -| Fixed tickets | -| License       | MIT| Doc PR        | -Following the cache warmer for annotations PR (#18533), this PR introduces a cache warmer for YAML and XML Validator configuration.Based on the PhpArrayAdapter, it uses the naming conventions (`Resources/config/validation`) to find the files and compile them into a single PHP file stored in the cache directory. This file uses shared memory on PHP 7.The benefit of this PR are the same than the ones of the annotations PR:- validation configuration can be warmed up offline- on PHP 7, there is no need for user extension to get maximum performances (ie. if you use this PR and the other one, you probably won't need to enable APCu to have great performances)- on PHP 7 again, we are not sensitive to APCu memory fragmentation- last but not least, global performance is slightly better (I get 30us per class gain in Blackfire)This PR also deprecates the framework.validator.cache key in favor of the cache pool introduced in#18544.Commits-------6bdaf0b [FrameworkBundle] Introduce a cache warmer for Validator based on PhpArrayAdapter
symfony-splitter pushed a commit to symfony/validator that referenced this pull requestSep 14, 2016
…or based on PhpArrayAdapter (tgalopin)This PR was merged into the 3.2-dev branch.Discussion----------[FrameworkBundle] Introduce a cache warmer for Validator based on PhpArrayAdapter| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | yes| Tests pass?   | -| Fixed tickets | -| License       | MIT| Doc PR        | -Following the cache warmer for annotations PR (symfony/symfony#18533), this PR introduces a cache warmer for YAML and XML Validator configuration.Based on the PhpArrayAdapter, it uses the naming conventions (`Resources/config/validation`) to find the files and compile them into a single PHP file stored in the cache directory. This file uses shared memory on PHP 7.The benefit of this PR are the same than the ones of the annotations PR:- validation configuration can be warmed up offline- on PHP 7, there is no need for user extension to get maximum performances (ie. if you use this PR and the other one, you probably won't need to enable APCu to have great performances)- on PHP 7 again, we are not sensitive to APCu memory fragmentation- last but not least, global performance is slightly better (I get 30us per class gain in Blackfire)This PR also deprecates the framework.validator.cache key in favor of the cache pool introduced insymfony/symfony#18544.Commits-------6bdaf0b [FrameworkBundle] Introduce a cache warmer for Validator based on PhpArrayAdapter
symfony-splitter pushed a commit to symfony/framework-bundle that referenced this pull requestSep 14, 2016
…or based on PhpArrayAdapter (tgalopin)This PR was merged into the 3.2-dev branch.Discussion----------[FrameworkBundle] Introduce a cache warmer for Validator based on PhpArrayAdapter| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | yes| Tests pass?   | -| Fixed tickets | -| License       | MIT| Doc PR        | -Following the cache warmer for annotations PR (symfony/symfony#18533), this PR introduces a cache warmer for YAML and XML Validator configuration.Based on the PhpArrayAdapter, it uses the naming conventions (`Resources/config/validation`) to find the files and compile them into a single PHP file stored in the cache directory. This file uses shared memory on PHP 7.The benefit of this PR are the same than the ones of the annotations PR:- validation configuration can be warmed up offline- on PHP 7, there is no need for user extension to get maximum performances (ie. if you use this PR and the other one, you probably won't need to enable APCu to have great performances)- on PHP 7 again, we are not sensitive to APCu memory fragmentation- last but not least, global performance is slightly better (I get 30us per class gain in Blackfire)This PR also deprecates the framework.validator.cache key in favor of the cache pool introduced insymfony/symfony#18544.Commits-------6bdaf0b [FrameworkBundle] Introduce a cache warmer for Validator based on PhpArrayAdapter
@fabpotfabpot mentioned this pull requestOct 27, 2016
@tgalopintgalopin deleted the annotations-opcache branchOctober 27, 2016 09:39
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

12 participants

@tgalopin@stof@nicolas-grekas@xabbuh@dunglas@fabpot@javiereguiluz@pborreli@Taluu@jderusse@Nicofuma@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp