diff options
author | Alexander Kanavin <alex@linutronix.de> | 2024-11-21 14:42:18 +0100 |
---|---|---|
committer | Steve Sakoman <steve@sakoman.com> | 2024-11-30 05:41:59 -0800 |
commit | 8282240ec185ac99f94ae8c11c51b52a63549992 (patch) | |
tree | 2a0edda7f43ea0059e8dbb473f5bc4f23b61cf72 | |
parent | 3f6f82ababec122d5d32d58fde96b287f4cb3f59 (diff) | |
download | poky-8282240ec185ac99f94ae8c11c51b52a63549992.tar.gz |
package_rpm: restrict rpm to 4 threads
TL;DR version:
with this, and the previous compression level changes
I am seeing drastic speedups in package_write_rpm completion times:
webkitgtk goes from 78 seconds to 37 seconds
glibc-locale goes from 399 seconds to 58 seconds (!)
The long version:
rpm uses multithreading for two purposes:
- spawning compressors (which are nowadays themselves
multi-threaded, so the feature is not as useful as it once
was)
- parallel file classification
While the former behaves well on massively parallel CPUs
(it was written and verified here :), the latter was then added
by upstream and only benchmarked on their very old, slow laptop,
apparently:
https://github.com/rpm-software-management/rpm/commit/41f0e214f2266f02d6185ba11f797716de8125d4
On anything more capable it starts showing pathologic behavior,
presumably from spawning massive amount of very short-lived threads,
and then having to synchronize them. For example classifying glibc-locale
takes
5m20s with 256 threads (default on my machine!)
1m49s with 64 threads
59s with 16 threads
48s with 8 threads
Even a more typical recipe like webkitgtk is affected:
47s with 256 threads
32s with 64 threads
27s with 16 or 8 threads
I have found that the optimal amount is actually four: this also
means that only four compressors are running at a time, but
as they're themselves using threads, and typical recipes are dominated
by just two or three large packages, this does not affect overall
completion time.
(From OE-Core rev: ac480775440fba812fd5aa9da73e0e5bc60d46d6)
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r-- | meta/classes-global/package_rpm.bbclass | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/meta/classes-global/package_rpm.bbclass b/meta/classes-global/package_rpm.bbclass index b2b7fafa17..021c53593f 100644 --- a/meta/classes-global/package_rpm.bbclass +++ b/meta/classes-global/package_rpm.bbclass | |||
@@ -696,6 +696,7 @@ python do_package_rpm () { | |||
696 | cmd = cmd + " --define '_use_internal_dependency_generator 0'" | 696 | cmd = cmd + " --define '_use_internal_dependency_generator 0'" |
697 | cmd = cmd + " --define '_binaries_in_noarch_packages_terminate_build 0'" | 697 | cmd = cmd + " --define '_binaries_in_noarch_packages_terminate_build 0'" |
698 | cmd = cmd + " --define '_build_id_links none'" | 698 | cmd = cmd + " --define '_build_id_links none'" |
699 | cmd = cmd + " --define '_smp_ncpus_max 4'" | ||
699 | cmd = cmd + " --define '_source_payload %s'" % rpmbuild_compmode | 700 | cmd = cmd + " --define '_source_payload %s'" % rpmbuild_compmode |
700 | cmd = cmd + " --define '_binary_payload %s'" % rpmbuild_compmode | 701 | cmd = cmd + " --define '_binary_payload %s'" % rpmbuild_compmode |
701 | cmd = cmd + " --define 'clamp_mtime_to_source_date_epoch 1'" | 702 | cmd = cmd + " --define 'clamp_mtime_to_source_date_epoch 1'" |