Abnormally high resource usage and slow builds
See original GitHub issueI’m noticing high CPU and RAM usage when building using version >0.5.3.
I’ve tested most versions from 0.5.1-0.5.8 (latest) and 0.5.2/0.5.3 seem to be the fastest, with version 0.5.1 being a close second.
Each time after I get the last “Image at xxx optimized in yyyms”, I get a “Completed in xx.” and then the CPU spikes. No transformed images are written to the build dir at that point, This last “step” takes much more time than the rest of the build when in finishes. Emphasis on when because I’ve had to forcibly terminate the build a couple of times. Using versions above 0.5.5 (I think) dramatically worsens the effect.
On the latest version, this last “step” pushes my CPU to 100% and I’ve noticed it take as much as 9.5GB of RAM. (For reference I have a desktop computer with a 6 core/12 thread i7 8700K and 16GBs of RAM). Initially I thought it was an issue with Windows so I rebooted to my Linux install and tried it there… It crashed my desktop environment and I got kicked back to the login screen.
Something of note, later versions also throw an error only on Windows when building basically anything else apart from avif
files. I don’t know if these are caused by the same issue (earlier versions are ok).
I’d also like to note what I’m trying to do:
I am working on a blog website that uses wordpress as a CMS. I’m currently only using the Picture
component passing the src
attribute as a URL. The blog currently has <50 images.
Issue Analytics
- State:
- Created a year ago
- Comments:18 (14 by maintainers)
Top GitHub Comments
I created this repo to explore and demonstrate the issue astro-imagetools-example. It’s using the astro blog starter, with modifications in
src/pages/index.astro
. I’m basically fetching a bunch of images from the blog I’m working on and displaying them. I tried to simply display a single image from imgur multiple times but the build worked perfectly.However with experimentation I’ve found the following:
Array.slice()
I managed to reproduce the problem on much smaller counts of images.Input file is missing
error.I changed versions on gitpod with:
While on my windows pc I just removed
node_modules/.cache
since deleting and reinstalling the whole node_modules folder took a lot of time.@skourismanolis a fix for the regression has been merged and released in
0.6.9
.After upgrading to
astro-imagetools@0.6.9
and running the same tests on GitPod:jpg
- it took9s
to generatejpg
images for all the 240 imagespng
- it took13s
to generatepng
images for all the 240 imageswebp
- it took20s
to generatewebp
images for all the 240 imagesavif
- it took204s
to generatejpg
images for all the 240 imagesNow, https://github.com/skourismanolis/astro-imagetools-example builds successfully on the latest release. It’s taking
225s
for a build to finish on GitPod.