Skip to content

[Cache] Added PhpFilesAdapter #18894

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 2 commits into from
Jun 6, 2016

Conversation

nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented May 26, 2016

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 is taking over #18832.
With a warm cache I get these numbers consistently (PhpArrayAdapter being the implem in #18823 ):

Fetching randomly 5000 items 10000 times:

 Symfony\Component\Cache\Adapter\FilesystemAdapter: 0.1367,    2 megabytes
   Symfony\Component\Cache\Adapter\PhpArrayAdapter: 0.0071,    2 megabytes
   Symfony\Component\Cache\Adapter\PhpFilesAdapter: 0.0389,    2 megabytes
       Symfony\Component\Cache\Adapter\ApcuAdapter: 0.0361,    2 megabytes

This means that the PhpArrayAdapter should be used first, then ApcuAdapter preferred over PhpFilesAdapter, then FilesystemAdapter. This is what AbstractAdapter does here.

Also note that to get the cache working, one should stay within the limits defined by the following ini settings:

  • memory_limit
  • apc.shm_size
  • opcache.memory_consumption
  • opcache.interned_strings_buffer
  • opcache.max_accelerated_files

@nicolas-grekas nicolas-grekas changed the title Cache php files [Cache] Added OpcacheAdapter May 26, 2016
@nicolas-grekas nicolas-grekas force-pushed the cache-php-files branch 3 times, most recently from 42275fa to 5cc86c6 Compare May 27, 2016 06:30
@dunglas
Copy link
Member

dunglas commented May 28, 2016

👍

@nicolas-grekas nicolas-grekas changed the title [Cache] Added OpcacheAdapter [Cache] Added PhpFilesAdapter May 29, 2016
@nicolas-grekas
Copy link
Member Author

I renamed this one back to PhpFilesAdapter, and I think #18823 should be renamed PhpArrayAdapter.

@nicolas-grekas nicolas-grekas force-pushed the cache-php-files branch 4 times, most recently from 0191b2e to 7cd6e18 Compare May 30, 2016 10:35
@xabbuh
Copy link
Member

xabbuh commented Jun 5, 2016

👍

@nicolas-grekas nicolas-grekas merged commit 8983e83 into symfony:master Jun 6, 2016
nicolas-grekas added a commit that referenced this pull request Jun 6, 2016
This PR was merged into the 3.2-dev branch.

Discussion
----------

[Cache] Added PhpFilesAdapter

| 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 is taking over #18832.
With a warm cache I get these numbers consistently (PhpArrayAdapter being the implem in #18823 ):
```
Fetching randomly 5000 items 10000 times:

 Symfony\Component\Cache\Adapter\FilesystemAdapter: 0.1367,    2 megabytes
   Symfony\Component\Cache\Adapter\PhpArrayAdapter: 0.0071,    2 megabytes
   Symfony\Component\Cache\Adapter\PhpFilesAdapter: 0.0389,    2 megabytes
       Symfony\Component\Cache\Adapter\ApcuAdapter: 0.0361,    2 megabytes
```

This means that the PhpArrayAdapter should be used first, then ApcuAdapter preferred over PhpFilesAdapter, then FilesystemAdapter. This is what AbstractAdapter does here.

Also note that to get the cache working, one should stay within the limits defined by the following ini settings:
- memory_limit
- apc.shm_size
- opcache.memory_consumption
- opcache.interned_strings_buffer
- opcache.max_accelerated_files

Commits
-------

8983e83 [Cache] Optimize & wire PhpFilesAdapter
14bcd79 [Cache] Added PhpFilesAdapter
@nicolas-grekas nicolas-grekas deleted the cache-php-files branch June 6, 2016 08:11
@teohhanhui
Copy link
Contributor

Does the user need to set opcache.enable_cli = 1 for this to work?

@nicolas-grekas
Copy link
Member Author

No: you can warmup in the cli without having opcache enabled for the cli

@fabpot fabpot mentioned this pull request Oct 27, 2016
weaverryan added a commit to symfony/symfony-docs that referenced this pull request Jan 28, 2017
…weaverryan)

This PR was merged into the 3.2 branch.

Discussion
----------

Covering two missing Cache adapters introduced in 3.2

Hi guys!

These are 2 missing adapters that were introduced in 3.2! symfony/symfony#18894 and symfony/symfony#18823

Cheers!

Commits
-------

a3e69e2 Tweaks based on feedback!
1b6cb69 Covering two missing adapters introduced in 3.2
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.

6 participants