[HACKERS] Seeing context switch storm with 10/13 snapshot of 8.1beta3

2005-10-13 Thread Robert Creager

I've been having this problem since trying to upgrade from 7.4.1 to 8.03, and
now 8.1.

It's a dual Xenon machine:
Linux annette.stortek.com 2.4.22-26mdkenterprise #1 SMP Wed Jan 7 07:10:39 MST
2004 i686 unknown unknown GNU/Linux

PostgreSQL version is:
---

 PostgreSQL 8.1beta3 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.1
(Mandrake Linux 9.2 3.3.1-2mdk)

[EMAIL PROTECTED] creagrs]$ /usr/local/pgsql810/bin/pg_config
BINDIR = /usr/local/pgsql810/bin
DOCDIR = /usr/local/pgsql810/doc
INCLUDEDIR = /usr/local/pgsql810/include
PKGINCLUDEDIR = /usr/local/pgsql810/include
INCLUDEDIR-SERVER = /usr/local/pgsql810/include/server
LIBDIR = /usr/local/pgsql810/lib
PKGLIBDIR = /usr/local/pgsql810/lib
LOCALEDIR =
MANDIR = /usr/local/pgsql810/man
SHAREDIR = /usr/local/pgsql810/share
SYSCONFDIR = /usr/local/pgsql810/etc
PGXS = /usr/local/pgsql810/lib/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--enable-syslog' '--prefix=/usr/local/pgsql810' '--enable-debug'
CC = gcc
CPPFLAGS = -D_GNU_SOURCE
CFLAGS = -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline -Wendif-labels
-fno-strict-aliasing -g
CFLAGS_SL = -fpic
LDFLAGS = -Wl,-rpath,/usr/local/pgsql810/lib
LDFLAGS_SL =
LIBS = -lpgport -lz -lreadline -lncurses -lcrypt -lresolv -lnsl -ldl -lm -lbsd
VERSION = PostgreSQL 8.1beta3

I can reproduce this problem quite quickly with 20 concurrent queries ( 20
minutes with 5 sets of my app at 4 queries a piece, probably quicker).  The
queries nominally take  .1 second, but when all 5 sets run, the queries are up
around 5-6 seconds.  CS hit over 100k.  Below is a vmstat over a few seconds
which show the problem, then it subsides, then it hits again.  Note that when my
application gets up to 5 sets of 8, it never comes down again, and the queries
are over 40 seconds to complete.

When run against 7.4.1, the CS problem does not occur (stays  10k).

[EMAIL PROTECTED] creagrs]$ vmstat 1
procs ---memory-- ---swap-- -io --system-- cpu
 r  b   swpd   free   buff  cache   si   sobibo   incs us sy id wa
10  0   1032  63120 48 160847200 5183 6 92  8  0  0
 8  0   1032  62584 48 160848000 024  173 97793 39 61  0  0
 9  0   1032  62332 48 160850000 032  197 83089 43 57  0  0
 4  0   1032  61216 48 160850800 016  158 79967 43 57  0  0
 6  0   1032  65208 48 160855600 088  262 91266 52 48  0  0
 5  0   1032  67368 48 160855600 0   292  235 14234 87 13  0  0
 4  0   1032  65780 48 160858000 040  173   325 95  5  0  0
 4  0   1032  64764 48 160858000 0 0  14486 98  2  0  0
 6  0   1032  65800 48 160858000 024  197   397 96  4  0  0
 6  0   1032  66284 48 160860400 064  234  9284 83 17  0  0
 6  0   1032  66104 48 160860400 0   116  253 87658 56 44  0  0
 5  0   1032  66276 48 160861200 056  245 20648 81 19  0  0
 6  0   1032  65736 48 160864400 088  250 19699 82 18  0  0
 5  0   1032  65316 48 160865200 040  215 73709 70 30  0  0
 5  0   1032  67664 48 160870000 096  272 2 81 19  0  0
 4  0   1032  66700 48 160870000 084  188   351 93  7  0  0
 4  0   1032  67696 48 160873200 064  210   505 91  9  0  0
 4  0   1032  67696 48 160873200 0 0  13986 99  1  0  0
 4  0   1032  64612 48 160873200 0 0  13474 99  1  0  0
 5  0   1032  65344 48 160875600 048  206   421 94  6  0  0
 4  0   1032  66636 48 160876400 016  171   232 96  4  0  0
 4  0   1032  67404 48 160876400 0 0  13671 100  0  0  0
 7  0   1032  63544 48 160878000 056  239 67250 65 35  0  0
 6  0   1032  65168 48 160879600 056  230 87782 59 41  0  0
 7  0   1032  66588 48 160882000 072  236 106591 42 58  0  0
 8  0   1032  62544 48 160883600 0   184  244 129696 48 52  0  0
 4  0   1032  63504 48 160886000 072  245 110887 48 52  0  0
 8  0   1032  63400 48 160886800 016  156 101638 35 65  0  0
 8  0   1032  62744 48 160886800 024  193 91159 40 60  0  0
 8  0   1032  63700 48 160886800 016  172 85165 42 58  0  0
 7  0   1032  62888 48 160887600 048  228 94902 42 58  0  0
 4  0   1032  64184 48 160890800 072  234 117585 46 54  0  0
 7  0   1032  61832 48 160894800 072  209 104287 46 54  0  0
 8  0   1032  64468 48 160895600 056  237 112181 44 56  0  0
 7  0   1032  63032 48 160897200 056  236 114977 47 53  0  0
 8  0   1032  63204 48 1608980   

Re: [HACKERS] Seeing context switch storm with 10/13 snapshot of 8.1beta3

2005-10-13 Thread Tom Lane
Robert Creager [EMAIL PROTECTED] writes:
 I've been having this problem since trying to upgrade from 7.4.1 to 8.03, and
 now 8.1.

Can you put together a test case that other people could use to
reproduce it?

regards, tom lane

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


Re: [HACKERS] Seeing context switch storm with 10/13 snapshot of 8.1beta3

2005-10-13 Thread Tom Lane
Robert Creager [EMAIL PROTECTED] writes:
 Is there anything I might be able to do (without the test case) that
 would help figure out what's happening?

oprofile stats would be enlightening, perhaps.

I'm particularly interested in why 7.4 is behaving better than newer
versions --- that does not compute ;-).  Have you checked that the same
query plan is being used by 7.4 and the newer versions?  Could you get
oprofile results for both versions?

regards, tom lane

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly