Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Xjv5T-0007e2-Lk for pgsql-performance@arkaria.postgresql.org; Thu, 30 Oct 2014 19:08:47 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Xjv5T-0005Sl-5p for pgsql-performance@arkaria.postgresql.org; Thu, 30 Oct 2014 19:08:47 +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 1Xjv5S-0005Sf-9m for pgsql-performance@postgresql.org; Thu, 30 Oct 2014 19:08:46 +0000 Received: from smtp-out2.gransy.com ([77.78.126.49]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Xjv5O-0006uQ-03 for pgsql-performance@postgresql.org; Thu, 30 Oct 2014 19:08:44 +0000 Received: from smtp-out.gransy.com (localhost [127.0.0.1]) by smtp-out2.gransy.com (Postfix) with ESMTP id 0C2373F013F for ; Thu, 30 Oct 2014 20:08:42 +0100 (CET) Received: from smtp.gransy.com (smtp.simplia.cz [77.78.126.20]) by smtp-out2.gransy.com (Postfix) with ESMTP id 96F143F013E for ; Thu, 30 Oct 2014 20:08:41 +0100 (CET) Received: from [192.168.1.163] (ip-78-45-139-138.net.upcbroadband.cz [78.45.139.138]) (Authenticated sender: tv@fuzzy.cz) by smtp.gransy.com (Postfix) with ESMTPSA id 9FAFA19A0142 for ; Thu, 30 Oct 2014 20:08:33 +0100 (CET) Message-ID: <54528CB4.403@fuzzy.cz> Date: Thu, 30 Oct 2014 20:08:36 +0100 From: Tomas Vondra User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Incredibly slow restore times after 9.0>9.2 upgrade References: <1414529739004-5824701.post@n5.nabble.com> <5450084E.1060808@fuzzy.cz> <1414595543866-5824847.post@n5.nabble.com> In-Reply-To: <1414595543866-5824847.post@n5.nabble.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) 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 On 29.10.2014 16:12, jmcdonagh wrote: > Hi Tomas- thank you for your thoughtful response! > > > Tomas Vondra wrote >> On 28.10.2014 21:55, jmcdonagh wrote: >>> Hi, we have a nightly job that restores current production data to >>> the development databases in a 'warm spare' database so that if the >>> developers need fresh data, it's ready during the day. When we moved >>> from 9.0 to 9.2 suddenly the restores began to take from a few hours >>> to more like 15 hours or so. We're in Amazon EC2, I've tried new EBS >>> volumes, warmed them up, threw IOPS at them, pretty much all the >>> standard stuff to get more disk performance. >> >> So, if I understand it correctly, you've been restoring into 9.0, then >> you switched to 9.2 and it's much slower? > > Yes- but since the move was done utilizing snapshots so the move > involves new volumes, but I have created new volumes since then to > rule out a single bad volume. My advice would be to do some basic low-level performance tests to rule this out. Use dd or (better) fio to test basic I/O performance, it's much easier to spot issues that way. > Tomas Vondra wrote >> Is the 9.2 configured equally to 9.0? If you do something like this >> >> SELECT name, setting >> FROM pg_settings >> WHERE source = 'configuration file'; >> >> on both versions, what do you get? > > I no longer have the 9.0 box up but we do track configuration via > puppet and git. The only configuration change made for 9.2 is: > > -#standard_conforming_strings = off > +standard_conforming_strings = off Compared to 9.0, I suppose? Anyway, post the non-default config values at least for 9.2, please. > Cause we have an old app that needs this setting on otherwise we'd > spend a lot of time trying to fix it. I doubt standard_conforming_strings has anything to do with the issues. > Tomas Vondra wrote >>> Here's the thing, the disk isn't saturated. The behavior I'm seeing >>> seems very odd to me; I'm seeing the source disk which holds the dump >>> saturated by reads, which is great, but then I just see nothing being >>> written to the postgres volume. Just nothing happening, then a >>> small burst. There is no write queue backup on the destination disk >>> either. if I look at pg_stat_activity I'll see something like: >>> >>> COPY salesforce_reconciliation (salesforce_id, email, >>> advisor_salesforce_id, processed) FROM stdin >>> >>> and even for small tables, that seems to take a very long time even >>> though the destination disk is almost at 0 utilization. >> >> So, where's the bottleneck? Clearly, there's one, so is it a CPU, a >> disk or something else? Or maybe network, because you're using EBS? >> >> What do you mean by 'utilization'? How do you measure that? > > The bottleneck is I/O somehow. I say somehow, because I see iowait > averaging about 50% between two CPUs, but there is just no writes to > the destination EBS volume really happening, just reads from the > disk where the source dump is located, then bursts of writes to the > destination volume every so often. It's kind of puzzling. This is > happening on multiple database servers, in multiple availability > zones. Driving me bonkers. > > What I mean by utilization is util% from iostat -m -x 1. I find this rather contradictory. At one moment you say the disk isn't saturated, the next moment you say you're I/O bound. Also, iowait (as reported e.g. by 'top') is tricky to interpret correctly, especially on multi-cpu systems (nice intro to the complexity [1]). It's really difficult to interpret the 50% iowait without more info about what's happening on the machine. IMHO, the utilization (as reported by iotop) is much easier to interpret, because it means '% of time the device was servicing requests'. It has issues too, because 100% does not mean 'saturated' (especially on RAID arrays that can service multiple requests in parallel), but it's better than iowait. If I had to guess based from your info, I'd bet you're CPU bound, so there's very little idle time and about 50% of it is spent waiting for I/O requests (hence the 50% iowait). But in total the amount of I/O is very small, so %util is ~0. Please, post a few lines of 'iostat -x -k 1' output. Samples from 'top' and 'vmstat 1' would be handy too. regards Tomas [1] http://veithen.blogspot.cz/2013/11/iowait-linux.html -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance