Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 327C2B5DC09 for ; Tue, 24 May 2011 16:21:00 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 04510-09 for ; Tue, 24 May 2011 19:20:53 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.gransy.com (mail.gransy.com [82.208.29.194]) by mail.postgresql.org (Postfix) with ESMTP id 46D5CB5DBE8 for ; Tue, 24 May 2011 16:20:52 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mail.gransy.com (Postfix) with ESMTP id 7155B4A2205 for ; Tue, 24 May 2011 21:20:51 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at nathalia.gransy.com Received: from mail.gransy.com ([127.0.0.1]) by localhost (Nathalka.gransy.com.gransy.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gPylz7mFUuXv for ; Tue, 24 May 2011 21:20:50 +0200 (CEST) Received: from [192.168.1.221] (ip-94-112-0-189.net.upcbroadband.cz [94.112.0.189]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.gransy.com (Postfix) with ESMTPSA id D9C314A2203 for ; Tue, 24 May 2011 21:20:50 +0200 (CEST) Message-ID: <4DDC0514.3070207@fuzzy.cz> Date: Tue, 24 May 2011 21:20:52 +0200 From: Tomas Vondra User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101219 Lightning/1.0b3pre Thunderbird/3.1.7 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Performance degradation of inserts when database size grows References: In-Reply-To: X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201105/326 X-Sequence-Number: 43835 Dne 24.5.2011 07:24, Terry Schmitt napsal(a): > As near as I can tell from your test configuration description, you have > JMeter --> J2EE --> Postgres. > Have you ruled out the J2EE server as the problem? This problem may not > be the database. > I would take a look at your app server's health and look for any > potential issues there before spending too much time on the database. > Perhaps there are memory issues or excessive garbage collection on the > app server? It might be part of the problem, yes, but it's just a guess. We need to se some iostat / iotop / vmstat output to confirm that. The probable cause here is that the indexes grow with the table, get deeper, so when you insert a new row you need to modify more and more pages. That's why the number of buffers grows over time and the checkpoint takes more and more time (the average write speed is about 15 MB/s - not sure if that's good or bad performance). The question is whether this is influenced by other activity (Java GC or something) I see three ways to improve the checkpoint performance: 1) set checkpoint_completion_target = 0.9 or something like that (this should spread the checkpoint, but it also increases the amount of checkpoint segments to keep) 2) make the background writer more aggressive (tune the bgwriter_* variables), this is similar to (1) 3) improve the write performance (not sure how random the I/O is in this case, but a decent controller with a cache might help) and then two ways to decrease the index overhead / amount of modified buffers 1) keep only the really necessary indexes (remove duplicate, indexes, remove indexes where another index already performs reasonably, etc.) 2) partition the table (so that only indexes on the current partition will be modified, and those will be more shallow) Tomas