matching by name rather than PID is noticeably higher cpu usage

Issue #214 resolved
Karl Palsson created an issue

I'm using monit 5.10, but I haven't seen anything in the change log to indicate anything in this area has changed. I'm using monit with OpenWrt, which recently switched init systems, and no longer has ready access to pid files for processes anymore. After switching my process check files to use regexp matching instead of pid file matching, the cpu usage of monit is noticeably higher[1], every 60 seconds (the scan interval) Some preliminary investigation with monit -vI and "perf" shows that it seems to be occupied with scanf/printf, presumably in the code scanning the /proc tree.

I'm not entirely sure if there's anything that can actually be done about this, but I'd be interested in hearing if there are any workarounds or tweaks I can use to improve this in my matching rules, or in monit itself.

[1] higher from "I don't notice monit as using cpu" to "monit is using 15-25% cpu, often"

Comments (6)

  1. Tildeslash repo owner

    Hello,

    we work on process engine refactoring and will it make more effective (less memory in general, less cpu for pattern based match).

  2. Tildeslash repo owner

    Fix Issue #60: The process match check may report false positive ... if we find matching process and it is not running, scan the rest of process tree.

    Fix Issue #214: The process match check has high CPU requirements on low power systems ... use cached PID.

    → <<cset e5bbe778c8be>>

  3. Log in to comment