discourse/lib/tasks
Alan Guo Xiang Tan a21c68b7f3
DEV: Cap number of thread-loader workers in assets:precompile:build (#28830) (#28836)
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.
2024-09-11 09:04:04 +08:00
..
add_topic_to_quotes.rake
admin.rake
annotate.rake
api.rake
assets.rake DEV: Cap number of thread-loader workers in assets:precompile:build (#28830) (#28836) 2024-09-11 09:04:04 +08:00
auto_annotate_models.rake
autospec.rake
avatars.rake
backfill.thor
categories.rake
cdn.rake
compatibility.rake
db.rake DEV: Migrate notifications#id and related columns to bigint (#28584) 2024-08-29 18:06:55 +03:00
destroy.rake
dev.rake
docker.rake PERF: Update docker:test to run QUnit with more cores if available (#27816) 2024-07-10 11:27:20 +08:00
documentation.rake
emails.rake
emoji.rake
export.rake
groups.rake
hashtags.rake
i18n.rake
images.rake
import.rake
incoming_emails.rake
integration.rake
javascript.rake UX: Use a dropdown for SSL mode for group SMTP (#27932) 2024-07-18 10:33:14 +10:00
list_email_templates_strings.rake FIX: Add new/missing email templates to the email templates editor (#28075) 2024-07-30 00:27:41 +03:00
log.rake
maxminddb.rake
plugin.rake
populate.rake
populate.thor
posts.rake UX: Add a rake task to monitor progress for long rebakes (#27517) 2024-07-03 07:52:47 +10:00
profile.rake
qunit.rake DEV: Upgrade the MessageFormat library (JS) 2024-07-10 09:51:25 +02:00
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 DEV: Resolve TODO comments for martin-brennan 2024-07-01 15:32:30 +10:00
users.rake
version_bump.rake