mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 11:23:25 +08:00
b652f66378
We were running into errors running `ember build` on machines with high CPU counts. It was then noted that `thread-loader`, which embroider uses, defaults to spinning up x workers where x is number of physical CPU cores - 1. That is probably too much so we set out to find out an optimial count to set for the `JOBS` env which embroider will use to set the number of `thread-loader` workers. I first built an image using the following Dockerfile. ``` FROM discourse/base:release RUN cd /var/www/discourse && sudo -EH -u discourse bundle exec rake plugin:install_all_official RUN cd /var/www/discourse && sudo -EH -u discourse bundle exec rake assets:precompile:prereqs ``` I then ran the following command on my M3 Max Macbook Pro that has 14 phyisal CPU cores. ``` for j in 1 2 4 8 14; do echo "JOBS=$j"; time docker run --rm -it -e JOBS=$j test:latest /bin/bash -c "su discourse -c 'cd /var/www/discourse && bundle exec rake assets:precompile:build'"; done ``` These are the results I got: ``` JOBS=1 0.04s user 0.03s system 0% cpu 1:01.92 total JOBS=2 0.04s user 0.02s system 0% cpu 42.605 total JOBS=4 0.04s user 0.02s system 0% cpu 37.012 total JOBS=8 0.04s user 0.02s system 0% cpu 35.199 total JOBs=14 0.04s user 0.02s system 0% cpu 37.941 total ``` We think JOBS=2 is a good default when the `JOBS` env has not been set. Anything above just consumes more resources for little benefit. |
||
---|---|---|
.. | ||
add_topic_to_quotes.rake | ||
admin.rake | ||
annotate.rake | ||
api.rake | ||
assets.rake | ||
auto_annotate_models.rake | ||
autospec.rake | ||
avatars.rake | ||
backfill.thor | ||
categories.rake | ||
cdn.rake | ||
compatibility.rake | ||
db.rake | ||
destroy.rake | ||
dev.rake | ||
docker.rake | ||
documentation.rake | ||
emails.rake | ||
emoji.rake | ||
export.rake | ||
groups.rake | ||
hashtags.rake | ||
i18n.rake | ||
images.rake | ||
import.rake | ||
incoming_emails.rake | ||
javascript.rake | ||
list_email_templates_strings.rake | ||
log.rake | ||
maxminddb.rake | ||
plugin.rake | ||
populate.rake | ||
populate.thor | ||
posts.rake | ||
profile.rake | ||
qunit.rake | ||
redis.rake | ||
release_note.rake | ||
revisions.rake | ||
rspec.rake | ||
s3.rake | ||
scheduler.rake | ||
search.rake | ||
site_settings.rake | ||
site.rake | ||
smoke_test.rake | ||
svg_icons.rake | ||
svg_sprites.rake | ||
tags.rake | ||
themes.rake | ||
topics.rake | ||
turbo.rake | ||
typepad.thor | ||
uploads.rake | ||
users.rake | ||
version_bump.rake |