Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XAJuO-00034b-HB for pgsql-performance@arkaria.postgresql.org; Thu, 24 Jul 2014 14:22:13 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XAJuN-000063-6I for pgsql-performance@arkaria.postgresql.org; Thu, 24 Jul 2014 14:22:11 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XAJuL-00005t-V3 for pgsql-performance@postgresql.org; Thu, 24 Jul 2014 14:22:10 +0000 Received: from forward8l.mail.yandex.net ([84.201.143.141]) by makus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XAJuH-0004nm-Jn for pgsql-performance@postgresql.org; Thu, 24 Jul 2014 14:22:08 +0000 Received: from smtp11.mail.yandex.net (smtp11.mail.yandex.net [95.108.130.67]) by forward8l.mail.yandex.net (Yandex) with ESMTP id 74A151A41435 for ; Thu, 24 Jul 2014 18:22:01 +0400 (MSK) Received: from smtp11.mail.yandex.net (localhost [127.0.0.1]) by smtp11.mail.yandex.net (Yandex) with ESMTP id 2F3C17E0D0D for ; Thu, 24 Jul 2014 18:22:01 +0400 (MSK) Received: from unknown (unknown [2a02:6b8:0:108:e125:ca7b:7f:d350]) by smtp11.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id sabaWi5uoe-M0iCOCp2; Thu, 24 Jul 2014 18:22:00 +0400 (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client certificate not present) X-Yandex-Uniq: 88940dec-b04c-4b60-960d-da2435b974f1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=simply.name; s=mail; t=1406211720; bh=f3FjOE3LtB/YfSrGvCb5OICw0FyHT65EJQnf9eFbqNU=; h=From:Content-Type:Subject:Message-Id:Date:To:Mime-Version: X-Mailer; b=eoX+nGK1e1Evjru2xO0eTEZd58SkNI2slGLhwKaLtJV85D4cb/sylTHhiP2IWs/Ig 0YzipJpU7IovjUcBfwBgCnohmYd5PKyNLLK1EUBhMmMHwKsb2qtOO5G5Kl3Yh5LORF Gr1M29PM8KLyF8unNj/SFQiE6EO4lLx8ISuFxKsk= Authentication-Results: smtp11.mail.yandex.net; dkim=pass header.i=@simply.name From: Borodin Vladimir Content-Type: multipart/alternative; boundary="Apple-Mail=_492274A9-3FB3-42AF-BA7D-7B29E6B1FFF2" Subject: Debugging writing load Message-Id: <06E73D38-F341-424F-AD89-8F2DC73B7D79@simply.name> Date: Thu, 24 Jul 2014 18:22:01 +0400 To: pgsql-performance@postgresql.org Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) X-Mailer: Apple Mail (2.1878.6) X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org --Apple-Mail=_492274A9-3FB3-42AF-BA7D-7B29E6B1FFF2 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1251 Hi all. I have a database with quiet heavy writing load (about 20k tps, 5k of = which do writes). And I see lots of writing I/O (I mean amount of data, = not iops) to this database, much more than I expect. My question is how = can I debug what for backend processes do lots of writes to the = $PGDATA/base directory? Below are some details. The database works on machine with 128 GB of RAM and md raid10 of 8 ssd = disks (INTEL SSDSC2BB480G4 480 GB). It runs PostgreSQL 9.3.4 on Red Hat = 6.5 with the following postgresql.conf - http://pastebin.com/LNLHppcb. = Sysctl parameters for page cache are: # sysctl -a | grep vm.dirty vm.dirty_background_ratio =3D 0 vm.dirty_background_bytes =3D 104857600 vm.dirty_ratio =3D 40 vm.dirty_bytes =3D 0 vm.dirty_writeback_centisecs =3D 100 vm.dirty_expire_centisecs =3D 300 # Total database size is now a bit more than 500 GB. I have different raid10 arrays for PGDATA and pg_xlog directory (with = different mount options). And under load iostat shows that it is written = about 20 MB/s on array with xlogs and about 200 MB/s on array with = PGDATA. Iotop shows me that ~ 80-100 MB/s of data is written by pdflush = (and it is expected behavior for me). And the other ~100 MB is being = written by backend processes (varying from 1 MB/s to 30 MB/s). = Checkpointer process, bgwriter process and autovacuum workers do really = little work (3-5 MB/s). Lsof on several backend processes shows me that backend uses just = database files (tables and indexes) and last xlog file. Is there any way = to understand why is backend writing lots of data to $PGDATA/base = directory? I have tried to use pg_stat_statements for it but I haven=92t = found a good way to understand what is happening. Is there a way to see = something like "this backend process has written these pages to disk = while performing this query"? Would be very grateful for any help. Thanks. -- Vladimir --Apple-Mail=_492274A9-3FB3-42AF-BA7D-7B29E6B1FFF2 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=windows-1251 Hi = all.

I have a database with quiet heavy writing load = (about 20k tps, 5k of which do writes). And I see lots of writing I/O (I = mean amount of data, not iops) to this database, much more than I = expect. My question is how can I debug what for backend processes do = lots of writes to the $PGDATA/base directory? Below are some = details.

The database works on machine with 128 = GB of RAM and md raid10 of 8 ssd disks (INTEL SSDSC2BB480G4 480 GB). It = runs PostgreSQL 9.3.4 on Red Hat 6.5 with the following postgresql.conf = - http://pastebin.com/LNLHppcb. = Sysctl parameters for page cache are:

# = sysctl -a | grep vm.dirty
vm.dirty_background_ratio =3D = 0
vm.dirty_background_bytes =3D = 104857600
vm.dirty_ratio =3D 40
vm.dirty_bytes =3D = 0
vm.dirty_writeback_centisecs =3D = 100
vm.dirty_expire_centisecs =3D = 300
#

Total database size is = now a bit more than 500 GB.

I have different = raid10 arrays for PGDATA and pg_xlog directory (with different mount = options). And under load iostat shows that it is written about 20 MB/s = on array with xlogs and about 200 MB/s on array with PGDATA. Iotop shows = me that ~ 80-100 MB/s of data is written by pdflush (and it is expected = behavior for me). And the other ~100 MB is being written by backend = processes (varying from 1 MB/s to 30 MB/s). Checkpointer process, = bgwriter process and autovacuum workers do really little work (3-5 = MB/s).

Lsof on several backend processes shows = me that backend uses just database files (tables and indexes) and last = xlog file. Is there any way to understand why is backend writing lots of = data to $PGDATA/base directory? I have tried to use pg_stat_statements = for it but I haven=92t found a good way to understand what is happening. = Is there a way to see something like "this backend process has written = these pages to disk while performing this = query"?

Would be very grateful for any help. = Thanks.
--
Vladimir




= --Apple-Mail=_492274A9-3FB3-42AF-BA7D-7B29E6B1FFF2--