[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pgsql-performance
Subject:    Re: [PERFORM] startup caching suggestions
From:       "Bryan Murphy" <bryan.murphy () gmail ! com>
Date:       2007-06-25 22:20:17
Message-ID: bd8531800706251520t5bdb04ddse7471afe03759796 () mail ! gmail ! com
[Download RAW message or body]

No, but I was just informed of that trick earlier and intend to try it
soon.  Sometimes, the solution is so simple it's TOO obvious... :)

Bryan

On 6/25/07, Oleg Bartunov <oleg@sai.msu.su> wrote:
>
> On Mon, 25 Jun 2007, Bryan Murphy wrote:
>
> > 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.
>
> Bryan, did you try 'dd if=/path/to/your/table of=/dev/null' trick ?
> It will very fast read you data into kernel's buffers.
>
> >
> > 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
> >
>
>         Regards,
>                 Oleg
> _____________________________________________________________
> Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru),
> Sternberg Astronomical Institute, Moscow University, Russia
> Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
> phone: +007(495)939-16-83, +007(495)939-23-83
>

[Attachment #3 (text/html)]

No, but I was just informed of that trick earlier and intend to try it soon.&nbsp; \
Sometimes, the solution is so simple it&#39;s TOO obvious... \
:)<br><br>Bryan<br><br><div><span class="gmail_quote">On 6/25/07, <b \
class="gmail_sendername"> Oleg Bartunov</b> &lt;<a \
href="mailto:oleg@sai.msu.su">oleg@sai.msu.su</a>&gt; wrote:</span><blockquote \
class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt \
0pt 0.8ex; padding-left: 1ex;"> On Mon, 25 Jun 2007, Bryan Murphy wrote:<br><br>&gt; \
We have a search facility in our database that uses full text indexing to<br>&gt; \
search about 300,000 records spread across 2 tables.&nbsp;&nbsp;Nothing fancy \
there.<br>&gt;<br> &gt; The problem is, whenever we restart the database (system \
crash, lost<br>&gt; connectivity to SAN, upgrade, configuration change, etc.) our \
data is not<br>&gt; cached and query performance is really sketchy the first five to \
ten minutes <br>&gt; or so after the restart.&nbsp;&nbsp;This is particularly \
problematic because the only<br>&gt; way the data gets cached in memory is if \
somebody actively searches for it,<br>&gt; and the first few people who visit our \
site after a restart are pretty much <br>&gt; screwed.<br>&gt;<br>&gt; I&#39;d like \
to know what are the recommended strategies for dealing with this<br>&gt; \
problem.&nbsp;&nbsp;We need our search queries to be near instantaneous, and we \
just<br>&gt; can&#39;t afford the startup penalty. <br><br>Bryan, did you try &#39;dd \
if=/path/to/your/table of=/dev/null&#39; trick ?<br>It will very fast read you data \
into kernel&#39;s buffers.<br><br>&gt;<br>&gt; I&#39;m also concerned that Postgres \
may not be pulling data off the SAN as <br>&gt; efficiently as theory \
dictates.&nbsp;&nbsp;What&#39;s the best way I can diagnose if the<br>&gt; SAN is \
performing up to spec?&nbsp;&nbsp;I&#39;ve been using iostat, and some of what \
I&#39;m<br>&gt; seeing concerns me.&nbsp;&nbsp;Here&#39;s a typical iostat output \
(iostat -m -d 1): <br>&gt;<br>&gt; \
Device:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tps&nbs \
p;&nbsp;&nbsp;&nbsp;MB_read/s&nbsp;&nbsp;&nbsp;&nbsp;MB_wrtn/s&nbsp;&nbsp;&nbsp;&nbsp;MB_read&nbsp;&nbsp;&nbsp;&nbsp;MB_wrtn<br>&gt; \
sda&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
0.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
0.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
0.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0<br>&gt; \
sdb&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
102.97&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
2.03&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.00 \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0<br>&gt; \
sdc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
0.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
0.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
0.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0<br>&gt; \
sdd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
0.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
0.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
0.00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0<br>&gt;<br>&gt; \
sda is the os partitionn (local), sdb is the primary database partion (SAN), <br>&gt; \
sdc is the log file partition (SAN), and sdd is used only for backups<br>&gt; \
(SAN).&nbsp;&nbsp;I very rarely seen sdb MB_read/s much above 2, and most of the \
time<br>&gt; it hovers around 1 or lower.&nbsp;&nbsp;This seems awfully goddamn slow \
to me, but <br>&gt; maybe I just don&#39;t fully understand what iostat is telling \
me.&nbsp;&nbsp;I&#39;ve seen<br>&gt; sdc writes get as high as 10 during a database \
restore.<br>&gt;<br>&gt; A few bits of information about our setup:<br>&gt; <br>&gt; \
Debian Linux 2.6.18-4-amd64 (stable)<br>&gt; 4x Intel(R) Xeon(R) CPU 5110 @ 1.60GHz \
(100% dedicated to database)<br>&gt; RAID 1+0 iSCSI partitions over Gig/E MTU 9000 \
(99% dedicated to database)<br>&gt; 8GB RAM<br> &gt; Postgres v8.1.9<br>&gt;<br>&gt; \
The database is only about 4GB in size and the key tables total about 700MB.<br>&gt; \
Primary keys are CHAR(32) GUIDs<br>&gt;<br>&gt; Thanks,<br>&gt; \
Bryan<br>&gt;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Regards, \
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;Oleg<br>_____________________________________________________________<br>Oleg \
Bartunov, Research Scientist, Head of AstroNet (<a \
href="http://www.astronet.ru">www.astronet.ru</a>),<br>Sternberg Astronomical \
Institute, Moscow University, Russia <br>Internet: <a \
href="mailto:oleg@sai.msu.su">oleg@sai.msu.su</a>, <a \
href="http://www.sai.msu.su/~megera/">http://www.sai.msu.su/~megera/</a><br>phone: \
+007(495)939-16-83, +007(495)939-23-83<br></blockquote></div><br>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic