Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 483099FB6AD for ; Fri, 25 May 2007 15:58:31 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 10638-03 for ; Fri, 25 May 2007 15:58:10 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from pop5-1.us4.outblaze.com (pop5-1.us4.outblaze.com [205.158.62.125]) by postgresql.org (Postfix) with SMTP id 2BE679FB648 for ; Fri, 25 May 2007 15:57:37 -0300 (ADT) Received: (qmail 17669 invoked from network); 25 May 2007 18:58:00 -0000 Received: from unknown (HELO nbd.it.uc3m.es) (ptb:linuxmail.org?linuxmail.org@linuxmail.org@163.117.139.192) by pop5-1.us4.outblaze.com with SMTP; 25 May 2007 18:57:59 -0000 Received: from inv.it.uc3m.es (oboe.it.uc3m.es [163.117.139.101]) by nbd.it.uc3m.es (8.13.1/8.13.1/Debian-15) with ESMTP id l4PIvYJX006572; Fri, 25 May 2007 20:57:35 +0200 Received: (from ptb@localhost) by inv.it.uc3m.es (8.11.0/8.11.0) id l4PIvYZ31429; Fri, 25 May 2007 20:57:34 +0200 From: "Peter T. Breuer" Message-Id: <200705251857.l4PIvYZ31429@inv.it.uc3m.es> Subject: Re: general PG network slowness (possible cure) (repost) In-Reply-To: <20070525133640.GF7069@it.is.rice.edu> from "Kenneth Marshall" at "May 25, 2007 08:36:40 am" To: "Kenneth Marshall" Date: Fri, 25 May 2007 20:57:34 +0200 (MET DST) CC: "Peter T. Breuer" , pgsql-performance@postgresql.org X-Anonymously-To: Reply-To: ptb@inv.it.uc3m.es X-message-flag: Had your Outlook virus, today? http://www.counterpane.com/crypto-gram-0103.html#4 X-WebTV-Stationery: Standard\; BGColor=black\; TextColor=black Reply-By: Sat, 1 Apr 2006 14:21:08 -0700 X-Mailer: ELM [version 2.4ME+ PL66 (25)] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/535 X-Sequence-Number: 24925 "Also sprach Kenneth Marshall:" > improvement from coalescing the packets. Good luck in your investigations. While I am recompiling stuff, just some stats. Typical network traffic analysis during the PG runs: Total Packets Processed 493,499 Unicast 100.0% 493,417 Broadcast 0.0% 82 Multicast 0.0% 0 pktCast distribution chart Shortest 42 bytes Average Size 192 bytes Longest 1,514 bytes <= 64 bytes 0.0% 158 64 to 128 bytes 77.3% 381,532 129 to 256 bytes 6.8% 33,362 257 to 512 bytes 8.6% 42,535 513 to 1024 bytes 4.0% 19,577 1025 to 1518 bytes 3.3% 16,335 Typical application rusage stats: time ./c -timeout 12000 -database postgresql://pebbles/d /tmp/tty_io..c user system elapsed cpu 7.866u 6.038s 5:49.13 3.9% 0+0k 0+0io 0pf+0w Those stats show the system lost in i/o. It's neither in kernel nor in userspace. Presumably the other side plus networking was the holdup. For comparison, against localhost via loopback ("fake" networking): time ./c -timeout 12000 -database postgresql://localhost/d /tmp/tty_io..c user system elapsed cpu 9.483u 5.321s 2:41.78 9.1% 0+0k 0+0io 0pf+0w but in that case postmaster was doing about 54% cpu, so the overall cpu for server + client is 63%. I moved to a unix domain socket and postmaster alone went to 68%. time ./c -timeout 12000 -database postgresql://unix/var/run/postgresql/d /tmp/tty_io..c user system elapsed cpu 9.569u 3.698s 2:52.41 7.6% 0+0k 0+0io 0pf+0w The elapsed time is not much different between unix and localhost. One can see that there is some i/o holdup because the two threads ought to do 100% between them if handover of info were costless. The difference (the system was queiscent o/w apart from the monitoring software, which shows only a fraction of a percent loading). There were no memory shortages and swap was disabled for the test (both sides) For comparison, running against gdbm straignt to disk time ./c -timeout 12000 /tmp/tty_io..c user system elapsed cpu 2.637u 0.735s 0:05.34 62.9% 0+0k 0+0io 0pf+0w Through localhost: time ./c -timeout 12000 -database gdbm://localhost/ptb/c /tmp/tty_io..c user system elapsed cpu 2.746u 3.699s 0:16.00 40.1% 0+0k 0+0io 0pf+0w (the server process was at 35% cpu, for 75% total). Across the net: time ./c -timeout 12000 -database gdbm://pebbles/ptb/c /tmp/tty_io..c user system elapsed cpu 2.982u 4.430s 1:03.44 7.9% 0+0k 0+0io 0pf+0w (the server was at 7% cpu) Have to go shopping .... Peter