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

Suggestion: Have readPreference set to "secondaryPreferred" by default #48

Closed
johnnyshields opened this issue Apr 6, 2022 · 2 comments
Labels
documentation Improvements or additions to documentation Stale

Comments

@johnnyshields
Copy link

I recommend that the query exporter be set to readPreference "secondaryPreferred" by default, so that it generally reads from secondaries rather than the primary.

The advantage of this is that it avoids load on your primary DB. In particular, aggregation pipeline queries often seem to lock the DB collection and make other queries (i.e. from your application) artificially slow.

The main disadvantage of this is that your exported metrics may be subject to replication lag (usually less than 1 sec) vs. the state of the primary. Since the query exporter is typically used for passive stats exporting, this is generally acceptable in the vast majority of cases.

@johnnyshields johnnyshields added the bug Something isn't working label Apr 6, 2022
@raffis raffis removed the bug Something isn't working label Apr 6, 2022
@raffis
Copy link
Owner

raffis commented Apr 6, 2022

I am not sure whether its a good idea to change the default behavior. What stops you from just changing the URI?
That said this is definitely worth documenting in the readme.

@raffis raffis added the documentation Improvements or additions to documentation label Apr 7, 2022
@github-actions github-actions bot added the Stale label Sep 16, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 14, 2024
@johnnyshields
Copy link
Author

This should be reopened. Adding to readme would be ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation Stale
Projects
None yet
Development

No branches or pull requests

2 participants