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

Use ping api instead of system info for fingerprinting #186

Merged
merged 3 commits into from
Jul 30, 2022
Merged

Conversation

towe75
Copy link
Collaborator

@towe75 towe75 commented Jul 26, 2022

Overview

All nomad drivers must implement a fingerprint mechanism. Back at the day i went with the system info api call and it worked well.

But it turned out that this is a rather heavy invocation, going even down to the package manager level (dpkg, rpm) to gather informations. The driver builds a fingerprint each 30 seconds and thus it wastes quite some cpu cycles and has an impact on the overall machine load.

Some numbers

A simple perf stat on my machine shows the difference between the two podman cli equivalents:

 Performance counter stats for 'podman info':

            240.46 msec task-clock                #    0.721 CPUs utilized
             1,481      context-switches          #    6.159 K/sec
               141      cpu-migrations            #  586.383 /sec
            18,851      page-faults               #   78.397 K/sec

       0.333681791 seconds time elapsed

       0.098392000 seconds user
       0.172141000 seconds sys
 Performance counter stats for 'podman version':

             60.49 msec task-clock                #    0.426 CPUs utilized
               720      context-switches          #   11.903 K/sec
                74      cpu-migrations            #    1.223 K/sec
             4,449      page-faults               #   73.549 K/sec

       0.141960043 seconds time elapsed

       0.036505000 seconds user
       0.047359000 seconds sys

What the PR does

This PR changes the mechanism to use the _ping api call which is not so resource intensive. System info is now usually only called once.

Conclusion

You will not see a big performance different on a crowded host but it certainly makes the situation better on a idle machine.

@towe75 towe75 requested review from jrasell and lgfa29 as code owners July 26, 2022 19:35
Copy link
Contributor

@lgfa29 lgfa29 left a comment

Choose a reason for hiding this comment

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

Minor nit-picking, but feel free to ignore them 🙂

driver.go Outdated Show resolved Hide resolved
driver.go Outdated Show resolved Hide resolved
@towe75 towe75 merged commit 4efeb99 into main Jul 30, 2022
@towe75 towe75 deleted the f_fingerprint branch July 30, 2022 13:48
@lgfa29 lgfa29 added this to the v0.4.1 milestone Nov 15, 2022
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