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

fix(linux): improved container support #217

Merged
merged 2 commits into from
Apr 1, 2024
Merged

Conversation

P403n1x87
Copy link
Owner

Description of the Change

We make use of the /proc/root of the procfs to improve the chances that we can infer the required information, such as the location of the runtime structure and the interpreter version from binaries pointed at by the actual process root. This is relevant for processes running inside containers, since their FS root does not coincide with the host root.

Alternate Designs

None considered

Regressions

We are changing the paths that are used to inspect binaries. This might have an impact in the non-containerised cased, albeit the greater generality should ensure that the new code works as intended for a wider range of scenarios. We also bail out early on a failed version inference (in fact, on fatal errors), which might introduce a degree of flakiness in tests.

Verification Process

...

@P403n1x87 P403n1x87 self-assigned this Mar 31, 2024
Copy link

codecov bot commented Mar 31, 2024

Codecov Report

Attention: Patch coverage is 45.45455% with 12 lines in your changes are missing coverage. Please review.

Project coverage is 68.62%. Comparing base (5303860) to head (0f8e7d7).

Files Patch % Lines
src/linux/common.h 37.50% 2 Missing and 3 partials ⚠️
src/linux/py_proc.h 50.00% 5 Missing ⚠️
src/py_proc.c 50.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            devel     #217      +/-   ##
==========================================
- Coverage   68.79%   68.62%   -0.18%     
==========================================
  Files          27       27              
  Lines        2519     2521       +2     
  Branches      774      771       -3     
==========================================
- Hits         1733     1730       -3     
+ Misses        457      450       -7     
- Partials      329      341      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Mar 31, 2024

Austin Benchmarks

Running Austin benchmarks with Python 3.10.14

Benchmark Summary

Comparison of dev against 3.6.0.

The following scenarios show a statistically significant difference in performance between the two versions.

Sample Rate Saturation Error Rate Sampling Speed
Wall time [sampling interval: 1] 🟢 🟢 🟡 🟡
Multiprocess wall time [sampling interval: 100] 🟢 🟢 🟡 🟢

Benchmark Results

Wall time [sampling interval: 1]

Wall time [sampling interval: 1]

Sample Rate Saturation Error Rate Sampling Speed
3.6.0 192000 ± 3000 0.999999 ± 1e-06 5e-06 ± 3e-06 7.8 ± 0.4
dev 196000 ± 4000 0.99996 ± 3e-05 6e-06 ± 2e-06 7.7 ± 0.5
Wall time [sampling interval: 10]

Wall time [sampling interval: 10]

Sample Rate Saturation Error Rate Sampling Speed
3.6.0 60000 ± 6000 0.34 ± 0.03 2e-05 ± 1e-05 9.7 ± 0.5
dev 67000 ± 9000 0.38 ± 0.04 1e-05 ± 1e-05 9.6 ± 0.5
Wall time [sampling interval: 100]

Wall time [sampling interval: 100]

Sample Rate Saturation Error Rate Sampling Speed
3.6.0 12400 ± 200 0.0005 ± 0.0002 2e-05 ± 2e-05 9.3 ± 0.5
dev 12400 ± 200 0.0005 ± 0.0002 2e-05 ± 2e-05 9.1 ± 0.7
Wall time [sampling interval: 1000]

Wall time [sampling interval: 1000]

Sample Rate Saturation Error Rate Sampling Speed
3.6.0 1850 ± 40 0 ± 0 0 ± 0 11 ± 1
dev 1870 ± 10 0 ± 0 0 ± 0 10.6 ± 1.0
CPU time [sampling interval: 1]

CPU time [sampling interval: 1]

Sample Rate Saturation Error Rate Sampling Speed
3.6.0 62000 ± 2000 1 ± 0 1.6e-05 ± 8e-06 12.5 ± 0.5
dev 61000 ± 3000 1 ± 0 2e-05 ± 1e-05 12.9 ± 0.6
CPU time [sampling interval: 10]

CPU time [sampling interval: 10]

Sample Rate Saturation Error Rate Sampling Speed
3.6.0 57000 ± 3000 0.66 ± 0.09 2e-05 ± 1e-05 13.4 ± 0.5
dev 58000 ± 3000 0.65 ± 0.06 2e-05 ± 1e-05 13.3 ± 0.5
CPU time [sampling interval: 100]

CPU time [sampling interval: 100]

Sample Rate Saturation Error Rate Sampling Speed
3.6.0 6360 ± 10 0.0007 ± 0.0002 5e-05 ± 5e-05 17 ± 1
dev 6364 ± 9 0.0006 ± 0.0002 4e-05 ± 5e-05 17 ± 1
CPU time [sampling interval: 1000]

CPU time [sampling interval: 1000]

Sample Rate Saturation Error Rate Sampling Speed
3.6.0 948 ± 2 0 ± 0 0 ± 0 21 ± 1
dev 946.9 ± 1.0 0 ± 0 0.0001 ± 0.0004 21 ± 1
RSA keygen [sampling interval: 1]

RSA keygen [sampling interval: 1]

Sample Rate Saturation Error Rate Sampling Speed
3.6.0 62000 ± 4000 1 ± 0 0.0001 ± 0.0001 16 ± 1
dev 63000 ± 4000 1 ± 0 0.00011 ± 9e-05 15 ± 1
RSA keygen [sampling interval: 10]

RSA keygen [sampling interval: 10]

Sample Rate Saturation Error Rate Sampling Speed
3.6.0 60000 ± 2000 0.996 ± 0.002 8e-05 ± 8e-05 15.8 ± 0.8
dev 61000 ± 4000 0.996 ± 0.002 0.00011 ± 7e-05 16 ± 1
RSA keygen [sampling interval: 100]

RSA keygen [sampling interval: 100]

Sample Rate Saturation Error Rate Sampling Speed
3.6.0 6310 ± 100 0.001 ± 0.001 0.0005 ± 0.0007 20 ± 2
dev 6340 ± 20 0.002 ± 0.002 0.0005 ± 0.0004 21 ± 3
RSA keygen [sampling interval: 1000]

RSA keygen [sampling interval: 1000]

Sample Rate Saturation Error Rate Sampling Speed
3.6.0 945.0 ± 0.9 0 ± 0 0.001 ± 0.003 22 ± 3
dev 944 ± 1 0 ± 0 0.001 ± 0.002 25 ± 5
Full metrics [sampling interval: 1]

Full metrics [sampling interval: 1]

Sample Rate Saturation Error Rate Sampling Speed
3.6.0 75000 ± 2000 1 ± 0 1.7e-05 ± 9e-06 19.9 ± 0.3
dev 75000 ± 2000 1 ± 0 2e-05 ± 1e-05 19.8 ± 0.6
Full metrics [sampling interval: 10]

Full metrics [sampling interval: 10]

Sample Rate Saturation Error Rate Sampling Speed
3.6.0 74000 ± 2000 0.92 ± 0.05 1e-05 ± 1e-05 20 ± 0
dev 74000 ± 2000 0.89 ± 0.05 1.7e-05 ± 7e-06 20.1 ± 0.7
Full metrics [sampling interval: 100]

Full metrics [sampling interval: 100]

Sample Rate Saturation Error Rate Sampling Speed
3.6.0 12300 ± 200 0.0013 ± 0.0003 2e-05 ± 3e-05 25 ± 2
dev 12300 ± 200 0.0016 ± 0.0004 6e-05 ± 6e-05 25.2 ± 0.8
Full metrics [sampling interval: 1000]

Full metrics [sampling interval: 1000]

Sample Rate Saturation Error Rate Sampling Speed
3.6.0 1880 ± 20 0 ± 0 0.0 ± 0.0001 28 ± 2
dev 1860 ± 20 0 ± 0 0.0 ± 0.0001 29 ± 2
Multiprocess wall time [sampling interval: 1]

Multiprocess wall time [sampling interval: 1]

Sample Rate Saturation Error Rate Sampling Speed
3.6.0 6900 ± 500 1 ± 0 9e-05 ± 4e-05 135 ± 9
dev 7000 ± 300 1 ± 0 7e-05 ± 2e-05 138 ± 7
Multiprocess wall time [sampling interval: 10]

Multiprocess wall time [sampling interval: 10]

Sample Rate Saturation Error Rate Sampling Speed
3.6.0 6500 ± 800 0.999 ± 0.001 9e-05 ± 4e-05 140 ± 20
dev 7000 ± 200 0.998 ± 0.002 9e-05 ± 5e-05 137 ± 5
Multiprocess wall time [sampling interval: 100]

Multiprocess wall time [sampling interval: 100]

Sample Rate Saturation Error Rate Sampling Speed
3.6.0 6200 ± 700 0.023 ± 0.002 6e-05 ± 3e-05 146 ± 7
dev 6900 ± 400 0.02 ± 0.002 6e-05 ± 4e-05 138 ± 7
Multiprocess wall time [sampling interval: 1000]

Multiprocess wall time [sampling interval: 1000]

Sample Rate Saturation Error Rate Sampling Speed
3.6.0 6100 ± 600 0.0015 ± 0.0002 7e-06 ± 9e-06 43 ± 2
dev 6400 ± 100 0.0014 ± 0.0002 2e-05 ± 2e-05 41 ± 1

We make use of the /proc/root of the procfs to improve the chances
that we can infer the required information, such as the location
of the runtime structure and the interpreter version from binaries
pointed at by the actual process root. This is relevant for
processes running inside containers, since their FS root does not
coincide with the host root.
Copy link
Owner Author

@P403n1x87 P403n1x87 left a comment

Choose a reason for hiding this comment

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

Exclude potentially unreachable lines from code coverage

src/linux/common.h Outdated Show resolved Hide resolved
src/linux/common.h Outdated Show resolved Hide resolved
src/linux/common.h Outdated Show resolved Hide resolved
src/linux/py_proc.h Outdated Show resolved Hide resolved
src/linux/py_proc.h Outdated Show resolved Hide resolved
src/linux/py_proc.h Outdated Show resolved Hide resolved
@P403n1x87 P403n1x87 marked this pull request as ready for review April 1, 2024 18:29
@P403n1x87 P403n1x87 merged commit 4559915 into devel Apr 1, 2024
31 of 42 checks passed
@P403n1x87 P403n1x87 deleted the fix/container-support branch April 1, 2024 18:32
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.

1 participant