-
-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Knex migration slowed down content bakes #3462
Comments
Just a (somewhat informed) hunch: I think, however, that the slowdown is (partly) in the gdocs handling in datapage baking code. owid-grapher/baker/DatapageHelpers.ts Lines 104 to 105 in abbc4e5
That method then calls |
I did some benchmarking by baking 1000 charts with various things commented out. The datapage code, while slow, is actually faster than the Grapher path - I didn't find what was causing the datapage slowdown because I wasted a bunch of time with a flamegraph library, but DB access is what I'd check out first. branch here: https://github.com/owid/owid-grapher/tree/knex-bake-degradation |
So, @danyx23 and I looked into this for a bit. This is actually happening because of: owid-grapher/baker/GrapherBaker.tsx Lines 526 to 527 in d65c4ca
In my testing, it turned out that with multiple transactions, the chart baking yarn runLocalBake --steps charts runs twice as fast.
Also, I sanity-checked that, when run with a single transaction, this is not using a connection pool but rather just a single connection. console.log(
await db.knexRawFirst(knex, "SELECT CONNECTION_ID() as connectionId")
) -- for example, at the top of I think that using multiple transactions for baking is the way to go here. |
I think there's no way around this. I'm gonna assign this issue to @danyx23, just so we don't forget about it. |
@Marigold with the recent work from @ikesau and @marcelgerber we made some progress in bake times. Is this ok for now? If not please open a new issue and tell us which area we should focus on. Thanks! |
#3514 might also be related |
Marcel's fix helped. It's as smooth as before! |
Description
Migration to knex slowed down content bakes from ~7min to ~15min. The difference can be seen on these two builds - before and after (be aware that time bars on the right in buildkite correspond to the step on the next line!). Here's a breakdown:
bakeAllChangedGrapherPagesVariablesPngSvgAndDeleteRemovedGraphers
- 5 minbaked google doc posts
- 1 minbaked special pages
- 1 minExpected behaviour
Such a large slowdown doesn't look like it is just knex overhead. Perhaps the schema has changed and we're missing indexes somewhere?
The text was updated successfully, but these errors were encountered: