Reduce default concurrency for musl thread over-subscription

https://github.com/lovell/sharp-libvips/issues/229
This commit is contained in:
Lovell Fuller
2024-04-30 19:14:13 +01:00
parent 93c615d39f
commit da655a1859
2 changed files with 5 additions and 0 deletions

View File

@@ -153,6 +153,9 @@ function concurrency (concurrency) {
if (detectLibc.familySync() === detectLibc.GLIBC && !sharp._isUsingJemalloc()) {
// Reduce default concurrency to 1 when using glibc memory allocator
sharp.concurrency(1);
} else if (detectLibc.familySync() === detectLibc.MUSL && sharp.concurrency() === 1024) {
// Reduce default concurrency when musl thread over-subscription detected
sharp.concurrency(require('node:os').availableParallelism());
}
/**