-
Notifications
You must be signed in to change notification settings - Fork 29.5k
Description
What is the improvement or update you wish to see?
Introduction
Remote image sizes are difficult to guarantee when some users uploaded very large images on the CMS. The very large images will be retrieved by nextjs and served to the frontend.
The default library squoosh
will cause the nextjs process a very high memory usage during image optimizations and might crash the whole nextjs container in a limited resource environment.
Thus, the high memory behaviour should be docuementated to increase the necessarity of installing sharp
.
Note: Some of our team members can't see observable differences after installing sharp
and then remove it immediately.
Suggestion
Indicate high memory usage of squoosh
compared with sharp
. For example, a single 5000 x 5000 images would consume ~600MB memory while sharp
use less than few MB memory only.
Is there any context that might help us understand?
Demo Recording
Without installing Sharp
Three 5000x5000 images will cause 1.8GB memory usage, and the memory jump is linear.
Installed Sharp
The memory usage remains stable.
Does the docs page already exist? Please link to it.
https://nextjs.org/docs/messages/sharp-missing-in-production