pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: James Mansion <james@mansionfamily.plus.com>
To: Mark Mielke <mark@mark.mielke.cc>
Cc: matthew@flymine.org
Cc: pgsql-performance@postgresql.org
Subject: Re: RAID arrays and performance
Date: Tue, 04 Dec 2007 23:58:31 +0000
Message-ID: <4755E9A7.7060906@mansionfamily.plus.com> (raw)
In-Reply-To: <4755D15F.7080400@mark.mielke.cc>
References: <Pine.LNX.4.58.0712041213490.3731@aragorn.flymine.org>
	<87lk8aiqf3.fsf@oxford.xeocode.com>
	<Pine.LNX.4.58.0712041247540.3731@aragorn.flymine.org>
	<475559F4.7060104@mark.mielke.cc>
	<Pine.LNX.4.58.0712041349380.3731@aragorn.flymine.org>
	<4755648C.90905@mark.mielke.cc>
	<87fxyiik94.fsf@oxford.xeocode.com>
	<Pine.LNX.4.58.0712041522320.3731@aragorn.flymine.org>
	<47557519.6090506@mark.mielke.cc>
	<47557872.1000105@mansionfamily.plus.com>
	<47557B12.5040809@mark.mielke.cc>
	<4755B51E.5040503@mansionfamily.plus.com>
	<4755D15F.7080400@mark.mielke.cc>

Mark Mielke wrote:
> PostgreSQL or the kernel should already have the hottest pages in 
> memory, so the value of doing async I/O is very likely the cooler 
> pages that are unique to the query. We don't know what the cooler 
> pages are until we follow three tree down.
>
I'm assuming that at the time we start to search the index, we have some 
idea of value or values that
we are looking for.  Or, as you say, we are applying a function to 'all 
of it'.

Think of a 'between' query.  The subset of the index that can be a match 
can be bounded by the leaf
pages that contain the end point(s).  Similarly if we have a merge with 
a sorted intermediate set from
a prior step then we also have bounds on the values.

I'm not convinced that your assertion that the index leaf pages must 
necessarily be processed in-order
is true - it depends what sort of operation is under way.  I am assuming 
that we try hard to keep
interior index nodes and data in meory and that having identified the 
subset of these that we want, we
can immediately infer the set of leaves that are potentially of interest.
> The difference between preload and handling async I/O in terms of 
> performance is debatable. Greg reports that async I/O on Linux sucks, 
> but posix_fadvise*() has substantial benefits. posix_fadvise*() is 
> preload not async I/O (he also reported that async I/O on Solaris 
> seems to work well). Being able to do work as the first page is 
> available is a micro-optimization as far as I am concerned at this 
> point (one that may not yet work on Linux), as the real benefit comes 
> from utilizing all 12 disks in Matthew's case, not from guaranteeing 
> that data is processed as soon as possible.
>
I see it as part of the same problem.  You can partition the data across 
all the disks and run queries in parallel
against the partitions, or you can lay out the data in the RAID array in 
which case the optimiser has very little idea
how the data will map to physical data layout - so its best bet is to 
let the systems that DO know decide the
access strategy.  And those systems can only do that if you give them a 
lot of requests that CAN be reordered,
so they can choose a good ordering.

> Micro-optimization.
>
Well, you like to assert this - but why?  If a concern is the latency 
(and my experience suggests that latency is the
biggest issue in practice, not throughput per se) then overlapping 
processing while waiting for 'distant' data is
important - and we don't have any information about the physical layout 
of the data that allows us to assert that
forward access pre-read of data from a file is the right strategy for 
accessing it as fast as possible - we have to
allow the OS (and to an increasing extent the disks) to manage the 
elevator IO to best effect.  Its clear that the
speed of streaming read and write of modern disks is really high 
compared to that of random access, so anything
we can do to help the disks run in that mode is pretty worthwhile even 
if the physical streaming doesn't match
any obvious logical ordering of the OS files or logical data pages 
within them.  If you have a function to apply to
a set of data elements and the elements are independant, then requiring 
that the function is applied in an order
rather than conceptually in parallel is going to put a lot of constraint 
on how the hardware can optimise it.

Clearly a hint to preload is better than nothing.  But it seems to me 
that the worst case is that we wait for
the slowest page to load and then start processing hoping that the rest 
of the data stays in the buffer cache
and is 'instant', while AIO and evaluate-when-ready means that process 
is still bound by the slowest
data to arrive, but at that point there is little processing still to 
do, and the already-processed buffers can be
reused earlier.  In the case where there is significant presure on the 
buffer cache, this can be significant.

Of course, a couple of decades bullying Sybase systems on Sun Enterprise 
boxes may have left me
somewhat jaundiced - but Sybase can at least parallelise things.  
Sometimes.  When it does, its quite
a big win.

> In your hand waving, you have assumed that PostgreSQL B-Tree index 
> might need to be replaced? :-)
>
Sure, if the intent is to make the system thread-hot or AIO-hot, then 
the change is potentially very
invasive.  The strategy to evaluate queries based on parallel execution 
and async IO is not necessarily
very like a strategy where you delegate to the OS buffer cache.

I'm not too bothered for the urpose of this discussion whether the way 
that postgres currently
navigates indexes is amenable to this.  This is bikeshed land, right?

I think it is foolish to disregard strategies that will allow 
overlapping IO and processing - and we want to
keep disks reading and writing rather than seeking.  To me that suggests 
AIO and disk-native queuing
are quite a big deal.  And parallel evaluation will be too as the number 
of cores goes up and there is
an expectation that this should reduce latency of individual query, not 
just allow throughput with lots
of concurrent demand.




view thread (39+ messages)  latest in thread

Message-ID: <4755E9A7.7060906@mansionfamily.plus.com>
Permalink:  ../4755E9A7.7060906@mansionfamily.plus.com/
Also on:    postgresql.org/message-id/4755E9A7.7060906@mansionfamily.plus.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: james@mansionfamily.plus.com, mark@mark.mielke.cc, matthew@flymine.org
  Subject: Re: RAID arrays and performance
  In-Reply-To: <4755E9A7.7060906@mansionfamily.plus.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox