I ran some DBT-2 tests to compare different bgwriter strategies:

http://community.enterprisedb.com/bgwriter/

imola-336 was run with minimal bgwriter settings, so that most writes are done by backends. imola-337 was patched with an implementation of Tom's bgwriter idea, trying to aggressively keep all pages with usage_count=0 clean. Imola-340 was with a patch along the lines of Itagaki's original patch, ensuring that there's as many clean pages in front of the clock head as were consumed by backends since last bgwriter iteration.

All test runs were also patched to count the # of buffer allocations, and # of buffer flushes performed by bgwriter and backends. Here's those results (I hope the intendation gets through properly):

                        imola-336       imola-337       imola-340
writes by checkpoint      38302           30410           39529
writes by bgwriter       350113         2205782         1418672
writes by backends      1834333          265755          787633
writes total            2222748         2501947         2245834
allocations             2683170         2657896         2699974

It looks like Tom's idea is not a winner; it leads to more writes than necessary. But the OS caches the writes, so let's look at the actual I/O performed to be sure, from iostat:

http://community.enterprisedb.com/bgwriter/writes-336-337-340.jpg

The graph shows that on imola-337, there was indeed more write traffic than on the other two test runs.

On imola-340, there's still a significant amount of backend writes. I'm still not sure what we should be aiming at. Is 0 backend writes our goal?

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

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

              http://archives.postgresql.org

Reply via email to