discourse/lib/tasks
Alan Guo Xiang Tan b652f66378
DEV: Cap number of thread-loader workers in assets:precompile:build (#28830)
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 07:58:36 +08:00
..
add_topic_to_quotes.rake
admin.rake
annotate.rake DEV: Extensively use exception: true in system() (#25911) 2024-02-27 11:33:28 +01:00
api.rake
assets.rake DEV: Cap number of thread-loader workers in assets:precompile:build (#28830) 2024-09-11 07:58:36 +08:00
auto_annotate_models.rake
autospec.rake
avatars.rake DEV: Update to lastest rubocop-discourse 2024-05-27 18:06:14 +02:00
backfill.thor
categories.rake
cdn.rake
compatibility.rake DEV: Introduce rake task to validate discourse-compatibility file (#26158) 2024-03-13 13:57:41 +00:00
db.rake DEV: Migrate User#seen_notification_id to bigint (#28572) 2024-08-27 14:32:55 +03:00
destroy.rake
dev.rake
docker.rake DEV: Drop qunit timeout args (#28775) 2024-09-06 13:08:42 +02:00
documentation.rake DEV: Remove unmaintained tidy-jsdoc dependency (#25110) 2024-01-03 10:30:54 +00:00
emails.rake DEV: Update to lastest rubocop-discourse 2024-05-27 18:06:14 +02:00
emoji.rake DEV: Remove direct minitest dependency to appease ruby-lsp (#26056) 2024-03-06 15:41:14 +00:00
export.rake
groups.rake
hashtags.rake
i18n.rake
images.rake
import.rake DEV: Import script should insert more data into user_stats table (#26551) 2024-04-11 14:05:21 +02:00
incoming_emails.rake
javascript.rake DEV: Switch to pnpm for JS dependencies (#28671) 2024-09-03 10:51:07 +01: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 FIX: Move downloading of Maxmind databases to after assets:precompile (#28157) 2024-07-31 08:55:01 +08:00
plugin.rake DEV: Drop qunit timeout args (#28775) 2024-09-06 13:08:42 +02:00
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: Drop qunit timeout args (#28775) 2024-09-06 13:08:42 +02:00
redis.rake
release_note.rake DEV: Add link to PR when generating release notes 2023-09-12 09:26:46 +02:00
revisions.rake
rspec.rake
s3.rake
scheduler.rake FEATURE: call hub API to update Discourse discover enrollment. (#25634) 2024-02-23 11:42:28 +05:30
search.rake
site_settings.rake
site.rake FEATURE: Add dark mode option for category backgrounds (#24003) 2023-10-20 12:48:06 +00:00
smoke_test.rake DEV: Switch to pnpm for JS dependencies (#28671) 2024-09-03 10:51:07 +01:00
svg_icons.rake DEV: Switch to pnpm for JS dependencies (#28671) 2024-09-03 10:51:07 +01:00
svg_sprites.rake
tags.rake
themes.rake DEV: Drop qunit timeout args (#28775) 2024-09-06 13:08:42 +02:00
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 DEV: Introduce users:exists rake task (#27163) 2024-06-13 08:04:02 +01:00
version_bump.rake DEV: Update to lastest rubocop-discourse 2024-05-27 18:06:14 +02:00