-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Create a checksum of the config file in memory. #34099
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
Conversation
This fixes a massive performance bug when opcache is enabled. I have tested it on the stable version. I copy-pasted the changes on the master branch. Please test it on the master branch and tell me if it worked. Signed-off-by: Mateus de Lima Oliveira <[email protected]>
|
Hi @M4t3uz 👋 ,
Can you tell us a bit more about this performance bug? I assume that Opcache is enabled for most production instances out there and don't remember an issue here on GitHub about a massive performance bug when opcache is enabled. I understand your patch and the idea "don't write the configuration file another time when the content is the same" makes sense to me. On the other hand it's new to me that something is changing the configuration regularly 😕 |
| * config file data has been changed therefore all the other | ||
| * code that depend on the the config file opcode will not | ||
| * be recompiled. */ | ||
| $data = var_export($this->cache, true); |
Check failure
Code scanning / Psalm
TaintedHtml
| * config file data has been changed therefore all the other | ||
| * code that depend on the the config file opcode will not | ||
| * be recompiled. */ | ||
| $data = var_export($this->cache, true); |
Check failure
Code scanning / Psalm
TaintedHtml
|
Hello @kesselb 👋 Some apps and cron.php update the config file by setting some entries on the config to the same value. The writeData() method calls a php function to invalidate the config file on the opcache. So all the other files that include config.php and those that include them (and so on...) need to be recompiled too. My instance has only recommended apps from the store. You can try to install them all and you'll see that Nextcloud stable gets slow after a while without activity. The next time some user tries to use the web interface after a while without activity on the instance they experience a very long delay of about from 7 to 12 seconds. I'm running Nextcloud stable on Debian 11. I experienced a major speed improvement. |
Removed static typing. It caused some build tests to fail. Co-authored-by: Daniel <[email protected]> Signed-off-by: Mateus de Lima Oliveira <[email protected]>
Line 158 in c2dafb0
Setting the same value will not trigger a write operation.
Good summary 👍
Would you mind to share the installed apps with us? I don't see that my production instance is updating the config.php itself. It's usually the timestamp when I installed the last update. |
|
I had all the recommended apps from the stable version installed. No other apps were installed. I can't provide a list of the recommended apps because I would have to copy-and-paste one by one from the apps page. I installed some more apps after the patch. I'm testing on this one right now and it works fine: Enabled:
|
opcache must only be reset if there needs upgrade AND maintenance is true. Signed-off-by: Mateus de Lima Oliveira <[email protected]>
Fixed opcache reset performance bug
|
|
|
OK, here is some more information, @kesselb.
OS: Linux 5.10.0-18-amd64 x86_64 PHP Database
It seems that there is an error in the very same code you mentioned.
shoud be
I have tested changing it and it sppeds my instance up even more as crc32() does not need to be calculated. |
Disabled updates on the configuration of the same values with diferent types. Signed-off-by: Mateus de Lima Oliveira <[email protected]>
|
Hey @M4t3uz, I hope my questions did not drive you away. Did you find a solution? |
|
You din't drive me away. Don't worry. :) I made some mistakes like creating a pull request from the master and merging the same commit twice. So I decided to create a diff and fork the project from scratch. My Nextcloud instance is running blazing fast with many plugins installed. The storage is on a mount of a remote filesystem. It is basically just a bunch of optimizations. I made plenty of changes on the stable24 branch but they were incompatible with the master branch. I will test it more appropriately on my branch and then I will make a new pull request. I hope you people at the Nextcloud project will like it. |
@M4t3uz I am relunctant to change this equality check but would be very interested in the values that triggers it. |
This fixes a massive performance bug when opcache is enabled.
I have tested it on the stable version. I copy-pasted the changes on the master branch. Please test it on the master branch and tell me if it worked.
Signed-off-by: Mateus de Lima Oliveira [email protected]