[PERFORM] Context switching and Xeon processors

2005-12-06 Thread Brandon Metcalf
We're running a dual Xeon machine with hyperthreading enabled and
PostgreSQL 8.0.3.  Below is the type of CPUs:

  processor   : 3
  vendor_id   : GenuineIntel
  cpu family  : 15
  model   : 4
  model name  : Intel(R) Xeon(TM) CPU 3.20GHz
  stepping: 1
  cpu MHz : 3200.274
  cache size  : 1024 KB
  ...

We've been tuning the kernel (2.4 SMP flavor) and have improved
performance quite a bit.  I'm now wondering if turning off HT will
improve performance even more.  Based on the vmstat output below, is
the context switching typical or too high?  And what is the latest on
the state of PostgreSQL running on Xeon processors with HT turned on?
I searched the archives, but couldn't discern anything definitive.

   r  b   swpd   free   buff  cache   si   sobibo   incs us sy wa id
   1  0 135944  64612  17136 375681600 0   210  154   178  2  0  4 
94
   1  0 135940  46600  17204 375449600 1  1231  442  3658  7  3 10 
80
   1  3 135940  51228  17240 375468000 0  1268  255  2659  4  1 14 
81
   1  0 135940  58512  17300 375468400 0  1818  335  1526  2  1 32 
65
   1  1 135940  18104  17328 380651600 17670   476 1314  1962  2  2 41 
56
   0  1 135940  17776  17232 381162000 23193   394 1600  2097  2  2 53 
44
   0  1 135940  17944  17188 380963600 25459   349 1547  2013  2  2 50 
46
   0  3 135940  18816  15184 379831200 24284  1328 1529  4730  6  5 53 
36
   0  6 135940  23536   6060 381708800 27376  1332 1350  2628  2  3 56 
39
   0  5 135940  18008   6036 382713200 18806  1539 1410  1416  1  2 61 
36
   0  5 135940  18492   5708 382666000  3540 10354  736   955  2  2 76 
20
   0  3 135940  18940   5788 382986400  2308  7506  707   519  2  1 81 
15
   1  4 135940  18980   5820 382883600   138  3503  556   261  1  0 74 
24
   0 10 135940  39332   5896 32400   579  2805  621  4104  7  4 54 
35
   0  4 135936  37816   5952 379140400   260  1887  384  1574  2  1 40 
57
   0  5 135936  29552   5996 380226000   290  1642  434  1944  3  1 38 
58


-- 
Brandon

---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [PERFORM] Context switching and Xeon processors

2005-12-06 Thread Brandon Metcalf
t == [EMAIL PROTECTED] writes:

 t Brandon Metcalf [EMAIL PROTECTED] writes:
 t  We've been tuning the kernel (2.4 SMP flavor) and have improved
 t  performance quite a bit.  I'm now wondering if turning off HT will
 t  improve performance even more.  Based on the vmstat output below, is
 t  the context switching typical or too high?

 t Given that your CPU usage is hovering around 2%, it's highly unlikely
 t that you'll be able to measure any change at all by fiddling with HT.
 t What you need to be working on is disk I/O --- the 80% wait number
 t is what should be getting your attention, not the CS number.

 t (FWIW, on the sort of hardware you're talking about, I wouldn't worry
 t about CS rates lower than maybe 1/sec --- the hardware can sustain
 t well over 10x that.)


Yes, I agree the disk I/O is an issue and that's what we've been
addressing with the tuning we've been doing and have been able to
improve.  I think that we really need to go to a RAID 10 array to
address the I/O issue, but thought I would investigate the context
switching issue.

Thanks for the information.

-- 
Brandon

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq


Re: [PERFORM] Context switching and Xeon processors

2005-12-06 Thread Steinar H. Gunderson
On Tue, Dec 06, 2005 at 03:01:02PM -0600, Brandon Metcalf wrote:
 We're running a dual Xeon machine with hyperthreading enabled and
 PostgreSQL 8.0.3.

The two single most important things that will help you with high rates of
context switching:

  - Turn off hyperthreading.
  - Upgrade to 8.1.

/* Steinar */
-- 
Homepage: http://www.sesse.net/

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match