Skip to content
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

Enable opcache by default #160

Closed
mnapoli opened this issue Jan 12, 2019 · 7 comments
Closed

Enable opcache by default #160

mnapoli opened this issue Jan 12, 2019 · 7 comments
Assignees
Milestone

Comments

@mnapoli
Copy link
Member

mnapoli commented Jan 12, 2019

Let's enable opcache by default as it brings performance improvements at no cost.

@mnapoli mnapoli added this to the 0.3 milestone Jan 12, 2019
@bubba-h57
Copy link
Contributor

Just need to keep in mind that if we enabled a shared extension at the Layer, it can not be disabled by the developer in their project. It would require another layer to disable.

Not that I can think of why anyone would want to disable opcache.

@sandrokeil
Copy link

Not that I can think of why anyone would want to disable opcache

Maybe if Lambda memory hits the limit. But it depends on running application e.g. full stack framework vs. simple cron worker. What for default opcache.memory_consumption should we use?

Have we experience/benchmarks how opcache works with Lambda? If the Lambda is warm, is opcache shared between requests?

@bubba-h57
Copy link
Contributor

Good questions. I have no experience with it (in lambda) myself, and now that you ask the question, it does seem to present some challenges. Especially given that the cache is in shared memory, we would need to do some testing to ensure that the cache persists from one request to the next. If we are caching, and then not actually using the cache, it would just be overhead.

Default memory_consumption is another excellent question. I think we would have to set that to a very conservative amount, assuming the function runs with the smallest amount of ram possible. Then, the developer would be free to change that setting.

It appears that testing is in order.

@mnapoli
Copy link
Member Author

mnapoli commented Jan 14, 2019

Opcache on lambda was introduced in #14, I did some testing with API Platform (on Symfony 4).

Here is the optimized php.ini with the values explained in comments: https://github.com/mnapoli/bref/blob/32aac1b8f1f488a998f45a0f0d0544b8a505f51b/template/php.ini

In Bref 0.2 PHP was only really usable with 1Gb Lambdas and up so this is why I didn't care that much about the numbers. But maybe we could tone down the memory limit.

Also I've updated those configs in #155 to differentiate between a FPM-optimized config and a CLI one.

@mnapoli
Copy link
Member Author

mnapoli commented Jan 14, 2019

About the initial question, I see no reason to disable opcache in the common use cases.

@sandrokeil
Copy link

Alright, using opcache filecache is the key. 👍

@mnapoli
Copy link
Member Author

mnapoli commented Jan 27, 2019

Opcache is enabled, this is tested and now documented (in #206).

🎉

@mnapoli mnapoli closed this as completed Jan 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants