Gentoo Archives: gentoo-server

From: Bastian Balthazar Bux <BastianBalthazarBux@×××××××××.it>
To: gentoo-server@l.g.o
Subject: Re: [gentoo-server] Forthcoming 2.6.13 timer frequency changes & server performance
Date: Wed, 03 Aug 2005 12:00:28
Message-Id: 42F0B171.5000504@pnpitalia.it
In Reply to: [gentoo-server] Forthcoming 2.6.13 timer frequency changes & server performance by Kerin Millar
1 Kerin Millar wrote:
2 > Hi folks.
3 >
4 > The forthcoming kernel will be introducing a rather visible (and
5 > potentially important) change. Firstly, it will provide an option to
6 > select the default timer frequency. Secondly, the default frequency
7 > will now be 250HZ. For the record, the value used to be 100HZ and was
8 > rather drastically changed to 1000HZ for 2.6. It will now be possible
9 > to choose a HZ value of either 100, 250 or 1000.
10 >
11 > The most interesting aspect of the timer is that it affects scheduling
12 > granularity. That is, the minimum possible time for which a given
13 > process is allowed to run before interruption. This is commonly known
14 > as a "jiffy" and can be calculated by dividing 1000 by the HZ value.
15 > So, the length of a jiffy in 2.6 at present is 1ms. In general, a
16 > longer jiffy results in more throughput but with more latency whereas
17 > a shorter jiffy results in less throughput (due to the overhead from
18 > frequent interruption) but with a reduction in latency. In my view,
19 > this is rather interesting in terms of the impact this can have on
20 > server performance. The help text for the new kernel configuration
21 > option explains further:
22 >
23 > - "Allows the configuration of the timer frequency. It is customary to
24 > have the timer interrupt run at 1000 HZ but 100 HZ may be more
25 > beneficial for servers and NUMA systems that do not need to have a
26 > fast response for user interaction and that may experience bus
27 > contention and cacheline bounces as a result of timer interrupts. Note
28 > that the timer interrupt occurs on each processor in an SMP
29 > environment leading to NR_CPUS * HZ number of timer interrupts per
30 > second."
31 >
32 > The specific help text for the 100HZ option is as follows:
33 >
34 > - "100 HZ is a typical choice for servers, SMP and NUMA systems with
35 > lots of processors that may show reduced performance if too many timer
36 > interrupts are occurring."
37 >
38 > For 250HZ:
39 >
40 > - "250 HZ is a good compromise choice allowing server performance
41 > while also showing good interactive responsiveness even on SMP and
42 > NUMA systems."
43 >
44 > For 1000HZ:
45 >
46 > - "1000 HZ is the preferred choice for desktop systems and other
47 > systems requiring fast interactive responses to events."
48 >
49 > Another interesting point that is not mentioned above is that reducing
50 > the timer frequency can significantly help to reduce time drift
51 > (particularly on "real" SMP systems where this effect may be even more
52 > pronounced). The reason that I am posting is twofold:
53 >
54 > * To notify everyone that this change is coming
55 > * To provide a means for anyone interested to test the ramifications
56 > of this newly acquired flexibility using a 2.6.12 kernel prior to the
57 > eventual release of 2.6.13.
58 >
59 > To that end I have grabbed the specific patch that adds the
60 > configuration option which can be found here:
61 >
62 > http://www.recruit2recruit.net/kerframil/2.6.12-i386-selectable-hz.patch
63 >
64 > This patch is taken directly from upstream (the option itself can be
65 > found at the bottom of the "Processor type and features" menu).
66 > Interestingly, the change has drawn attention to a few areas in the
67 > kernel where the methods used for timing (such as delay loops) are not
68 > ideal. So I have gone through all of the patches committed to the
69 > mainline tree since 2.6.12.3 and collected the ones that are relevant
70 > then aggregated them into one patch (the second one applies cleanly
71 > against a gentoo-sources tree):
72 >
73 > http://www.recruit2recruit.net/kerframil/2.6.12-timing-fixes-rollup.patch
74 > http://www.recruit2recruit.net/kerframil/2.6.12-gentoo-r7-timing-fixes-rollup.patch
75 >
76 > The individual patches are all very small and non-intrusive by nature.
77 > They are certainly not critical in order to be able to change the
78 > timer frequency but I recommend that they be used. For the curious,
79 > some notes on the contents of the patch can be found here here:
80 > http://www.recruit2recruit.net/kerframil/NOTES-2.6.12-timing-fixes-rollup
81 >
82 > What I would like is for anyone who is interested to put an alternate
83 > value (100 or 250) to the test (if they are in a position to be able
84 > to do so) and to determine whether there is any clear performance
85 > improvement with their workload. I switched my system (Compaq Proliant
86 > ML370) to 100HZ 2 days ago and can at least confirm that it is stable
87 > although I have not yet had the opportunity to perform any comparative
88 > benchmarks. If in doubt, then 250 might be a good value to try as,
89 > after all, that is going to be the default - at least for x86 ;)
90 >
91 > Finally, this topic has generated a nice little flame war over on the
92 > LKML (actually, it's quite an interesting thread if a little confusing
93 > at points):
94 >
95 > http://kerneltrap.org/node/5430
96 > http://lkml.org/lkml/2005/7/8/259
97 >
98 > Cheers,
99 >
100 > --Kerin Millar
101 >
102
103 Good idea to publicize this.
104
105 Another thing that should be mentioned is that the timer frequency for
106 2.4 kernels was(/is?) fixed to 100 Hz.
107
108 --
109 gentoo-server@g.o mailing list

Replies