agilesix / AgileSix.com

Agile Six works with government agencies to create customized digital solutions that meet the needs of their users, both staff and citizens.
https://agile6.com
MIT License
5 stars 1 forks source link

Make Builds/Deploys faster #26

Open ElijahLynn opened 4 years ago

ElijahLynn commented 4 years ago

Current deploys and builds are taking 10+ minutes. I wonder if it something to do with shared workers on Netlify's side and if we can throw some $$ at the problem. This may not be the issue, but I do know that a fresh site should build/deploy in under 3 minutes.

Here is a sample log where we see 9 minutes in between boostrap and build steps with no information as to why the wait, which leads me to believe it is a Netlify worker. Maybe we can have our own dedicated worker?

2:58:49 PM: info bootstrap finished - 353.318 s 2:58:52 PM: warning Browserslist: caniuse-lite is outdated. Please run next command yarn upgrade 3:00:10 PM: success Building production JavaScript and CSS bundles — 80.929 s 3:00:12 PM: { title: 'Get in touch',

image

ElijahLynn commented 4 years ago

Looks like we can add an extra build machine for $40/month, but the settings indicate we already have a build machine and are not at capacity. image

I think we should open a support ticket.

ElijahLynn commented 4 years ago

Oh, I see now, gatsby build starts at 2:52:56 and then at 3:00:10 PM: success Building production JavaScript and CSS bundles — 80.929 s. Which 80s is not 8 minutes so I wonder if it is actually doing anything or just paused.

So next step is to see if gatsby build is that slow locally, and to use a debug flag to see what steps are being executed.

DanielMiller-agile6 commented 4 years ago

I tried this out as I was working on https://github.com/agilesix/AgileSix.com/issues/24

With empty /.cache and /public folders, the build definitely takes a little while, but not nearly 10 minutes. With a hydrated cache, the builds run much faster. I'm guessing the build machine always starts with an empty cache?

By far, the most time consuming part of the build is the "Generating image thumbnails" step, so maybe this is also taking longer on the build machine than my laptop. Seems odd that the "bootstrap" phase on the build machine was taking > 300 seconds... on my machine it only took 4. Aside from hardware, we could also try to update our npm dependencies and see if there have been any performance improvements. A separate "dependency audit" issue would be useful regardless, since I noticed a few out-of-date and/or deprecated dependencies used in our site.

Below is the output from my local build:

Agile6-A14:AgileSix.com Daniel.Miller$ yarn build
yarn run v1.22.4
$ gatsby build
success open and validate gatsby-configs - 0.040s
success load plugins - 0.697s
warn The netlify-cms package is deprecated, please install netlify-cms-app instead. You can do this by running "npm install
success onPreInit - 0.015s
success delete html and css files from previous builds - 0.019s
success initialize cache - 0.018s
success copy gatsby files - 0.040s
success onPreBootstrap - 0.003s
success createSchemaCustomization - 0.009s
success source and transform nodes - 0.714s
success building schema - 0.247s
success createPages - 0.086s
success createPagesStatefully - 0.027s
success onPreExtractQueries - 0.002s
success update schema - 0.028s
success extract queries from components - 0.274s
success write out requires - 0.005s
success write out redirect data - 0.001s
success Build manifest and related icons - 0.137s
success onPostBootstrap - 0.141s
⠀
info bootstrap finished - 4.227 s
⠀
success Building production JavaScript and CSS bundles - 23.845s
success Rewriting compilation hashes - 0.007s
success run queries - 31.038s - 61/61 1.97/s
[============================]   103.652 s 270/270 100% Generating image thumbnails
[==                          ]   1.776 s 5/55 9% Building static HTML for pages
{ title: 'Get in touch',
success Building static HTML for pages - 2.098s - 55/55 26.21/s
success Generating image thumbnails - 103.984s - 270/270 2.60/s
Generated public/sw.js, which will precache 7 files, totaling 462092 bytes.
success onPostBuild - 0.081s
info Done building in 108.417 sec
✨  Done in 108.63s.
DanielMiller-agile6 commented 4 years ago

I just saw an email about "Gatsby Incremental Builds" for Netlify. Might be worth trying out:

https://www.netlify.com/blog/2020/04/23/enable-gatsby-incremental-builds-on-netlify

ElijahLynn commented 4 years ago

Thanks for testing this and adding more info. I am down for trying the incremental builds on Netlify.