From: | Jan Wieck <JanWieck(at)Yahoo(dot)com> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Background writer process |
Date: | 2003-11-13 21:35:31 |
Message-ID: | 3FB3F923.4000006@Yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
The attached diff is another attempt for distributing the write IO.
It is a separate background process much like the checkpointer. It's
purpose is to keep the number of dirty blocks in the buffer cache at a
reasonable level and try that the buffers returned by the strategy for
replacement are allways clean. This current shot does it this way:
- get a list of all dirty blocks in strategy replacement order
- flush n percent of that list or a maximum of m buffers
(whatever is smaller)
- issue a sync()
- sleep for x milliseconds
If there is nothing to do, it will sleep for 10 seconds before checking
again at all. It acquires a checkpoint lock during the flush, so it will
yield for a real checkpoint.
For sure the sync() needs to be replaced by the discussed fsync() of
recently written files. And I think the algorithm how much and how often
to flush can be significantly improved. But after all, this does not
change the real checkpointing at all, and the general framework having a
separate process is what we probably want.
Jan
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #
Attachment | Content-Type | Size |
---|---|---|
bgwriter.v1.diff | text/plain | 25.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Christopher Browne | 2003-11-13 21:41:42 | Re: cvs head? initdb? |
Previous Message | Derek Morr | 2003-11-13 21:04:23 | Re: 7.4RC2 regression failur and not running stats collector process |