Skip to content

make reduction-effort a configuration item #289

Closed
@frankenbubble

Description

@frankenbubble

currently we can't configure reduction-effort, which defaults to a value of 4, this means resizing jpegs to larger webp files uses more cpu to reduce file size. This results in higher latency, for a small size trade off

make reduction-effort a configuration item, we would like to set this to 0 (zero)

see https://sharp.pixelplumbing.com/api-output#webp
options.reductionEffort number level of CPU effort to reduce file size, integer 0-6 (optional, default 4)

having started using this service in production, we noticed our p90 origin latency and integration latency was high. investigation further we found it was webp operations. Benchmarking using the command line tool for vips, we found significant latency differences for this value.

time vips resize /tmp/photo.jpeg /tmp/photo.webp [Q=75,reduction-effort=0,strip] "1.1"

real 0m0.193s
user 0m0.310s
sys 0m0.049s

time vips resize /tmp/photo.jpeg /tmp/photo.webp [Q=75,reduction-effort=4,strip] "1.1"

real 0m0.479s
user 0m0.551s
sys 0m0.056s

resultant file sizes
242,758 for reduction-effort=4 (default behaviour)
275,994 for reduction-effort=0

I understand CF will cache this so it's a one-time cost, but we would still like to be able to chose our preferred value

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions