Gentoo Archives: gentoo-user

From: Pandu Poluan <pandu@××××××.info>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: Custom Timer Frequency (CONFIG_HZ)?
Date: Thu, 11 Aug 2011 14:58:06
Message-Id: CAA2qdGXH71qAJDz0=9wsaGPNhE9KYASgUP6M=yZvHK0Fe3xV8g@mail.gmail.com
In Reply to: [gentoo-user] Re: Custom Timer Frequency (CONFIG_HZ)? by Nikos Chantziaras
1 On Thu, Aug 11, 2011 at 15:06, Nikos Chantziaras <realnc@×××××.de> wrote:
2 > On 08/11/2011 10:35 AM, Pandu Poluan wrote:
3 >>
4 >> On Thu, Aug 11, 2011 at 14:27, Nikos Chantziaras<realnc@×××××.de>  wrote:
5 >>>
6 >>> On 08/11/2011 09:56 AM, Pandu Poluan wrote:
7 >>>>
8 >>>> Just wondering, is it possible to specify a custom timer frequency?
9 >>>> E.g., HZ=500 instead of one of the canned values (100, 250, 300,
10 >>>> 1000).
11 >>>
12 >>> It is possible, but it's a bad idea because non-standard values can
13 >>> result
14 >>> in driver breakage.  Some code assumes specific timer granularities
15 >>> (100Hz =
16 >>> 10ms, 250Hz = 4ms, etc).  This usually happens with values above 1000Hz,
17 >>> so
18 >>> it might be possible to experiment with non-standard sub-1000Hz values.
19 >>>
20 >>> But why do you want a custom value anyway?
21 >>>
22 >>
23 >> Well, for a firewall, I've calculated (gathered and extrapolated from
24 >> a lot of sources), the latency per-packet is usually less than 1 ms,
25 >> at worst still less than 2 ms.
26 >>
27 >> Thus, setting the timer freq to 100 Hz (as suggested for 'normal'
28 >> server load) means the timeslice is way too long (10 ms per time
29 >> slice).
30 >>
31 >> So, I speculate that better -- and uniform -- performance will be
32 >> achieved with a timer freq of 500 Hz.
33 >>
34 >> Of course, this is a wild speculation/guess from me. I never quite
35 >> understand netfilter/xtables' relation to the timeslices, so I may be
36 >> talking nonsense :-)
37 >
38 > This assumes that networking is dependent on the timer interrupt, which
39 > doesn't seem to be the case; going from 100Hz to 1000Hz will not result in
40 > network latencies dropping by 9ms.  I know because I tried it on a server.
41 >
42
43 That's what I was concerned of.
44
45 > The only case where network latency improved with a higher HZ was with a
46 > game server (Counter-Strike) and that's only because that game's server
47 > component is timer dependent when calculating the game world (to do 1000
48 > updates per second it needs a HZ value of 1000).  So that application has
49 > some real-time demands, meaning a high HZ value helps.  Otherwise, you can
50 > stick to 100Hz on a server.  Higher values won't change anything and will
51 > only reduce throughput (though not by much anyway, which is why some people
52 > set 1000Hz even on servers.)
53 >
54
55 Hmmm... I *do* feel better response (interaction-wise via SSH) if I
56 use >100, so I think I'll settle for 250 Hz.
57
58 Thanks for the explanation!
59
60 Rgds,
61 --
62 FdS Pandu E Poluan
63 ~ IT Optimizer ~
64
65  • Blog : http://pepoluan.tumblr.com
66  • Linked-In : http://id.linkedin.com/in/pepoluan