fuser with care

Back in August I wrote an entry Too much /proc is bad for you!. I came across an other command which needs to be used with care, fuser. A very useful command which finds and reports the processes which have a file open or files open in a file system. Like malt Whisky or a fine wine, which adds value in moderation, too much at one time and simple tasks start to take much longer.

Have a look at the code for the function dofusers. Simply it loops through every process in the process table looking at both each file in the file table of each process in turn and the vnode backing each segment in the address space of each process.

dtrace -n lockstat:::'{"[@[probefunc] = count()}' -c "fuser ."

shows in excess of 1 million locks acquired and released. While the 1 millions locks are no problem at all if uncontended, running multiple copies of fuser at the same time, can add considerable contention around a number of key locks such as pidlock and various address space locks.

Running 1 fuser every few seconds would have little overall impact. Trying to run multiple copies of fuser and throwing in a few calls to ps at the same time tends to make the smtx column in mpstat light up.

Comments:

Post a Comment:
Comments are closed for this entry.
About

clive

Search

Categories
Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today