netdata / kernel-collector

Linux Kernel eBPF Collectors
61 stars 15 forks source link

Improve PID monitoring #302

Closed thiagoftsm closed 2 years ago

thiagoftsm commented 2 years ago
Summary

This is the first PR that is bringing modifications for our eBPF programs to allow grouping data according the Real Parent ID, the Parent ID, and the process ID.

The main goal with these changes is to reduce the time kernel needs to find a process in the hash tables and speed up processing. We are not going to remove from users the possibility to see all process, but this won't be enabled by default.

This PR is also bringing small fixed for the functional tester.

Test Plan
  1. Get files from this link and store in a specific file, for example, ~/PATH_TO_ARTIFACTS
  2. Extract the files running
for i in `ls *.zip`; do unzip $i; rm .gitkeep ; rm $i; done
for i in `ls *.xz`; do tar -xf $i; rm $i* ; done
  1. Compile current branch:

    # make clean ; make tester
  2. Run tests:

    ./kernel/legacy_test --netdata-path ~/PATH_TO_ARTIFACTS --content --iteration 2 --process --pid 0 --log-path FILE_pid0.txt
    ./kernel/legacy_test --netdata-path ~/PATH_TO_ARTIFACTS --content --iteration 2 --process --pid 1 --log-path FILE_pid1.txt
    ./kernel/legacy_test --netdata-path ~/PATH_TO_ARTIFACTS --content --iteration 2 --process --pid 2 --log-path FILE_pid2.txt
  3. The final result will demonstrate more Processes stored when --pid receives 2 as arguments, for the first two options it can be equal or to have a small difference depending of the processes running on computer/VM.

Additional information

This PR was already tested on :

Linux Distribution kernel version
Slackware Current 5.17.6
Arch Linux 5.17.1-arch4
Slackware 15.0 5.15.27
Manjaro 21.1 5.10.109-1
Ubuntu 20.04 5.4.0-97
Rocky 8.5 4.18.0-372.9.1.el8.x86_64