Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 75068215DC2 for ; Mon, 23 Jan 2012 13:39:35 -0400 (AST) Received: from elizabeth.gransy.com ([89.187.132.199]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RpNrf-0000L8-6i for pgsql-performance@postgresql.org; Mon, 23 Jan 2012 17:39:35 +0000 Received: from sq.gransy.com (localhost [127.0.0.1]) by elizabeth.gransy.com (Postfix) with ESMTP id 28B0115E4110; Mon, 23 Jan 2012 18:39:14 +0100 (CET) Received: from 85.163.150.82 (SquirrelMail authenticated user tv@fuzzy.cz) by sq.gransy.com with HTTP; Mon, 23 Jan 2012 18:39:14 +0100 Message-ID: In-Reply-To: References: <4F1C98FE.1030307@fuzzy.cz> Date: Mon, 23 Jan 2012 18:39:14 +0100 Subject: Re: spikes in pgbench read-only results From: "Tomas Vondra" To: "Merlin Moncure" Cc: "Tomas Vondra" , pgsql-performance@postgresql.org User-Agent: SquirrelMail/1.4.21 MIME-Version: 1.0 Content-Type: text/plain;charset=utf-8 X-Priority: 3 (Normal) Importance: Normal Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201201/57 X-Sequence-Number: 46070 On 23 Leden 2012, 18:03, Merlin Moncure wrote: > 2012/1/22 Tomas Vondra : >> Hi, >> >> I'm working on a benchmark that demonstrates the effects of moving >> tables or indexes to separate devices (SSD and HDD), and one thing tha= t >> really caught my eye are spikes in the tps charts. See this: >> >> =C2=A0http://www.fuzzy.cz/tmp/data-indexes/indexes.html >> >> The first one is a database with data on an SSD and indexes on 7.2k HD= D. >> Around 2:00, the performance significantly grows (over 4k tps) and the= n >> falls to about 500 tps (which is maintained for the remainder of the >> benchmark). >> >> I've seen similar spikes on HDD (both data and indexes on the same >> device) - that's the second chart. The difference is not that huge, bu= t >> the spike at around 6:00 is noticeable. >> >> Interestingly, by separating the data and indexes to two 7.2k drives, >> the spike disappears - that's the third chart. >> >> Any ideas why this happens? Is this a pgbench-only anomaly that does n= ot >> happen in real-world scenarios? >> >> My theory is that it's related to the strategy that chooses what to ke= ep >> in shared_buffers (or page cache), and that somehow does not work too >> well in this case. > > ISTM the spike is coming from luck such that all data is read from > either the SSD or ram. Neither the o/s or pg are smart enough to try > and push all the buffering over the spinning disk so you are going to > see some anomalies coming from the reading patterns of the test -- you > are mainly measuring the %iops that are getting send to data vs index. Not sure what you mean. Could you describe that a bit more thoroughly? > I bet if the index and data both were moved to the ssd you'd see no > pronounced spike just as they are when both are on hdd. No, the spike is there. It's not as apparent as with the HDD drives, but it's there. both on the same HDD =3D> spike (img. 2) both on the same SSD =3D> spike two HDDs =3D> no spike (img. 3) two SSDs =3D> no spike data on HDD, index on SSD =3D> no spike data on SSD, index on HDD =3D> spike (img. 1) I've realized I haven't set the random_page_cost for the index tablespace properly, but if that would be the cause it would not affect the "both on the same HDD" case. > For huge, high traffic, mostly read workloads that are not cost bound > on storage, ssd is a no-brainer. Yes, sure. No doubt about that, unless the workload consists mostly of huge seq scans ... Tomas