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

maintaining "unique dbnames" is too costly #525

Closed
markwort opened this issue Nov 10, 2022 · 5 comments
Closed

maintaining "unique dbnames" is too costly #525

markwort opened this issue Nov 10, 2022 · 5 comments

Comments

@markwort
Copy link
Contributor

markwort commented Nov 10, 2022

On a productive pgwatch2 setup using timescaledb, maintining the list of unique dbnames is too taxing.

Every pgwatch2 daemon (of which I have one for every DB instance here, 24 in total) runs UniqueDbnamesListingMaintainer every 24 hours.
This results in full scans of all metric tables, just to maintain the list of active dbnames.

image

Maybe there should be a way to ensure this maintaining is not done more often than necessary.

@pashagolub
Copy link
Collaborator

@kmoppel @kmoppel-cognite can you throw some light on this, please? What is the purpose of such a schedule?

@markwort
Copy link
Contributor Author

markwort commented Dec 8, 2022

I think this is only used to make sure that the drop-down menus in grafana dashboards, where you can select specific databases

  1. shows new databases pretty soon when new metrics show up for the first time
  2. doesn't show databases that don't have any metrics (i.e. the database has been stopped for some time and all metrics have been truncated due to retention time settings)

kmoppel-cognite added a commit that referenced this issue Dec 15, 2022
Only one instance can now have the lock for
admin.all_distinct_dbname_metrics maintenance. Not 100% perfect though
as connections interrupts can still lead to multiple updates per day but
still much more resource-friendly than current state.

#525
@kmoppel-cognite
Copy link
Collaborator

Hey, Yes Julian is almost correct - new databases are though added immediately to the listing on detection.

The proposed workaround should be a big improvement already I think - to make it 100% correct and resource friendly one should do some DDL on the "admin" schema and have some explicit lock structure and track last_modified.

@pashagolub
Copy link
Collaborator

I will try to address this issue in the next releases. Meanwhile your quick fix may give us some time. Thanks @kmoppel-cognite

@kmoppel-cognite
Copy link
Collaborator

@pashagolub Actually seems, for that 100% correct approach one could also use the existing admin.config table, so no DDL needed. But its probably "fine"-ish already for now

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

No branches or pull requests

3 participants