Skip to content
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

Investigate installation performance bugs with many resources #2396

Open
depombo opened this issue Apr 3, 2023 · 4 comments
Open

Investigate installation performance bugs with many resources #2396

depombo opened this issue Apr 3, 2023 · 4 comments
Assignees
Labels
bug Something isn't working evaluation

Comments

@depombo
Copy link
Member

depombo commented Apr 3, 2023

No description provided.

@depombo depombo converted this from a draft issue Apr 3, 2023
@depombo depombo added bug Something isn't working evaluation labels Apr 3, 2023
@dfellis
Copy link
Member

dfellis commented Apr 4, 2023

Two major sources:

  1. At large scale, the diff algorithm scales poorly (roughly O(n^2) normally, but becomes much worse at large n when the GC goes into overdrive to keep the memory usage below ~512MB (despite us telling V8 to let it go up to 8GB...) This has been fixed in this commit by reworking the algorithm in use to be O(n) and reduce recomputation of set information.
  2. At all scales, the TypeORM read logic is not optimized for batch reads, and sub-entities are queried one-at-a-time with no caching. There's nothing we can do here, according to the official docs, besides writing our own batch read mechanism, either completely from scratch or digging into the TypeORM internals, both of which have significant downsides. There also appears to be a lot of GC action during this phase, so we might be able to speed it up some if we can figure out the V8 flags we need to set, but it appears to be mostly IO-bound (by splitting the Postgres queries up the way it does), so that would only be a minor fix on that front.

@dfellis
Copy link
Member

dfellis commented Apr 6, 2023

Third issue:

  1. I haven't fully debugged it, yet, but there appears to be a similar slowdown as iasql_install within the sync path of the iasql_commit logic.

@dfellis
Copy link
Member

dfellis commented Apr 6, 2023

Strangely couldn't reproduce the number 3 slowdown when I manually did the same sorts of things in staging with a local IaSQL.

It takes more time than I'd like (the extra checks our apply and sync loops do slow down the operation), but the flamegraphs look reasonable to me.

@dfellis
Copy link
Member

dfellis commented Apr 6, 2023

Image

An annotated flame graph of my findings. It all looks reasonable to me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working evaluation
Projects
None yet
Development

No branches or pull requests

2 participants