Open defunctl opened 2 years ago
Ran an initial comparison using ApacheBench on my Intel MacBook:
Intel OSX 11.5.2, 32GB Docker Engine 20.10.8, Compose 1.29.2, 6CPUS, 8GB RAM, 1GB Swap
ab -n 100 -c 1 https://square1.tribe/
This is ApacheBench, Version 2.3 <$Revision: 1879490 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking square1.tribe (be patient).....done
Server Software: nginx/1.19.10
Server Hostname: square1.tribe
Server Port: 443
SSL/TLS Protocol: TLSv1.2,ECDHE-RSA-AES128-GCM-SHA256,4096,128
Server Temp Key: X25519 253 bits
TLS Server Name: square1.tribe
Document Path: /
Document Length: 29305 bytes
Concurrency Level: 1
Time taken for tests: 179.433 seconds
Complete requests: 100
Failed requests: 0
Total transferred: 2958000 bytes
HTML transferred: 2930500 bytes
Requests per second: 0.56 [#/sec] (mean)
Time per request: 1794.326 [ms] (mean)
Time per request: 1794.326 [ms] (mean, across all concurrent requests)
Transfer rate: 16.10 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 10 13 1.6 12 17
Processing: 1724 1782 64.6 1775 2386
Waiting: 1724 1781 64.6 1775 2386
Total: 1738 1794 64.9 1788 2401
Percentage of the requests served within a certain time (ms)
50% 1788
66% 1798
75% 1802
80% 1808
90% 1814
95% 1831
98% 1852
99% 2401
100% 2401 (longest request)
This is ApacheBench, Version 2.3 <$Revision: 1879490 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking square1.tribe (be patient).....done
Server Software: nginx/1.19.10
Server Hostname: square1.tribe
Server Port: 443
SSL/TLS Protocol: TLSv1.2,ECDHE-RSA-AES128-GCM-SHA256,4096,128
Server Temp Key: X25519 253 bits
TLS Server Name: square1.tribe
Document Path: /
Document Length: 29305 bytes
Concurrency Level: 1
Time taken for tests: 185.386 seconds
Complete requests: 100
Failed requests: 0
Total transferred: 2958000 bytes
HTML transferred: 2930500 bytes
Requests per second: 0.54 [#/sec] (mean)
Time per request: 1853.862 [ms] (mean)
Time per request: 1853.862 [ms] (mean, across all concurrent requests)
Transfer rate: 15.58 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 10 13 2.3 12 27
Processing: 1734 1841 115.4 1798 2478
Waiting: 1734 1841 115.5 1798 2478
Total: 1746 1854 115.7 1810 2490
Percentage of the requests served within a certain time (ms)
50% 1810
66% 1838
75% 1863
80% 1904
90% 2022
95% 2122
98% 2164
99% 2490
100% 2490 (longest request)
AFAIKT, after testing no real performance increase 😢. I also think this change is a bit too heavy handed with the restructure and would make it even more work to adapt to other hosting filesystem configurations. I'd like to discuss a bit more how we could decouple so
so it's not longer so squareone dependent but, a more flexible docker setup and using the yml file to project by project customization.
@nickpelton thank you so much for this!
Would it be too much to ask to rerun the public folder test after a system prune? I know it's a pain because you'd have to download the docker images again, but it would ensure there aren't any left over volumes hanging around that could be still mounted/skewing the results?
If it comes back the same then this change is definitely not worth it.
so global:stop-all; docker system prune --all --force --volumes
so start
AFAIKT, after testing no real performance increase cry. I also think this change is a bit too heavy handed with the restructure and would make it even more work to adapt to other hosting filesystem configurations. I'd like to discuss a bit more how we could decouple
so
so it's not longer so squareone dependent but, a more flexible docker setup and using the yml file to project by project customization.
Most of so
is already built this way, paths and commands and such can be configured on a global and/or per project basis using https://github.com/moderntribe/square1-global-docker/blob/master/config/squareone.yml
@nickpelton oh also, maybe some so composer clearcache
and so composer install
tests, given those will actually do some syncing from the container to the host?
Ran so global:stop-all; docker system prune --all --force --volumes then reran tests.
Specs: Intel OSX 11.5.2, 32GB Docker Engine 20.10.8, Compose 1.29.2, 6CPUS, 8GB RAM, 1GB Swap
ab -n 100 -c 1 https://square1.tribe/
Test 1: Original Configuration (main)
ab -n 100 -c 1 https://square1.tribe/
Time taken for tests: 33.392 seconds
min mean[+/-sd] median max
Connect: 9 11 1.7 10 18
Processing: 255 323 68.4 301 603
Waiting: 255 323 68.3 301 601
Total: 266 334 69.6 313 618
Test 2: Public (testing/public-folder)
ab -n 100 -c 1 https://square1.tribe/
Time taken for tests: 30.169 seconds
Connection Times (ms)
min mean[+/-sd] median max
Connect: 9 10 1.0 10 15
Processing: 264 292 25.6 286 460
Waiting: 264 292 25.6 286 460
Total: 274 302 26.1 296 471
Now that's very interesting about the prune making things significantly faster all around.
However, the mean is 9.6% faster and the max is 23% faster. That's not insignificant.
I don't think anyone on a mac is getting sub 500ms loading times period though.
If you have time tomorrow, would love to do some pair coding so I can check a few things.
What does this do/fix?
Moves only what needs to be in the PHP-FPM container into a
public
folder, reducing the amount of files inside the container and in theory, having some performance improvement for macOS users. Things likenode_modules
which has so many files that do not need to be in the container and contribute to large copies and slow downs.This PR is more to just start the discussion and have some of those with slower machines give it a test and see if they notice any differences and to see if this change would be worth it long term.
So any of you with
so
and a Mac, would love a before/after comparison, if possible, please!Enough of these small improvements will add up to a faster local, and a single mounted folder will make a more complete performance solution easier to implement.
Benchmark instructions
Before switching to this branch, get a feel for loading times after caches have been primed. The page load time chrome extension is great for this.
so xdebug off
so composer install
Testing instructions
so stop
.env
file into public (so
would need to be updated to account for this)so start
so xdebug off