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

[surfacer.postgres] Postgresql surfacer bulk inserts #717

Merged

Conversation

markoposavec
Copy link
Contributor

Hello!
I've added option to add bulk writing into postgres database. Currently all metrics from one metrics event object are written in one transaction which was very slow in my use case because of slow connections towards database. I've added batching of metrics events into one transaction. This change improved the speed in my use case by ~10x.

With default values system is working as it was before, event metrics are sent one by one to database.

Let me know if I should change anything,
Thanks!

@markoposavec markoposavec changed the title Postgresql surfacer bulk inserts [surfacer.postgres] Postgresql surfacer bulk inserts Apr 10, 2024
Copy link
Contributor

@manugarg manugarg left a comment

Choose a reason for hiding this comment

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

Thanks @markoposavec for this PR. Please take a look at the inline comments.

surfacers/internal/postgres/proto/config.proto Outdated Show resolved Hide resolved
surfacers/internal/postgres/postgres.go Outdated Show resolved Hide resolved
surfacers/internal/postgres/postgres.go Outdated Show resolved Hide resolved
surfacers/internal/postgres/postgres.go Outdated Show resolved Hide resolved
surfacers/internal/postgres/postgres.go Outdated Show resolved Hide resolved
@markoposavec
Copy link
Contributor Author

For some reason made a rebase and it shows changes from the other commit about tls.

@manugarg
Copy link
Contributor

For some reason made a rebase and it shows changes from the other commit about tls.

That's weird. Can you try the following:

git checkout master
git pull master
git checkout <your branch name>
git rebase master
git push -f

I am not sure if above will work, might need to check internet :)

maposavec and others added 8 commits April 16, 2024 08:07
Co-authored-by: Manu Garg <manugarg@gmail.com>
Co-authored-by: Manu Garg <manugarg@gmail.com>
Co-authored-by: Manu Garg <manugarg@gmail.com>
…loudprober#716)

- This is important for Windows tests where deleting the test binary
fails if it's still executing (for testing external probe process).
- We use a temp pids file to collect the pids of the started processes 
and kill those pids before exiting the test.
@markoposavec markoposavec force-pushed the postgresql-surfacer-bulk-inserts branch from 423d808 to 66fdd7c Compare April 16, 2024 06:25
@markoposavec
Copy link
Contributor Author

that fixed the issue, thanks 😄

Copy link
Contributor

@manugarg manugarg left a comment

Choose a reason for hiding this comment

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

One minor suggestion. Looks good otherwise.

surfacers/internal/postgres/postgres.go Outdated Show resolved Hide resolved
@manugarg manugarg merged commit b132c0e into cloudprober:master Apr 18, 2024
8 checks passed
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.

None yet

2 participants