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

Make metrics collection optional/faster #330

Open
havaker opened this issue Nov 5, 2021 · 1 comment · May be fixed by #1147
Open

Make metrics collection optional/faster #330

havaker opened this issue Nov 5, 2021 · 1 comment · May be fixed by #1147
Labels
API-breaking This might introduce incompatible API changes cpp-rust-driver-p2 Functionality required by cpp-rust-driver enhancement New feature or request good first issue Good for newcomers
Milestone

Comments

@havaker
Copy link
Contributor

havaker commented Nov 5, 2021

Benchmarks done some time ago showed that the driver can spend a significant amount of time logging query latency (scylla::transport::metrics::Metrics::log_query_latency 11.68% on this flamegraph). It is probably due to the fact that logging latency to the metrics histogram can lead to congestion of a mutex guarding this histogram (logging takes place after each query completion).

Mutex congestion problem could be fixed by using lock-free histogram, but unfortunately I can't find any crate providing one on crates.io. Another way to reduce this problem could be sharding histograms - making one per thread, in a similar way to this one. The last option sacrifices read performance, so it would be good to add some caching mechanism to Metrics to avoid slowdowns caused by e.g. speculative execution policies asking for latency percentile for each query.

I suppose we could also make metrics collection optional. It would be an obvious speedup for people who do not want to use metrics.

@psarna psarna assigned cvybhu and unassigned havaker Aug 16, 2022
@piodul piodul added this to the 0.9.0 milestone Mar 24, 2023
@mykaul mykaul added the enhancement New feature or request label Apr 2, 2023
@wprzytula wprzytula added the good first issue Good for newcomers label Aug 24, 2023
@cvybhu cvybhu removed their assignment Oct 31, 2023
@Lorak-mmk Lorak-mmk self-assigned this Nov 15, 2023
@avelanarius avelanarius modified the milestones: 1.0.0, 0.14.0 Apr 30, 2024
@wprzytula
Copy link
Collaborator

When tackling with this, let's consider cpp-rust-driver requirements wrt metrics.

@wprzytula wprzytula added the cpp-rust-driver-p2 Functionality required by cpp-rust-driver label Jul 9, 2024
@Lorak-mmk Lorak-mmk removed their assignment Jul 31, 2024
@wprzytula wprzytula modified the milestones: 0.14.0, 0.16.0 Aug 20, 2024
QuerthDP added a commit to QuerthDP/scylla-rust-driver that referenced this issue Dec 9, 2024
I've added "metrics" crate feature which enables usage and gathering of metrics.

Therefore everyone willing to use metrics in their code is required to add "metrics" feature in their Cargo.toml file or compile otherwise with --features metrics flag.

This change was requested in scylladb#330
QuerthDP added a commit to QuerthDP/scylla-rust-driver that referenced this issue Dec 10, 2024
I've added "metrics" crate feature which enables usage and gathering of metrics.

Therefore everyone willing to use metrics in their code is required to add "metrics" feature in their Cargo.toml file or compile otherwise with --features metrics flag.

This change was requested in scylladb#330
@QuerthDP QuerthDP linked a pull request Dec 10, 2024 that will close this issue
8 tasks
QuerthDP added a commit to QuerthDP/scylla-rust-driver that referenced this issue Dec 11, 2024
I've added "metrics" crate feature which enables usage and gathering of metrics.

Therefore everyone willing to use metrics in their code is required to add "metrics" feature in their Cargo.toml file or compile otherwise with --features metrics flag.

This change was requested in scylladb#330
@roydahan roydahan added the API-breaking This might introduce incompatible API changes label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API-breaking This might introduce incompatible API changes cpp-rust-driver-p2 Functionality required by cpp-rust-driver enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants