Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 80F6E6326EB for ; Thu, 20 May 2010 19:19:58 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 95798-04 for ; Thu, 20 May 2010 22:19:50 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.171]) by mail.postgresql.org (Postfix) with ESMTP id 5971163222E for ; Thu, 20 May 2010 19:19:51 -0300 (ADT) Received: from [192.168.1.130] ([24.114.252.242]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0LqFFo-1NbTQh3qSG-00dkxK; Fri, 21 May 2010 00:19:48 +0200 Message-ID: <4BF5B582.1030809@2ndquadrant.com> Date: Thu, 20 May 2010 18:19:46 -0400 From: Greg Smith User-Agent: Thunderbird 2.0.0.24 (X11/20100317) MIME-Version: 1.0 To: Balkrishna Sharma CC: pgsql-admin@postgresql.org Subject: Re: Asynchronous commit | Transaction loss at server crash References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V01U2FsdGVkX193mIJQ5jgegARGZO7x4iI4QULlDD/Uqy2UWTx I0v/qtZ9uWBx5Laek6JiuFpPJezI3hoomimW6HWB/TPjg8iCYV NgDpRhEs7pDMsUOIr8s2l7ZWkT4PIHB X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.13 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SORBS_WEB=0.77 X-Spam-Level: X-Archive-Number: 201005/207 X-Sequence-Number: 34680 Balkrishna Sharma wrote: > I need to support several hundreds of concurrent update/inserts from > an online form with pretty low latency (maybe couple of milliseconds > at max). Think of a save to database at every 'tab-out' in an online form. I regularly see 2000 - 4000 small write transactions per second on systems with a battery-backed write cache and a moderate disk array attached. 2000 TPS = 0.5 ms, on average. Note however that it's extremely difficult to bound the worst-case behavior possible here anywhere near that tight. Under a benchmark load I can normally get even an extremely tuned Linux configuration to occasionally pause for 1-3 seconds at commit time, when the OS write cache is full, a checkpoint is finishing, and the client doing the commit is stuck waiting for that. They're rare but you should expect to see that situation sometimes. We know basically what causes that and how to make it less likely to happen in a real application. But the possibility is still there, and if your design cannot tolerate an occasional latency uptick you may be disappointed because that's very, very hard to guarantee with the workload you're expecting here. There are plenty of ideas for how to tune in that direction both at the source code level and by carefully selecting the OS/filesystem combination used, but that's not a very well explored territory. The checkpoint design in the database has known weaknesses in this particular area, and they're impossible to solve just by throwing hardware at the problem. -- Greg Smith 2ndQuadrant US Baltimore, MD PostgreSQL Training, Services and Support greg@2ndQuadrant.com www.2ndQuadrant.us