Giter Site home page Giter Site logo

Comments (9)

ncabatoff avatar ncabatoff commented on May 28, 2024

I can think of a number of possible explanations. Assuming the error metrics aren't increasing, my best guess is that it's kernel process(s) with an empty cmdline, and hence which are ignored by the '.+' regexp we're matching on by default. Try it with '.*' instead and see if that changes things.

from process-exporter.

PeterZaitsev avatar PeterZaitsev commented on May 28, 2024

Hi,
Looks like same thing. Note In this case I'm running MySQL Benchmark so I kind of expect MySQL to be out there in the top. My theory could be main MySQL thread indeed sleeps most of the time and for this metric other thread statuses are not accounted for, while they are in VMSTAT

from process-exporter.

ncabatoff avatar ncabatoff commented on May 28, 2024

If you provide instructions to reproduce I'll have a look. Otherwise:

  • try decreasing scrape interval (though you may need to make the config more specific to the mysql procs for process-exporter to keep up)
  • try the -threads argument to process-exporter

from process-exporter.

PeterZaitsev avatar PeterZaitsev commented on May 28, 2024

Looking more into it.

Running "stress -c 8" Which creates 8 separate processess spinning on CPU I see:

namedprocess_namegroup_states{groupname="stress",state="Running"} 8

So it works properly for process

In general it does not seems like States are counted per thread even if --threads argument is specified:

namedprocess_namegroup_states{groupname="mysqld",state="Other"} 0
namedprocess_namegroup_states{groupname="mysqld",state="Running"} 0
namedprocess_namegroup_states{groupname="mysqld",state="Sleeping"} 1
namedprocess_namegroup_states{groupname="mysqld",state="Waiting"} 0
namedprocess_namegroup_states{groupname="mysqld",state="Zombie"} 0

We can see only one process "sleeping" here, which I guess is MySQL main thread, we have only one process

namedprocess_namegroup_num_procs{groupname="mysqld"} 1

But many threads:

namedprocess_namegroup_num_threads{groupname="mysqld"} 48

I think for practical purposes "sleeping", "running", "waiting" it is better to count threads thank procs.

from process-exporter.

ncabatoff avatar ncabatoff commented on May 28, 2024

I'm sorry, -threads was bad advice, I forgot that I never got around to adding the per-thread state metrics. I will use this issue to track that work and rename it accordingly.

from process-exporter.

ncabatoff avatar ncabatoff commented on May 28, 2024

Perhaps I've been thinking about this the wrong way. The 'state' metrics have always been weak because they're gauges: mostly everything is sleeping and waiting, and threads often run only brief intervals, so catching anything in the running state is pretty rare. #62 is probably a better way to provide visibility on how many threads are running or not, via the proposed cpu histograms.

If that takes care of measuring the running threads, we're left with just sleeping and waiting. Sleeping is the default and can be inferred to be the state of what's not running or waiting. For waiting, if I implement #18, we'll know not just how many threads are waiting, we'll see what they're waiting on. In which case this bug possibly becomes a wontfix.

from process-exporter.

PeterZaitsev avatar PeterZaitsev commented on May 28, 2024

Gauges are indeed very volatile but aggregated over period of time they can show good picture.
There is a difference between CPU usage and DiskIO and Waiting. Imagine I have 1 CPU core available. The most I can see is the process using 1 CPU core from CPU time standpoint. However this can come from 1 running thread of from 10 threads in the run queue. It would be best if it would be easy to see the time process/thread spends in Run Queue but not being on CPU or the time process spends waiting on disk IO but I do not think such stats are available and "Running" and "Blocked" Gauges are at least somewhat reasonable estimates.

from process-exporter.

ncabatoff avatar ncabatoff commented on May 28, 2024

Much as I hate to break backward compatibility, I'm going to do as you propose in this case, because I've done more testing and it looks like for threaded programs the per-state metrics aren't meaningful. They only report the state of the first thread, which can be very deceptive. The new load-generator cmd I just added always shows up as state S regardless of how many threads are in state D or R.

from process-exporter.

ncabatoff avatar ncabatoff commented on May 28, 2024

v0.4.0 pre-release includes this change (state metrics count threads instead of procs.)

from process-exporter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.