question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"update schema" step really slow after upgrading from 2.17 to 2.18

See original GitHub issue

Description

Site with 20k pages, currently using version 2.17.6. We pass JSON data via context (hence not using GraphQL), so we have switched off type inference for SitePage.context to speed up compilation, as stated here.

These are the timings we get using 2.17.6:

2.17.6 timings
=======================================
success source and transform nodes - 4.247s                                                                                                                    
success building schema - 1.292s                                                                                                                                                                                                                                               
success createPages - 23.121s                                                                                                                                  
success createPagesStatefully - 0.079s                                                                                                                         
success onPreExtractQueries - 0.001s                                                                                                                           
success update schema - 0.051s 

After upgrading from 2.17.6 to 2.18.12, “update schema” step is taking ~40 seconds instead of 0.051s:

2.18.12 timings
=======================================
success source and transform nodes - 5.167s                                                                                                                    
success building schema - 1.206s                                                                                                                                                                                                                                               
success createPages - 27.748s                                                                                                                                  
success createPagesStatefully - 0.108s                                                                                                                         
success onPreExtractQueries - 0.000s                                                                                                                           
success update schema - 41.675s 

It’s this problem related to “update schema” step not taking into account that type inference is disabled for SitePage.context?

Steps to reproduce

Our repo is private, but we are willing to provide access to any Gatsby employee (maybe @pvdz)

Expected result

“update schema” step should not take any time, as it did with v2.17.6.

Actual result

It takes ~40 seconds instead of ~0s

Environment

  System:
    OS: Linux 4.15 Ubuntu 18.04.3 LTS (Bionic Beaver)
    CPU: (4) x64 Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz
    Shell: 4.4.20 - /bin/bash
  Binaries:
    Node: 12.12.0 - ~/.nvm/versions/node/v12.12.0/bin/node
    Yarn: 1.21.1 - /usr/bin/yarn
    npm: 6.13.4 - ~/.nvm/versions/node/v12.12.0/bin/npm
  Languages:
    Python: 2.7.17 - /usr/bin/python
  Browsers:
    Chrome: 79.0.3945.88
    Firefox: 71.0
  npmPackages:
    gatsby: ^2.18.12 => 2.18.17
    gatsby-plugin-emotion: ^4.1.18 => 4.1.18
    gatsby-plugin-eslint: 2.0.8 => 2.0.8
    gatsby-plugin-manifest: ^2.2.34 => 2.2.34
    gatsby-plugin-react-helmet: ^3.1.18 => 3.1.18
    gatsby-plugin-webpack-bundle-analyzer: ^1.0.5 => 1.0.5
    gatsby-source-filesystem: ^2.1.43 => 2.1.43
    gatsby-transformer-json: ^2.2.22 => 2.2.22
  npmGlobalPackages:
    gatsby-cli: 2.8.22
    gatsby: 2.1.19

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
vladarcommented, Jan 17, 2020

Confirmed this. A PR with a fix: #20662

1reaction
asilgagcommented, Jan 7, 2020

This is the whole output from 2.17.6:

success open and validate gatsby-configs - 0.855s
success load plugins - 0.875s
success onPreInit - 0.091s
success delete html and css files from previous builds - 0.011s
success initialize cache - 0.015s
success copy gatsby files - 0.022s
success onPreBootstrap - 0.005s
success source and transform nodes - 3.775s
success building schema - 1.190s
success createPages - 22.467s
success createPagesStatefully - 0.059s
success onPreExtractQueries - 0.002s
success update schema - 0.046s
success extract queries from components - 0.372s
success write out requires - 0.100s
success write out redirect data - 0.002s
success Build manifest and related icons - 0.025s
success onPostBootstrap - 0.080s
⠀
info bootstrap finished - 33.478 s
⠀
success Building production JavaScript and CSS bundles - 8.861s
success Rewriting compilation hashes - 0.004s
success run queries - 60.079s - 19896/19896 331.17/s
success Building static HTML for pages - 67.070s - 19888/19888 296.53/s
info Done building in 166.188489269 sec

And this the one from 2.18.12:

success open and validate gatsby-configs - 0.927s
success load plugins - 0.855s
success onPreInit - 0.092s
success delete html and css files from previous builds - 0.010s
success initialize cache - 0.009s
success copy gatsby files - 0.022s
success onPreBootstrap - 0.004s
success createSchemaCustomization - 0.005s
success source and transform nodes - 3.814s
success building schema - 1.223s
success createPages - 26.515s
success createPagesStatefully - 0.077s
success onPreExtractQueries - 0.002s
success update schema - 37.295s
success extract queries from components - 0.386s
success write out requires - 0.109s
success write out redirect data - 0.003s
success Build manifest and related icons - 0.023s
success onPostBootstrap - 0.083s
⠀
info bootstrap finished - 75.192 s
⠀
success Building production JavaScript and CSS bundles - 9.096s
success Rewriting compilation hashes - 0.005s
success run queries - 27.439s - 19896/19896 725.09/s
success Building static HTML for pages - 67.882s - 19888/19888 292.98/s
info Done building in 177.231419989 sec

As you can see:

  • “update schema” is slower (0s vs 37s)
  • “createPages” is slower (22s vs 26s)
  • “run queries” is significantly faster (60s vs 27s)

All in all, the difference between two versions is about ~11 seconds.

Since we have switched off type inference for SitePage.context, shouldn’t “update schema” step be faster, or even bypassed? We effectively know that we haven’t changed any field after createPages, so could be opt-out of that schema update just like we did with type inference for SitePage.context?

Read more comments on GitHub >

github_iconTop Results From Across the Web

History of Changes - XMLBeans
When not specifing type for a particle in derived schema type and when minOccurs is 0. update, Fixed error messages when contain base...
Read more >
Upgrading Oracle Identity Manager
The out-of-place upgrade procedure discussed in this guide explains how to perform a cloned upgrade of Oracle Identity Manager 12c (12.2.1.3.0) to Oracle ......
Read more >
CircleCI Release Notes
When migrating to server v4.x, Telegraf configuration data is now decoded and ... jobs page and step output access to run very slow...
Read more >
Bugzilla 2.20.6 Release Notes
If you are upgrading from a version before 2.18, also read the 2.18 release notes (lower in this file) and any previous release...
Read more >
Fix list for Rational ClearQuest - IBM
PH46262, After an update to ClearQuest 9.0.1.13, connections to an Oracle database ... This causes slower performance for user database upgrades as you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found