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

Skip to content

[FrameworkBundle] Don't populate fallback cache on warmup #28331

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

Merged
merged 1 commit into from
Sep 3, 2018

Conversation

nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Sep 1, 2018

Q A
Branch? master
Bug fix? no
New feature? no
BC breaks? no
Deprecations? yes
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

Since we populate the front PhpArrayCache, there is no need to also populate its fallback pool, since it will never be hit for the warmed up values.
This saves creating a myriad of small cache files and some MB.


foreach ($values as $k => $v) {
$item = $this->fallbackPool->getItem($k);
$this->fallbackPool->saveDeferred($item->set($v));
Copy link
Member Author

Choose a reason for hiding this comment

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

this is the main call that I propose to remove in this PR (the rest is just collateral)

@nicolas-grekas
Copy link
Member Author

nicolas-grekas commented Sep 1, 2018

Note that this means ppl that have OPcache disabled won't have a warm cache.
See

if (ini_get('opcache.enable')) {

But we don't care IMHO.

@javiereguiluz
Copy link
Member

I don't fully understand this proposal, so I'd like to ask you about it with a real example. If I browse some pages of Symfony Demo app in prod, the cache/pools/ ends up with 405 files and 791 KB.

So, would this PR remove most (all?) of those files in cache/pools/* ? Thanks!

@nicolas-grekas
Copy link
Member Author

nicolas-grekas commented Sep 3, 2018

One of these pools is the fallback annotations cache. After this change, this folder would end up with a lot less files.

@stof
Copy link
Member

stof commented Sep 3, 2018

I agree that not having a warmed up cache for people not having OPCache is something we don't care about. People disabling OPCache in prod cannot complain to us about the app being slower due to having cache misses (it is also a lot slower due to not optimizing PHP anyway).

@fabpot
Copy link
Member

fabpot commented Sep 3, 2018

Thank you @nicolas-grekas.

@fabpot fabpot merged commit c857ba5 into symfony:master Sep 3, 2018
fabpot added a commit that referenced this pull request Sep 3, 2018
…mup (nicolas-grekas)

This PR was merged into the 4.2-dev branch.

Discussion
----------

[FrameworkBundle] Don't populate fallback cache on warmup

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Since we populate the front PhpArrayCache, there is no need to also populate its fallback pool, since it will never be hit for the warmed up values.
This saves creating a myriad of small cache files and some MB.

Commits
-------

c857ba5 [FrameworkBundle] Don't populate fallback cache on warmup
@nicolas-grekas nicolas-grekas deleted the warmup-no-fallback branch September 4, 2018 06:45
@mcfedr
Copy link
Contributor

mcfedr commented Sep 5, 2018

Won't this mean there is no cache available for console commands?

@nicolas-grekas nicolas-grekas modified the milestones: next, 4.2 Nov 1, 2018
This was referenced Nov 3, 2018
weaverryan added a commit to symfony/webpack-encore-bundle that referenced this pull request Jul 24, 2021
This PR was merged into the main branch.

Discussion
----------

Remove fallback cache on cache warmer

Since Symfony 4.2 fallback cache on cache warmer is not supported anymore.

Here's the PR that dropped it: symfony/symfony#28331

Commits
-------

f3836d1 Remove fallback cache on cache warmer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants