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

Bad CSAF ingestion performance #456

Closed
ctron opened this issue Jun 26, 2024 · 11 comments
Closed

Bad CSAF ingestion performance #456

ctron opened this issue Jun 26, 2024 · 11 comments

Comments

@ctron
Copy link
Contributor

ctron commented Jun 26, 2024

I noticed a massive drop in performance when running the CSAF import process. I don't have numbers yet, but I'll investigate.

In the SQL logs I noticed at of a "select then insert" patters again.

@ctron
Copy link
Contributor Author

ctron commented Jun 26, 2024

I tried to go back a bit in the git history to see if that's a recent change. Doesn't look like that's the case.

I started to work with the test data file cve-2023-33201.json. Which takes around 470ms to ingest. It looks like the majority of time goes into ingesting the vulnerabilities. Parsing, inserting, and committing the main entry takes around 70ms.

@ctron
Copy link
Contributor Author

ctron commented Jun 26, 2024

The majority of time (~390ms) goes into ingest_product_statuses.

@ctron ctron changed the title Massive drop in import performance for CSAF Bad CSAF ingestion performance Jun 26, 2024
@ctron
Copy link
Contributor Author

ctron commented Jun 26, 2024

I changed the title as I cannot provide any numbers. I just have the feeling it got much slower since some time ago.

@JimFuller-RedHat
Copy link
Collaborator

@ctron is this still an issue ?

@ctron
Copy link
Contributor Author

ctron commented Sep 19, 2024

Hm, good question. Could it be better. Probably, but we tried to optimize things already.

Still, importing that initial dataset still takes ~12 hours.

@helio-frota
Copy link
Collaborator

Generating flamegraph with cargo run --bin xtask --release generate-dump for ImporterConfiguration::Csaf(CsafImporter { only, generated this after some 2 or 3 minutes:

at lest has some relation with previous comments

2024-10-23_11-17

Adding a zipped svg because when we click the preview svg in github comment, for some reason we can't navigate on flamegraph.. better to download unzip and click to open in the browser
d.zip

@helio-frota helio-frota moved this to In progress in Trustify Nov 4, 2024
@helio-frota helio-frota self-assigned this Nov 4, 2024
@helio-frota helio-frota removed their assignment Nov 12, 2024
@helio-frota
Copy link
Collaborator

@ctron can we change the title , suggestion:

try to prevent asyn-runtime from stealing cpu cycles that slow down csaf ingestion performance (up to an acceptable level) ?

I was not able to "tokio::spawn_blocking" this due some weirdo lifetime things I'm not good yet.

But I noticed that it also helps a bit with tokio trying to poll causing more blocking situation

@ctron
Copy link
Contributor Author

ctron commented Nov 14, 2024

Let's close this for now. I'd expect the database to be the bottleneck (or how we use the DB). But let's focus on more specific issues.

@ctron ctron closed this as completed Nov 14, 2024
@github-project-automation github-project-automation bot moved this from In progress to Done in Trustify Nov 14, 2024
@JimFuller-RedHat
Copy link
Collaborator

might be related/superseded by #999

@helio-frota
Copy link
Collaborator

good I'll try to find a way to cover the lines that starts with the upload part..
but in advance I have to say that I saw no deadlocks during some other tests like calling a function 1 million times inside test-binary-function.. probably some extra things happens before , in the case of issue you shared this is started by api endpoint .. def something to investigate

@helio-frota
Copy link
Collaborator

but in advance I have to say that I saw no deadlocks during some other tests like calling a function 1 million times inside test-binary-function..

probably some extra things happens before

is the parallel behavior #1009

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants