Skip site navigation (1) Skip section navigation (2)

Re: backups blocking everything

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Samuel Gendler <sgendler(at)ideasculptor(dot)com>
Cc: "Nicholson, Brad (Toronto, ON, CA)" <bnicholson(at)hp(dot)com>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: backups blocking everything
Date: 2011-10-28 21:20:34
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
On Thu, Oct 27, 2011 at 6:29 PM, Samuel Gendler
<sgendler(at)ideasculptor(dot)com> wrote:
> On Thu, Oct 27, 2011 at 2:15 PM, Samuel Gendler <sgendler(at)ideasculptor(dot)com>
> wrote:
>> There are definitely no bloated tables.  The large tables are all
>> insert-only, and old data is aggregated up and then removed by dropping
>> whole partitions.  There should be no bloat whatsoever.  The OLTP side of
>> things is pretty minimal, and I can pg_dump those schemas in seconds, so
>> they aren't the problem, either.  I don't know what the I/O utilization is
>> during the dump, offhand. I'll be doing a more thorough investigation
>> tonight, though I suppose I could go look at the monitoring graphs if I
>> weren't in the middle of 6 other things at the moment.  the joys of startup
>> life.
> Does pg_dump use work_mem, maintenance_work_mem, or both?  I'm seeing a huge
> spike in swap-in during the period when I can't get into the db, then a
> little bit of swap out toward the end.  We've got very little OLTP traffic -
> like one or two users logged in and interacting with the system at a time,
> at most, so I've got work_mem set pretty high, as most of our reporting
> queries do large aggregations that grind to a halt if they go to disk.
> Besides, we've got nearly 200GB of RAM.  But it would seem that pg_dump is
> allocating a large number of work_mem (or maintenance_work_mem) segments.
> # show work_mem;
>  work_mem
> ----------
>  512MB
> (1 row)
> # show maintenance_work_mem;
>  maintenance_work_mem
> ----------------------
>  2GB
> To be honest, I'm not entirely certain how to interpret some of the graphs
> I'm looking at in this context.
> here are some pictures of what is going on. The db monitoring itself goes
> away when it eats all of the connections, but you can see what direction
> they are headed and the values when it finally manages to get a connection
> again at the end of the period.  All of the other numbers are just host
> monitoring, so they are continuous through the shutout.
> Memory usage on the host (shared buffers is set to 8GB):
> Swap Usage:
> Swap rate:
> CPU utilization:
> Load Average:
> disk IO for system disk (where the backup is being written to):
> disk IO for WAL volume:
> disk IO for data volume:
> Various postgres monitors - the graph names are self explanatory:

hrm -- it doesn't look like you are i/o bound -- postgres is
definitely the bottleneck.  taking a dump off of production is
throwing something else out of whack which is affecting your other

band aid solutions might be:
*) as noted above, implement hot standby and move dumps to the standby
*) consider adding connection pooling so your system doesn't
accumulate N processes during dump

a better diagnosis might involve:
*) strace of one of your non-dump proceses to see where the blocking
is happening
*) profiling one of your user processes and compare good vs bad time

Is there anything out of the ordinary about your application that's
worth mentioning?  using lots of subtransactions? prepared
transactions? tablespaces? huge amounts of tables? etc?

Have you checked syslogs/dmesg/etc for out of the ordinary system events?


In response to


pgsql-performance by date

Next:From: Samuel GendlerDate: 2011-10-28 23:51:07
Subject: Re: backups blocking everything
Previous:From: David BorehamDate: 2011-10-28 19:55:49
Subject: Re: WAL in RAM

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group