use fuser instead of lsof to do health check

Bug #1995501 reported by Ian Kumlien
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
kolla
Triaged
Wishlist
Unassigned

Bug Description

The current health check uses a lot of cpu even on a unloaded system... There is faster ways that uses less cpu...

Reference:
https://github.com/openstack/kolla/blob/master/docker/base/healthcheck_socket

Current implementation:
#!/bin/bash
process=$1
socket=$2

# lsof truncate command name to 15 characters and this behaviour
# cannot be disabled
if [ ${#process} -gt 15 ] ; then
    process=${process:0:15}
fi
lsof -Fc -Ua $socket | grep -q "c$process"
---

timing:
time lsof -Fc -Ua /run/openvswitch/db.sock
real 0m1.571s

And quite a bit of cpu usage...

time fuser /run/openvswitch/db.sock
real 0m0.007s

Seems more reasonable....

How ever the output format is different.

/run/openvswitch/db.sock: 20

I assume something like:
pid=$(pidof $1)
socket=$2

fuser $socket |grep -q -E "^\s+$pid$" > /dev/null
---

Would work as a replacement, but it's only a quick hack...

Changed in kolla:
importance: Undecided → Wishlist
Changed in kolla:
status: New → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.