-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[currencyservice] Create multiple build jobs to optimize build time #569
[currencyservice] Create multiple build jobs to optimize build time #569
Conversation
Create multiple build jobs to run the build in parallel and optimize build time. Different commands are needed to find the number of available CPU cores per OS. make -j$(nproc || sysctl -n hw.ncpu || echo 1) - Uses nproc on Linux - Uses sysctl -n hw.ncpu on macOS - Uses 1 core for others Currency service had the longest build times among the Demo App services. Rough build time improvements with this change: Linux, docker (Ryzen 5 5600G): 1000 s -> 400 s. macOS, docker desktop (M1 Pro): 750 s -> 450 s.
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.
Awesome!
docker compose build currencyservice ||| Building 553.7s (14/14) FINISHED
No real change on my personal machine. But it's a basic macbook air m2 sku |
it did improve build time by ~36 seconds and any improvement is welcome |
@cartersocha, it can be that Docker Desktop allocates only 2 CPUs by default (for MacBook Air). In that case, this PR makes no difference. You can check this from Docker Desktop Preferences/Resources and allocate more. You should get faster build times when you give more than 2 CPUs. |
Ahh of course thanks. I overlooked that. Should we document a cpu recommendation in the docker or contributor file? Bumping my cpus up to 5 + your updates dropped my build time to ~830 seconds from ~1150. Ideally we still make perf improvements to currency, feature flag, and shipping services regardless |
Changes
Create multiple build jobs to run the currency service build in parallel and optimize build time.
Different commands are needed to find the number of available CPU cores per OS.
make -j$(nproc || sysctl -n hw.ncpu || echo 1)
nproc
on Linuxsysctl -n hw.ncpu
on macOSBackground
Currency service had the longest build time among the Demo App services.
Rough build time improvements with this change:
Measured with:
docker compose build currencyservice --no-cache
CHANGELOG.md
updated for non-trivial changes