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

WIP: Testing/public folder #931

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

WIP: Testing/public folder #931

wants to merge 3 commits into from

Conversation

defunctl
Copy link
Collaborator

@defunctl defunctl commented Feb 1, 2022

What does this do/fix?

This is currently just for testing purposes, not all features will work without a few adjustment to so!

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 like node_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.

NOTE: First page loads on the frontend/wp-admin will prime some caches, so just make note of load times after that.

  1. Take xdebug out of the equation with so xdebug off
  2. Browse around the frontend
  3. Browse around wp-admin
  4. Visually bench mark so composer install

Testing instructions

  1. so stop
  2. git pull / checkout this branch
  3. copy your root .env file into public (so would need to be updated to account for this)
  4. so start
  5. so xdebug off
  6. Repeat benchmark instructions

@nickpelton
Copy link
Contributor

Ran an initial comparison using ApacheBench on my Intel MacBook:

Specs:

Intel OSX 11.5.2, 32GB
Docker Engine 20.10.8, Compose 1.29.2, 6CPUS, 8GB RAM, 1GB Swap

Apache Bench Test - 100 requests, 1 concurrent

ab -n 100 -c 1 https://square1.tribe/

Outcome - No performance increase

Test 1: Original Configuration (main)

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)

Test 2 - public folder (testing/public-folder)

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)

@nickpelton
Copy link
Contributor

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.

Copy link
Contributor

@nickpelton nickpelton left a comment

Choose a reason for hiding this comment

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

Hold for discussion

@defunctl
Copy link
Collaborator Author

@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

@defunctl
Copy link
Collaborator Author

defunctl commented Feb 10, 2022

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

@defunctl
Copy link
Collaborator Author

@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?

@nickpelton nickpelton closed this Feb 11, 2022
@nickpelton
Copy link
Contributor

Test 2

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

Apache Bench Test - 100 requests, 1 concurrent

ab -n 100 -c 1 https://square1.tribe/

Outcome - Ran (way) faster due to the prune command, but no real performance change.

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

@nickpelton nickpelton reopened this Feb 11, 2022
@defunctl
Copy link
Collaborator Author

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.

@dpellenwood dpellenwood removed their request for review April 27, 2022 18:26
@defunctl defunctl mentioned this pull request Jun 29, 2022
3 tasks
@lindseyolson lindseyolson removed their request for review April 20, 2023 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants