Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 7C7059FBA85 for ; Mon, 25 Jun 2007 17:18:48 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 05020-05 for ; Mon, 25 Jun 2007 17:18:45 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.182]) by postgresql.org (Postfix) with ESMTP id E352D9FB9CB for ; Mon, 25 Jun 2007 17:18:44 -0300 (ADT) Received: by py-out-1112.google.com with SMTP id a73so1598975pye for ; Mon, 25 Jun 2007 13:18:44 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; b=EUcvM48r6Oj7RibpO8J2sHkdCobPR30G2TVTVgrxiNEiecwADS2S9nWtxNmIihqQPbcnp6psB+gpajH5+lr+/96hGNRzS0yTuGuiguruC3Yl1fGbJ2kerwDSok4czJmD+22HZl89yVXyFOg8Q70YNiTL3xVnr19fLPX3L7Fu7m8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type; b=aGjJFbDtBgmOrcEu1a0zJHAXgcBIc3O/mbeOD3qY0xy4DMpjKTwbdBdoVKMdl9GUN5HFE8r8pmeLYzsIkWtxb1yy20/klfgpcWYzNXJOD+c8stPPACRJ4HBDcNwSJEP/4SsTIrfshduSTWvV1OnThyHPiCvB18cgWMzkM34M6ug= Received: by 10.65.163.8 with SMTP id q8mr4275017qbo.1182802723867; Mon, 25 Jun 2007 13:18:43 -0700 (PDT) Received: by 10.64.209.19 with HTTP; Mon, 25 Jun 2007 13:18:43 -0700 (PDT) Message-ID: Date: Mon, 25 Jun 2007 15:18:43 -0500 From: "Bryan Murphy" To: pgsql-performance@postgresql.org Subject: startup caching suggestions MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_119121_32881738.1182802723814" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/584 X-Sequence-Number: 25617 ------=_Part_119121_32881738.1182802723814 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline We have a search facility in our database that uses full text indexing to search about 300,000 records spread across 2 tables. Nothing fancy there. The problem is, whenever we restart the database (system crash, lost connectivity to SAN, upgrade, configuration change, etc.) our data is not cached and query performance is really sketchy the first five to ten minutes or so after the restart. This is particularly problematic because the only way the data gets cached in memory is if somebody actively searches for it, and the first few people who visit our site after a restart are pretty much screwed. I'd like to know what are the recommended strategies for dealing with this problem. We need our search queries to be near instantaneous, and we just can't afford the startup penalty. I'm also concerned that Postgres may not be pulling data off the SAN as efficiently as theory dictates. What's the best way I can diagnose if the SAN is performing up to spec? I've been using iostat, and some of what I'm seeing concerns me. Here's a typical iostat output (iostat -m -d 1): Device: tps MB_read/s MB_wrtn/s MB_read MB_wrtn sda 0.00 0.00 0.00 0 0 sdb 102.97 2.03 0.00 2 0 sdc 0.00 0.00 0.00 0 0 sdd 0.00 0.00 0.00 0 0 sda is the os partitionn (local), sdb is the primary database partion (SAN), sdc is the log file partition (SAN), and sdd is used only for backups (SAN). I very rarely seen sdb MB_read/s much above 2, and most of the time it hovers around 1 or lower. This seems awfully goddamn slow to me, but maybe I just don't fully understand what iostat is telling me. I've seen sdc writes get as high as 10 during a database restore. A few bits of information about our setup: Debian Linux 2.6.18-4-amd64 (stable) 4x Intel(R) Xeon(R) CPU 5110 @ 1.60GHz (100% dedicated to database) RAID 1+0 iSCSI partitions over Gig/E MTU 9000 (99% dedicated to database) 8GB RAM Postgres v8.1.9 The database is only about 4GB in size and the key tables total about 700MB. Primary keys are CHAR(32) GUIDs Thanks, Bryan ------=_Part_119121_32881738.1182802723814 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline We have a search facility in our database that uses full text indexing to s= earch about 300,000 records spread across 2 tables.  Nothing fancy the= re.

The problem is, whenever we restart the database (system crash, = lost connectivity to SAN, upgrade, configuration change, etc.) our data is = not cached and query performance is really sketchy the first five to ten mi= nutes or so after the restart.  This is particularly problematic becau= se the only way the data gets cached in memory is if somebody actively sear= ches for it, and the first few people who visit our site after a restart ar= e pretty much screwed.

I'd like to know what are the recommended strategies for dealin= g with this problem.  We need our search queries to be near instantane= ous, and we just can't afford the startup penalty.

I'm also= concerned that Postgres may not be pulling data off the SAN as efficiently= as theory dictates.  What's the best way I can diagnose if the SA= N is performing up to spec?  I've been using iostat, and some of w= hat I'm seeing concerns me.  Here's a typical iostat output (i= ostat -m -d 1):

Device:          =   tps    MB_read/s    MB_wrtn/s &nb= sp;  MB_read    MB_wrtn
sda    &= nbsp;          0.00  = ;       0.00     &nb= sp;   0.00          = 0          0
sdb  = ;           102.97 &= nbsp;       2.03     = ;    0.00        &nb= sp; 2          0
sdc           &n= bsp;   0.00         0.00&= nbsp;        0.00    = ;      0       =    0
sdd         =       0.00      &nbs= p;  0.00         0.00 &nb= sp;        0    &nbs= p;     0

sda is the os partitionn (local), sdb i= s the primary database partion (SAN), sdc is the log file partition (SAN), = and sdd is used only for backups (SAN).  I very rarely seen sdb MB_rea= d/s much above 2, and most of the time it hovers around 1 or lower.  T= his seems awfully goddamn slow to me, but maybe I just don't fully unde= rstand what iostat is telling me.  I've seen sdc writes get as hig= h as 10 during a database restore.

A few bits of information about our setup:

Debian Linux 2.6.= 18-4-amd64 (stable)
4x Intel(R) Xeon(R) CPU 5110 @ 1.60GHz (100% dedicat= ed to database)
RAID 1+0 iSCSI partitions over Gig/E MTU 9000 (99% dedicated to database)8GB RAM
Postgres v8.1.9

The database is only about 4GB in size and the key tables total about 7= 00MB.
Primary keys are CHAR(32) GUIDs

Thanks,
Bryan
------=_Part_119121_32881738.1182802723814--