-
Notifications
You must be signed in to change notification settings - Fork 535
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
Faster post build startup: #22938
Faster post build startup: #22938
Conversation
3a46ba8
to
4a23996
Compare
|
5d26929
to
84d2a02
Compare
- Updated docker-compose files to use named volumes instead of bind mounts for better portability and consistency. - Introduced a new healthcheck script to monitor the status of the Celery worker and web service. - Removed deprecated healthcheck configurations from services in docker-compose.yml. - Adjusted Makefile to better separate the up recipe and include new healtch check in initialize recipe - Cleaned up Dockerfile by linking package.json and package-lock.json to the correct paths.
84d2a02
to
aa88f30
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got a little lost during the test steps a few times so I don't really have comparable figures for all the steps, but my time make up
after a make down
and changing a file in `./src/ is
real 1m52.840s
user 0m2.189s
sys 0m1.734s
which is somewhat of an improvement - but not quite as speedy as your figures.
fwiw, [+] Building 45.6s (29/29) FINISHED
- so the docker part is 45 seconds; the rest is the django initialization (even with no migrations, it takes a little bit of time) + es reindexing, pretty much.
@@ -65,7 +65,8 @@ jobs: | |||
version: ${{ matrix.version }} | |||
compose_file: ${{ matrix.compose_file }} | |||
EOF | |||
- uses: ./.github/actions/run-docker | |||
- name: ${{ matrix.version == 'local' && 'Uncached Build' || 'Pull' }} Check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the syntax support brackets? It's not immediately obvious to me (or future me) if it's doing (A and B) or C
or A and (B or C)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is pretty standard JS syntax afaik (GHA operators), it's the first one. The statements are evaluated left to right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, it's 'Uncached build' if matrix.version == 'local' else 'Pull'
in python syntax
Yeah the goal of this PR is to make the 2 and 3 of the 3 steps faster. It doesn't really impact the build itself. The "better" way of measuring the impact here would be to make the changes to the make recipes first, then time the original state, and then add the changes on this patch so you can get per phase timing... It's faster. At the end of this epic I plan to test the July state of the code to the end state and we can get some real data on the impact. |
- Updated docker-compose files to use named volumes instead of bind mounts for better portability and consistency. - Introduced a new healthcheck script to monitor the status of the Celery worker and web service. - Removed deprecated healthcheck configurations from services in docker-compose.yml. - Adjusted Makefile to better separate the up recipe and include new healtch check in initialize recipe - Cleaned up Dockerfile by linking package.json and package-lock.json to the correct paths.
Fixes: mozilla/addons#15239
Description
Context
Faster post build by parallelizing initialize and startup
Testing
Verify time of startup
You can run the steps of the build independently to get a feel for relative times.
Try building the image first without cache.
Warning
This is an aggressive command that will clear local images/volumes and docker state
time make up_pre
Check the time, then run the command again. The second time should be much, much faster.
Try it after changing a file in
./src
this will invalidate some of the cache and give a more realistic cached time.Now start the containers, running
time make up_start
The first time, it should take some time to download images. Run it again and it should be quite fast.
Note
Before running the second time, run
make down
so that the containers are not running but are pulled.Now run the initialize command to initialize the container state and ensure everything is healthy.
time make up_post
If you have a truly clean environment this could take some time as it must migrate and populate the database. Run it again and it should be relatively fast.
Verify no anonymous or unnamed volumes
You can independently verify the non existence of anonymous volumes via this query that returns volumes from all containers that are:
Checklist
#ISSUENUM
at the top of your PR to an existing open issue in the mozilla/addons repository.