Skip to content

Conversation

@ChristophWurst
Copy link
Member

@ChristophWurst ChristophWurst commented Jan 12, 2023

  • Resolves: n/a

Summary

Shipped apps in this repo have their own authorative (optimized) composer autoloader. But not all of them. The apps still work, but we need a dynamic PSR4 autoloader that has to access the filesystem to check for class existence. Furthermore I'm assuming that with each app autoloader we add, there is a chance that multiple autoloaders try to load a certain file.

By adding the few missing autoloaders I was able to reduce php occ runtime by 1%. GET <host>/status.php improved from 330.20 requests per second to 344.20 request per second or 4.2%.

The autoloader was missing for the following apps

I assume that distributed Nextcloud setups with the php code on shared storage will see an even bigger performance improvement.

100xphp occ benchmark

time for i in `seq 1 100`; do php occ; done

Details

100x occ before

real 0m50,214s
user 0m43,513s
sys 0m6,638s

100x occ after

real 0m49,866s
user 0m43,296s
sys 0m6,529s

Apache Bench

ab -n 10000 -c 20 https://localhost/status.php

Details

Before

$ ab -n 10000 -c 20 https://localhost/status.php
This is ApacheBench, Version 2.3 <$Revision: 1901567 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests


Server Software:        nginx/1.22.1
Server Hostname:        localhost
Server Port:            443
SSL/TLS Protocol:       TLSv1.2,ECDHE-RSA-AES256-GCM-SHA384,4096,256
Server Temp Key:        X25519 253 bits
TLS Server Name:        localhost

Document Path:          /status.php
Document Length:        174 bytes

Concurrency Level:      20
Time taken for tests:   30.285 seconds
Complete requests:      10000
Failed requests:        0
Total transferred:      14089962 bytes
HTML transferred:       1740000 bytes
Requests per second:    330.20 [#/sec] (mean)
Time per request:       60.570 [ms] (mean)
Time per request:       3.029 [ms] (mean, across all concurrent requests)
Transfer rate:          454.34 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        7   16   8.4     13     134
Processing:    19   44  15.2     41     170
Waiting:       19   44  15.2     41     169
Total:         28   60  16.2     57     282

Percentage of the requests served within a certain time (ms)
  50%     57
  66%     62
  75%     66
  80%     68
  90%     77
  95%     88
  98%    108
  99%    121
 100%    282 (longest request)

After

$ ab -n 10000 -c 20 https://localhost/status.php
This is ApacheBench, Version 2.3 <$Revision: 1901567 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests


Server Software:        nginx/1.22.1
Server Hostname:        localhost
Server Port:            443
SSL/TLS Protocol:       TLSv1.2,ECDHE-RSA-AES256-GCM-SHA384,4096,256
Server Temp Key:        X25519 253 bits
TLS Server Name:        localhost

Document Path:          /status.php
Document Length:        174 bytes

Concurrency Level:      20
Time taken for tests:   29.053 seconds
Complete requests:      10000
Failed requests:        0
Total transferred:      14090218 bytes
HTML transferred:       1740000 bytes
Requests per second:    344.20 [#/sec] (mean)
Time per request:       58.106 [ms] (mean)
Time per request:       2.905 [ms] (mean, across all concurrent requests)
Transfer rate:          473.62 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        7   15   7.3     12      88
Processing:    17   43  13.8     40     143
Waiting:       17   43  13.9     40     143
Total:         28   58  14.1     55     213

Percentage of the requests served within a certain time (ms)
  50%     55
  66%     59
  75%     63
  80%     65
  90%     73
  95%     84
  98%    102
  99%    112
 100%    213 (longest request)

Checklist

Copy link
Member

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

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

👍 nice catch

any reason why our build autoloader script did not cover those ? otherwise CI would have caught this discrepancy, would be good to add a step there for that

@ChristophWurst
Copy link
Member Author

any reason why our build autoloader script did not cover those ? otherwise CI would have caught this discrepancy, would be good to add a step there for that

if [[ -e ${app}/composer/composer.json ]]; then

Only apps that have the composer file are checked

Copy link
Member

@juliusknorr juliusknorr left a comment

Choose a reason for hiding this comment

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

files_external seems to have some issues still according to CI:

Migration step 'OCA\Files_External\Migration\Version1011Date20200630192246' is unknown
15

@ChristophWurst
Copy link
Member Author

otherwise CI would have caught this discrepancy, would be good to add a step there for that

Added

@ChristophWurst
Copy link
Member Author

files_external seems to have some issues still according to CI:

Migration step 'OCA\Files_External\Migration\Version1011Date20200630192246' is unknown 15

Typo in the PSR4 spec

@ChristophWurst ChristophWurst force-pushed the fix/autoloader/missing-shipped-apps-autoloaders branch from a54e6f9 to 53a5f35 Compare January 12, 2023 11:27
@ChristophWurst ChristophWurst force-pushed the fix/autoloader/missing-shipped-apps-autoloaders branch from 8c58025 to f9b8e2d Compare January 20, 2023 14:20
@ChristophWurst ChristophWurst force-pushed the fix/autoloader/missing-shipped-apps-autoloaders branch from f9b8e2d to f4ff908 Compare January 30, 2023 14:33
@ChristophWurst
Copy link
Member Author

CI is not happy about the theming app changes :s

@ChristophWurst
Copy link
Member Author

#36652 is left. This meta PR is obsolete.

@ChristophWurst ChristophWurst deleted the fix/autoloader/missing-shipped-apps-autoloaders branch March 17, 2023 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Development

Successfully merging this pull request may close these issues.

7 participants