-
Notifications
You must be signed in to change notification settings - Fork 27
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
Opcache optimization #1019
Opcache optimization #1019
Conversation
In production, PHP files are never checked for modification on the filesystem. They are simply read into the PHP Opcache, and used from cache. (fast) Also, There is less verbose logging in production. This switch allows for easier enabling of features like profiling that may only ever be used in development.
Feature optimize opcache
Add Opcache status monitor
@freephile can you take a look at this? It's all your commits, plus some changes I've made. I'm testing it on one of my dev servers over the next day or so. If all is well I'll merge later in the week (maybe tomorrow). Some minor changes I want to make before merging into
|
I changed the var name to The following situations will be handled in jobs 1 through 5:
|
Yay, looks good. 👍 I'll try to get to the documentation on mw.org but have a million things on my @todo list. One important aspect to document is that validate frequency and validation on/off go together: you can have frequency every millisecond.... but if (file change) validation is off, then nothing will get checked. No validation is perfect for fast production servers. Validation on every request is perfect for development. |
@freephile after two days on production (which isn't really enough to make any definitive statements from) our median page load time is unchanged, and our average page load time is up about 20%. Do you have any data on improvements from using these settings? I'm going to let a few more days play out and see what happens, then I'll tweak the settings a bit to see what happens. The |
Here's our data on the page response times of our largest internal wiki, 7 weekdays prior to the opcache changes and 4 weekdays after. I've thrown out all data points not during regular business hours, since the traffic is low which makes the data more chaotic (the first hit after an hour of inactivity takes considerably longer). Note that we make extensive use of Semantic MediaWiki, with many queries per page. This considerably slows down our response times. Blue dots are actual page hits. Black line is median of the last 1000 hits. Red is average of the last 1000 hits. @freephile any insights? |
I think the issue w opcache is too many files allocated. If it reserves too much memory, leaving less memory for Apache / MySQL, then it could impact performance with more I/O (swapping) or waiting as these memory hungry beasts have less to "eat". There is a big curve (long tail) for the application in terms of files and code paths so that say 50% of the files are used 90% of the time, while the other 50% of files are special cases. e.g. all admin functions are used far less than regular views. Some files will hardly ever be accessed, and thus won't really benefit from being cached. So, in short, try adjusting your file allocation way down to ~3,000 and see what happens compared to 6,000, 12,000. |
Copy that. I'm going to let another day or so play out to get the data, then I'll start tweaking settings to see how things go. Did you measure improvements from these changes? |
I do not have current metrics to show before/after comparisons. I believe I took some a while ago. Anyway, I'll have a chance to compare and test a few implementations between now and December. |
Actually I'm having some weird behavior. It appears that opcache is not picking up all the changes to
But
Changing these values in The following settings in
And here's a copy/paste of their values from
|
Here's the problem: https://serverfault.com/questions/813208/opcache-ignoring-certain-settings-in-php-ini-after-httpd-restart Basically, |
Changes
m_use_production_settings
which isTrue
orFalse
. At this point, it really only controls PHP's opcache. It could be used for other general dev versus prod settings. It defaults to production settings (faster opcache, more annoying for development)m_use_production_settings
toTrue
by default if not specified, and is specified asTrue
in the baselinepublic.yml
. In Vagrant'spublic.yml
it is set toFalse
.m_use_production_settings
isTrue
, you must now eithersudo systemctl reload httpd
(preferred for production setups) orsudo systemctl restart httpd
(may cause current client's requests to fail) in order for Apache to be made aware of any changes to any PHP files. If you modify a PHP file your server will not see this change until Apache is reloaded/restarted.deploy
to pick up any changes to PHP filespublic.yml
and suchServerPerformance/opcache.php
for monitoring opcache. Ultimately this should be moved into a restricted special page, just like everything inServerPerformance
.Issues
Post-merge actions
Post-merge, the following actions need to be addressed:
m_use_production_settings: True
and its impact onopcache.validate_timestamps