April 05, 2005
HZ Value
There's been some discussion on the freebsd-questions mailing list about the "HZ" value you can set in the kernel. It basically is a setting for how often the kernel gets invoked to do its kernel thing. HZ=100 is a very common and normal setting, it can be modified. Here's a great posting by 'cpghhost' about it:On Mon, Apr 04, 2005 at 11:17:19AM +0200, Dick Hoogendijk wrote: >> I read about polling and HZ=1000. The latter is not high enough for >> vmware3 (it complains..). I read 'man polling' and learn something about >> this, but I really want to know more about 'hz=1000' >> >> The GENERIC has hz=100 as I recall (fbsd-4.11). Can somebody explain I >> "human language" what happens if you raise this HZ? Is there a processor >> related issue here? What exectly happens if you have 'hz=1000' or is it >> maybe better to have 'hz=2000' ? I can't decide now because I don't >> understand what happens.. So, anybody? This is the frequency of the heart beat. Superficially, every 1/HZ second, a clock tick happens and the kernel is invoked. Then stuff like cleanup and scheduling a new thread happens (this is not the only time when threads get scheduled though). HZ=100 is good enough for most purposes. If the kernel needs to poll some data faster and more frequently, you can crank up HZ to 1000 or even higher. A system with higher HZ is usually also more responsive, but this comes at a price: * The overhead is higher (you need more time to do internal housekeeping, and there's less time available for userland threads) * Processor caches are flushed more frequently, resulting in slower RAM access. A high value for HZ is also not a good idea for slow(er) hardware either. Interestingly, HZ=100 has remained constant for decades (!), despite CPUs getting faster all the time. This is an excellent value for most typical usage patterns. Cranking it up should only be required for special cases. Anyway, the HZ knob is there. Experiment with it until you get optimal performance.
del.icio.us | Digg it | Furl | Yahoo MyWeb | Create Social Bookmark Links
Posted by jdarnold at 01:33 PM | TrackBack
Track with co.mments
Track with co.mments 


