We are running a website using Hugo. It has taken more than 2 hours to complete the build process. Please check the status of our build process. Is it a reasonable time or are we something missing in the build process? how can we improve this process?
Pages | 61675
Please read Request Help for tips how to format your code and what information to add.
According to your output it took 7 minutes, not 2 hours. You might have a hardware issue that is blocking file system access while running Hugo.
With that many pages to render you should run the following command, to receive more information about the âcacheabilityâ of your partials and layouts:
hugo server --i18n-warnings --templateMetrics --templateMetricsHints
This will help to find a solution to your problem. But it could be that the amount of time (if it is 7 minutes) is normal with 60k+ pages. The 2 hours point to another problem not within the reach of Hugo.
If my math is correct, youâre creating about 103,000 pages at around 68ms per page. Thatâs not terrible, but I have a feeling that can be reduced. However, without seeing the site source, itâs difficult to provide concrete answers.
My main recommendation would be to dig into your layouts and move cacheable complexity into cached partials. Note that you can have cached variants, too. If itâs possible, reduce the number of taxonomies.
Attack these templates first since they appear to be where most of the cumulative time is spent:
If you want any more help than that, weâd need to see the site source or at least the theme.
Iâve just run my companyâs internal Hugo build on commodity hardware (4 cores), and I get about 1000 pages per second, i.e. a 3966 page site took â4841msâ - so 60,000 pages assuming linear scaling, would still only take a little over a minute.
Two things that can make your build slow: firstly templates that arenât cached, and secondly, templates that cannot be cached because they âwalk the file systemâ to find parameters that are perhaps defined in the front matter of the page, or in a section/_index.md page.
We do the latter, i.e. walk the filesystem for parameters in _index.md files, and removing that makes our build even faster, taking about a quarter of the time I mentioned above (i.e. 1s vs 4s).
My sincere apology for the late reply. After several error and trial methods as per the instructions that are mentioned by @moorereason@barryl, finally we optimized the build process and reduced the build time to 4.62 minutes for process around 90K pages. Thanks for the extreme help and support @moorereason@barryl@gethugothemes . We are still optimizing the layouts.