On 08/11/2011 10:35 AM, Pandu Poluan wrote:
On Thu, Aug 11, 2011 at 14:27, Nikos Chantziaras<[email protected]> wrote:
On 08/11/2011 09:56 AM, Pandu Poluan wrote:
Just wondering, is it possible to specify a custom timer frequency?
E.g., HZ=500 instead of one of the canned values (100, 250, 300,
1000).
It is possible, but it's a bad idea because non-standard values can result
in driver breakage. Some code assumes specific timer granularities (100Hz =
10ms, 250Hz = 4ms, etc). This usually happens with values above 1000Hz, so
it might be possible to experiment with non-standard sub-1000Hz values.
But why do you want a custom value anyway?
Well, for a firewall, I've calculated (gathered and extrapolated from
a lot of sources), the latency per-packet is usually less than 1 ms,
at worst still less than 2 ms.
Thus, setting the timer freq to 100 Hz (as suggested for 'normal'
server load) means the timeslice is way too long (10 ms per time
slice).
So, I speculate that better -- and uniform -- performance will be
achieved with a timer freq of 500 Hz.
Of course, this is a wild speculation/guess from me. I never quite
understand netfilter/xtables' relation to the timeslices, so I may be
talking nonsense :-)
This assumes that networking is dependent on the timer interrupt, which
doesn't seem to be the case; going from 100Hz to 1000Hz will not result
in network latencies dropping by 9ms. I know because I tried it on a
server.
The only case where network latency improved with a higher HZ was with a
game server (Counter-Strike) and that's only because that game's server
component is timer dependent when calculating the game world (to do 1000
updates per second it needs a HZ value of 1000). So that application
has some real-time demands, meaning a high HZ value helps. Otherwise,
you can stick to 100Hz on a server. Higher values won't change anything
and will only reduce throughput (though not by much anyway, which is why
some people set 1000Hz even on servers.)