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

chore: enhance libpq management #3015

Merged
merged 4 commits into from
Sep 6, 2024
Merged

Conversation

Ivansete-status
Copy link
Collaborator

@Ivansete-status Ivansete-status commented Sep 4, 2024

Description

Have better libpq data retrieval. In this PR we are starting to register the underlying socket FD into the chronos selectors so that we have a more optimized time management.

Also adding a metric to allow measuring the time spent in database queries and the time spent returning the response to the store client.

This is inspired by @Menduist 's comment: https://github.com/waku-org/nwaku/pull/1631/files#r1153293945

Copy link

github-actions bot commented Sep 4, 2024

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:3015

Built from 186d3a7

Copy link
Contributor

@NagyZoltanPeter NagyZoltanPeter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice approach! Thank you for this!!!

Copy link
Contributor

@SionoiS SionoiS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you.


return err("failed pqconsumeInput: unknown reason")
asyncengine.addReader2(asyncFd, onDataAvailable).isOkOr:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIU chronos will trigger onDataAvailable directly on a socket read instead of doing db.check() which is slower right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIU chronos will trigger onDataAvailable directly on a socket read instead of doing db.check() which is slower right?

Yes correct :) In fact, the functions pqGetResult and pqConsumeInput ( libpq-async ) doesn't behave well in high load conditions.

@Ivansete-status Ivansete-status merged commit 45319f0 into master Sep 6, 2024
11 of 13 checks passed
@Ivansete-status Ivansete-status deleted the enhance-libpq-management branch September 6, 2024 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants