Skip to content

Switching concurrency from cpucount to 1 increated performance. Looking for an explanation #2481

@wardpeet

Description

@wardpeet

What are you trying to achieve?

At Gatsy we are playing with sharp's concurrency and queue'ing. It seems limitting sharp to 1 cpu (thread?) makes image generation faster for us. I've read https://sharp.pixelplumbing.com/api-utility#concurrency but still unsure what's the cause of it is. In my head concurrency should make things faster if you have multiple transforms for 1 image.

Anything we should be aware of when setting it to 1? Is this expected behaviour? How can we optimize sharp even more?

Have you searched for similar questions?
#2322

Are you able to provide a minimal, standalone code sample that demonstrates this question?
gatsbyjs/gatsby#28575

Are you able to provide a sample image that helps explain the question?

With concurrency = cpucount, queue 1 at a time

success Generating image thumbnails - 311.836s - 532/532 1.71/s
info Done building in 317.3029042 sec

concurrency = 1, queue = cpucount

success Generating image thumbnails - 174.163s - 532/532 3.05/s
info Done building in 179.6475083 sec

Second site:

With concurrency = cpucount, queue 1 at a time

Generating image thumbnails - 436.176s

concurrency = 1, queue = cpucount

Generating image thumbnails - 259.491s

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions