vmstat -f shows large number of forks

According to the man page, it includes all calls to fork, vfork or clone. The last one of these three (clone) is used by Java to implement its threads

So each time your Java server creates a new thread, that value increments.

Providing it doesn't go silly, it should be fine. How many per second do you see on average?


Any process that spawns another process without itself terminating is a fork - for example, every command that's executed at a shell will be counted as a fork. An very high number of fork calls since the system booted is totally normal.


The first thing to note is that running vmstat with out its two time arguments show the accumulated value since last reboot. You'd have to run it multiple times to get a "forks per second" number to see if it's really a big number or not. Something like this (which could obviously be made into a much friendlier script):

g3 0 /home/jj33 ># while true
> do
>   vmstat -f
>   sleep 15
> done
       278039 forks
       278044 forks
       278047 forks
       278051 forks

So, that system did 5, 3, and 4 forks in 3 15 second intervals, which, given that every process call on a *nix box involves a fork, doesn't seem like a big number.