X-Original-To: pgsql-performance-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 0FD699FB2A3 for ; Thu, 31 Aug 2006 15:13:57 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 26003-04-7 for ; Thu, 31 Aug 2006 15:13:47 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by postgresql.org (Postfix) with SMTP id CE9869FB3E6 for ; Thu, 31 Aug 2006 15:13:42 -0300 (ADT) Received: (qmail 5394 invoked from network); 31 Aug 2006 18:13:41 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 31 Aug 2006 18:13:41 -0000 In-Reply-To: <44F7040E.7040805@streppone.it> References: <44F7040E.7040805@streppone.it> Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <321C8D0A-243F-48A1-AF90-C4EE37E408B4@fastcrypt.com> Cc: Pg Performance list Content-Transfer-Encoding: 7bit From: Dave Cramer Subject: Re: High concurrency OLTP database performance tuning Date: Thu, 31 Aug 2006 14:13:40 -0400 To: Cosimo Streppone X-Mailer: Apple Mail (2.752.2) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.043 tagged_above=0 required=5 tests=AWL, SPF_PASS X-Spam-Level: X-Archive-Number: 200608/496 X-Sequence-Number: 20681 On 31-Aug-06, at 11:45 AM, Cosimo Streppone wrote: > Good morning, > > I'd like to ask you some advice on pg tuning in a high > concurrency OLTP-like environment. > The application I'm talking about is running on Pg 8.0.1. > Under average users load, iostat and vmstat show that iowait stays > well under 1%. Tables and indexes scan and seek times are also good. > I can be reasonably sure that disk I/O is not the *main* bottleneck > here. > > These OLTP transactions are composed each of 50-1000+ small > queries, on > single tables or 2/3 joined tables. Write operations are very > frequent, > and done concurrently by many users on the same data. > > Often there are also queries which involve record lookups like: > > SELECT DISTINCT rowid2 FROM table > WHERE rowid1 IN () OR > refrowid1 IN () > > These files are structured with rowid fields which link > other external tables, and the links are fairly complex to follow. > SQL queries and indexes have been carefully(?) built and tested, > each with its own "explain analyze". > > The problem is that under peak load, when n. of concurrent > transactions > raises, there is a sensible performance degradation. > I'm looking for tuning ideas/tests. I plan to concentrate, > in priority order, on: > > - postgresql.conf, especially: > effective_cache_size (now 5000) > bgwriter_delay (500) > commit_delay/commit_siblings (default) > - start to use tablespaces for most intensive tables > - analyze the locks situation while queries run > - upgrade to 8.1.n > - convert db partition filesystem to ext2/xfs? > (now ext3+noatime+data=writeback) > - ??? > > Server specs: > 2 x P4 Xeon 2.8 Ghz > 4 Gb RAM > LSI Logic SCSI 2x U320 controller > 6 disks in raid 1 for os, /var, WAL > 14 disks in raid 10 for db on FC connected storage > > Current config is now (the rest is like the default): > max_connections = 100 > shared_buffers = 8192 way too low, shared buffers should be 50k > work_mem = 8192 > maintenance_work_mem = 262144 > max_fsm_pages = 200000 why ? > max_fsm_relations = 1000 > bgwriter_delay = 500 > fsync = false you will lose data with this! > wal_buffers = 256 > checkpoint_segments = 32 > effective_cache_size = 5000 way too low should be on the order of 300k > random_page_cost = 2 again why ? > > Thanks for your ideas... > > -- > Cosimo > > > ---------------------------(end of > broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org >