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

Introduce fd_count() in addition to fd() #105

Merged
merged 1 commit into from
Oct 24, 2020

Conversation

bobrik
Copy link
Contributor

@bobrik bobrik commented Oct 23, 2020

Prometheus crate uses fd() to return the number of open file descriptors. Currently it takes 500ms to count 80k open files in an uncontended case, with this method we can cut this down to just 100ms by not resolving details of every open file descriptor.

See: /~https://github.com/tikv/rust-prometheus/blob/512e8ed44c0fbbcef/src/process_collector.rs#L134-L137

Prometheus crate uses `fd()` to return the number of open file descriptors.
Currently it takes 500ms to count 80k open files in an uncontended case,
with this method we can cut this down to just 100ms by not resolving
details of every open file descriptor.
@eminence
Copy link
Owner

I like it, thanks!

@eminence eminence added this to the v0.9.0 milestone Oct 24, 2020
@eminence eminence merged commit 028947a into eminence:master Oct 24, 2020
bobrik added a commit to bobrik/rust-prometheus that referenced this pull request Oct 25, 2020
Picking up eminence/procfs#105.

For a service with 80k opten file descriptors this reduces
metric collection time from 500ms down to 100ms (no contention).
bobrik added a commit to bobrik/rust-prometheus that referenced this pull request Oct 25, 2020
Picking up eminence/procfs#105.

For a service with 80k open file descriptors this reduces
metric collection time from 500ms down to 100ms (no contention).
bobrik added a commit to bobrik/rust-prometheus that referenced this pull request Oct 25, 2020
Picking up eminence/procfs#105.

For a service with 80k open file descriptors this reduces
metric collection time from 500ms down to 100ms (no contention).

Signed-off-by: Ivan Babrou <github@ivan.computer>
@eminence
Copy link
Owner

This has now been published on crates.io as v0.9.0. Thank you!

bobrik added a commit to bobrik/rust-prometheus that referenced this pull request Nov 16, 2020
Picking up eminence/procfs#105.

For a service with 80k open file descriptors this reduces
metric collection time from 500ms down to 100ms (no contention).

Signed-off-by: Ivan Babrou <github@ivan.computer>
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.

2 participants