Skip site navigation (1) Skip section navigation (2)

Re: Read-ahead and parallelism in redo recovery

From: "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>
To: "Decibel!" <decibel(at)decibel(dot)org>
Cc: "Florian Weimer" <fweimer(at)bfk(dot)de>,"Pavan Deolasee" <pavan(dot)deolasee(at)gmail(dot)com>,"PostgreSQL-development Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Read-ahead and parallelism in redo recovery
Date: 2008-02-29 20:43:51
Message-ID: 47C86E87.50106@enterprisedb.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Decibel! wrote:
> On Feb 29, 2008, at 8:10 AM, Florian Weimer wrote:
>> In the end, I wouldn't be surprised if for most loads, cache warming
>> effects dominated recovery times, at least when the machine is not
>> starved on RAM.
> 
> 
> Uh... that's exactly what all the synchronous reads are doing... warming 
> the cache. And synchronous reads are only fast if the system understands 
> what's going on and reads a good chunk of data in at once. I don't know 
> that that happens.
> 
> Perhaps a good short-term measure would be to have recovery allocate a 
> 16M buffer and read in entire xlog files at once.

The problem isn't reading the WAL. The OS prefetches that just fine.

The problem is the random reads, when we read in the blocks mentioned in 
the WAL records, to replay the changes to them. The OS has no way of 
guessing and prefetching those blocks, and we read them synchronously, 
one block at a time, no matter how big your RAID array is.

I used to think it's a big problem, but I believe the full-page-write 
optimization in 8.3 made it much less so. Especially with the smoothed 
checkpoints: as checkpoints have less impact on response times, you can 
shorten checkpoint interval, which helps to keep the recovery time 
reasonable.

It'd still be nice to do the prefetching; I'm sure there's still 
workloads where it would be a big benefit. But as Tom pointed out, we 
shouldn't invent something new just for recovery. I think we should look 
at doing prefetching for index accesses etc. first, and once we have the 
infrastructure in place and tested, we can consider use it for recovery 
as well.

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2008-02-29 20:47:15
Subject: Re: Read-ahead and parallelism in redo recovery
Previous:From: Decibel!Date: 2008-02-29 19:59:30
Subject: Re: Read-ahead and parallelism in redo recovery

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group