The entire build step of my large Gatsby site takes 42 seconds.
The next step
(info [gatsby-adapter-netlify] Stored the Gatsby cache to speed up future builds. 🔥) takes 1min, 33 seconds!!!
It appears that the caching in gatsby-adapter-netlify is actually slowing down my builds, instead of speeding them up? What can I do to address this?
Hi there, can you tell us what site this is in reference to so we can take a look?
site id: cad590fe-5325-4014-bef9-749cf0b892d8
Storing the cache is what makes the build faster in the initial steps. I see your most recent deploy took less than 3 minutes to deploy, which is a relatively fast build time for a Gatsby site.
A build with no cache at all takes 75 seconds, and the cache stores in 2 seconds, making it the fastest build option by far. The cache is ineffective, due to whatever the mechanism is for storing the cache, that takes so long.
The incremental builds are also taking 3 minutes, which is a far cry from the ~12 seconds they took on Gatsby cloud?
I have the same issue, it takes 6min to build the cache, additionally to my build time of 5min.
After the cache was build initially build time changes to 53 seconds, cache phase still takes 5min.
Also sometimes the cache store appears to be quick, but then the build process just sits for several minutes with no output, before going to the functions build. This turned a 1.5 minute build into a 4.25 minute…
12:49:02 PM: info Done building in 96.536105477 sec
12:49:05 PM: info [gatsby-adapter-netlify] Stored the Gatsby cache to speed up future builds. 🔥
12:51:41 PM: (build.command completed in 4m 15.2s)
12:51:41 PM: Functions bundling
Timings as low as those are not something we would further investigate. That aligns with our expectations with this feature.
I am experiencing the same issue on my project since the gatsby-adapter-netlify started to run after updating to gatsby 5.
Unfortunately though, my project is huge, and took about 10 minutes to full build and about 5 for an incremental. With the adapted running, the build time got far worse. It is now 13 to 20 minutes! and the incremental is not faster.
Also the adapted takes 3-4 minutes to save the cache.
Is it slow enough for you to further investigate? does 20 minutes build time aligns with your expectation with this feature?
Waiting for your feedback
We can try checking, but given that you say your project is huge, cache could take time. Gatsby is one of the slowest frameworks to build right now and given the times required by other Gatsby users take even hours to build, a 13 to 20 min build is still well in control.