Received: from localhost (unknown [200.46.204.184]) by developer.postgresql.org (Postfix) with ESMTP id 3EC162E0038 for ; Wed, 16 Apr 2008 12:23:04 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 64542-02 for ; Wed, 16 Apr 2008 12:22:58 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from morework.geizhals.at (home.geizhals.at [213.229.14.34]) by developer.postgresql.org (Postfix) with ESMTP id 6C9B82E0037 for ; Wed, 16 Apr 2008 12:22:58 -0300 (ADT) Received: from localhost (morework [127.0.0.1]) by morework.geizhals.at (Postfix) with ESMTP id D656718C70E for ; Wed, 16 Apr 2008 17:22:54 +0200 (CEST) X-Virus-Scanned: amavisd-new at geizhals.at Received: from morework.geizhals.at ([127.0.0.1]) by localhost (morework.geizhals.at [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hL346e18x2pz for ; Wed, 16 Apr 2008 17:22:47 +0200 (CEST) Received: from [172.16.43.6] (unknown [172.16.43.6]) by morework.geizhals.at (Postfix) with ESMTP for ; Wed, 16 Apr 2008 17:22:47 +0200 (CEST) Message-ID: <480619CA.2080904@geizhals.at> Date: Wed, 16 Apr 2008 17:22:50 +0200 From: Marinos Yannikos User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Background writer underemphasized ... Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200804/203 X-Sequence-Number: 29696 Hi, to save some people a headache or two: I believe we just solved our performance problem in the following scenario: - Linux 2.6.24.4 - lots of RAM (32GB) - enough CPU power (4 cores) - disks with relatively slow random writes (SATA RAID-5 / 7 disks, 128K stripe, ext2) Our database is around 86GB, the busy parts being 20-30GB. Typical load is regular reads of all sizes (large joins, sequential scans on a 8GB table, many small selects with few rows) interspersed with writes of several 1000s rows on the busier tables by several clients. After many tests and research revolving around the Linux I/O-Schedulers (which still have some issues one should be wary about: http://lwn.net/Articles/216853/) because we saw problems when occasional (intensive) writes completely starved all I/O, we discovered that changing the default settings for the background writer seems to have solved all these problems. Performance is much better now with fsync on than it was with fsync off previously, no other configuration options had a noticeable effect on performance (or these problems rather). This helped with our configuration: bgwriter_delay = 10000ms # 10-10000ms between rounds bgwriter_lru_maxpages = 1000 # 0-1000 max buffers written/round Previously, our typical writes resulted in around 5-10MB/s going to disk and some reads stalling, now we are seeing typical disk I/O in the 30-60MB/s range with write load present and no noticeable problems with reads except when autovacuum's "analyze" is running. Other options we have tried/used were shared_buffers between 200MB and 20GB, wal_buffers = 256MB, wal_writer_delay=5000ms ... So, using this is highly recommended and I would say that the documentation does not do it justice... (and yes, I could have figured it out earlier) -mjy