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] Default to Apcu+Filesystem cache chain#18715

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

Merged
fabpot merged 1 commit intosymfony:masterfromnicolas-grekas:cache-default
May 13, 2016

Conversation

@nicolas-grekas
Copy link
Member

QA
Branch?3.1
Bug fix?yes (perf)
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets-
LicenseMIT
Doc PR-

In#16838,@dunglas benched that the filesystem cache is not the fastest one (not a surprise).
Yet, it is the default for now. I propose to replace this default by a dynamically created one that uses APCu when available (of course, we cannot do the check at container-build time), chained with the filesystem.

The benefit is double: APCu is automatically used when available without any configuration, and cache warming up is seeded by the filesystem cache so that the apcu cache can benefit from it.

@dunglas
Copy link
Member

👍

@nicolas-grekas
Copy link
MemberAuthor

Includes#18716 until it's merged

@nicolas-grekasnicolas-grekasforce-pushed thecache-default branch 5 times, most recently from005e8d4 toe300496CompareMay 6, 2016 09:28
$apcu->setLogger($logger);
}

returnnewChainAdapter(array($apcu,$fs));
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if creation of the default adapter belongs here. Imo we should deal with this in the FrameworkBundle extension.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

factory moved to FrameworkBundle (I don't like creating/loading yet another utility class just for the factory)

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

factory back on the component following comment from@fabpot


privatefunctionregisterCacheConfiguration(array$config,ContainerBuilder$container,XmlFileLoader$loader)
{
$container->setParameter('kernel.cache_nonce',substr(base64_encode(md5(uniqid(mt_rand(),true),true)),0,4));
Copy link
Member

Choose a reason for hiding this comment

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

Usingmt_rand means that each rebuilding of the container will change this value. And each server behind the load balancer may have a different value if they build their container themselves (rather than building it once before deploying), making it unusable for configuring a shared cache. Is it the intended behavior ?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Yes, this is the indented behavior: this nonce is only for local caches (apcu is the only use case in fact today).

@nicolas-grekasnicolas-grekasforce-pushed thecache-default branch 4 times, most recently from7ea44b2 to3a3e789CompareMay 8, 2016 22:57
@nicolas-grekas
Copy link
MemberAuthor

ping @symfony/deciders votes pending for 3.1-beta which should/may be released tomorrow

</service>

<serviceid="cache.adapter.system"class="Symfony\Component\Cache\Adapter\ChainAdapter"abstract="true">
<factoryclass="Symfony\Bundle\FrameworkBundle\FrameworkBundle"method="createSystemCache" />
Copy link
Member

Choose a reason for hiding this comment

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

I would move this factory to the component instead as the code in the method is not tied to the full-stack framework. I'd like to be able to reuse this strategy into Silex for instance.

<tagname="cache.pool" />
</service>

<serviceid="cache.adapter.system"class="Symfony\Component\Cache\Adapter\ChainAdapter"abstract="true">
Copy link
Member

Choose a reason for hiding this comment

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

What about using the interface as the class here as the service can also just be aFilesystemAdapter?

@xabbuh
Copy link
Member

👍

@nicolas-grekasnicolas-grekasforce-pushed thecache-default branch 2 times, most recently from5e3dc85 toae1d7dcCompareMay 13, 2016 17:33
@fabpot
Copy link
Member

Thank you@nicolas-grekas.

@fabpotfabpot merged commitb9b57f9 intosymfony:masterMay 13, 2016
fabpot added a commit that referenced this pull requestMay 13, 2016
…in (nicolas-grekas)This PR was merged into the 3.1-dev branch.Discussion----------[FrameworkBundle] Default to Apcu+Filesystem cache chain| Q             | A| ------------- | ---| Branch?       | 3.1| Bug fix?      | yes (perf)| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -In#16838,@dunglas benched that the filesystem cache is not the fastest one (not a surprise).Yet, it is the default for now. I propose to replace this default by a dynamically created one that uses APCu when available (of course, we cannot do the check at container-build time), chained with the filesystem.The benefit is double: APCu is automatically used when available without any configuration, and cache warming up is seeded by the filesystem cache so that the apcu cache can benefit from it.Commits-------b9b57f9 [FrameworkBundle] Default to Apcu+Filesystem cache chain
@fabpotfabpot mentioned this pull requestMay 13, 2016
@nicolas-grekasnicolas-grekas deleted the cache-default branchMay 14, 2016 12:58
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.

9 participants

@nicolas-grekas@dunglas@xabbuh@fabpot@dzuelke@kbond@stof@javiereguiluz@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp