From 5d5087363d7cdbd00fc432a1216e83a00f7139bd Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 4 Mar 2005 20:21:07 +0000 Subject: Replace the BufMgrLock with separate locks on the lookup hashtable and the freelist, plus per-buffer spinlocks that protect access to individual shared buffer headers. This requires abandoning a global freelist (since the freelist is a global contention point), which shoots down ARC and 2Q as well as plain LRU management. Adopt a clock sweep algorithm instead. Preliminary results show substantial improvement in multi-backend situations. --- doc/src/sgml/runtime.sgml | 107 ++++++++++++++++++++++++++++++---------------- 1 file changed, 71 insertions(+), 36 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml index 63442bb38b8..5ba8b9b2b3c 100644 --- a/doc/src/sgml/runtime.sgml +++ b/doc/src/sgml/runtime.sgml @@ -1,5 +1,5 @@ @@ -1379,9 +1379,7 @@ SET ENABLE_SEQSCAN TO OFF; Specifies the delay between activity rounds for the background writer. In each round the writer issues writes for some number of dirty buffers (controllable by the - following parameters). The selected buffers will always be - the least recently used ones among the currently dirty - buffers. It then sleeps for bgwriter_delay + following parameters). It then sleeps for bgwriter_delay milliseconds, and repeats. The default value is 200. Note that on many systems, the effective resolution of sleep delays is 10 milliseconds; setting bgwriter_delay @@ -1393,32 +1391,77 @@ SET ENABLE_SEQSCAN TO OFF; - - bgwriter_percent (integer) + + bgwriter_lru_percent (floating point) - bgwriter_percent configuration parameter + bgwriter_lru_percent configuration parameter - In each round, no more than this percentage of the currently - dirty buffers will be written (rounding up any fraction to - the next whole number of buffers). The default value is - 1. This option can only be set at server start or in the + To reduce the probability that server processes will need to issue + their own writes, the background writer tries to write buffers that + are likely to be recycled soon. In each round, it examines up to + bgwriter_lru_percent of the buffers that are nearest to + being recycled, and writes any that are dirty. + The default value is 1.0 (this is a percentage of the total number + of shared buffers). + This option can only be set at server start or in the + postgresql.conf file. + + + + + + bgwriter_lru_maxpages (integer) + + bgwriter_lru_maxpages configuration parameter + + + + In each round, no more than this many buffers will be written + as a result of scanning soon-to-be-recycled buffers. + The default value is 5. + This option can only be set at server start or in the + postgresql.conf file. + + + + + + bgwriter_all_percent (floating point) + + bgwriter_all_percent configuration parameter + + + + To reduce the amount of work that will be needed at checkpoint time, + the background writer also does a circular scan through the entire + buffer pool, writing buffers that are found to be dirty. + In each round, it examines up to + bgwriter_all_percent of the buffers for this purpose. + The default value is 0.333 (this is a percentage of the total number + of shared buffers). With the default bgwriter_delay + setting, this will allow the entire shared buffer pool to be scanned + about once per minute. + This option can only be set at server start or in the postgresql.conf file. - - bgwriter_maxpages (integer) + + bgwriter_all_maxpages (integer) - bgwriter_maxpages configuration parameter + bgwriter_all_maxpages configuration parameter - In each round, no more than this many dirty buffers will be - written. The default value is 100. This option can only be - set at server start or in the + In each round, no more than this many buffers will be written + as a result of the scan of the entire buffer pool. (If this + limit is reached, the scan stops, and resumes at the next buffer + during the next round.) + The default value is 5. + This option can only be set at server start or in the postgresql.conf file. @@ -1426,13 +1469,19 @@ SET ENABLE_SEQSCAN TO OFF; - Smaller values of bgwriter_percent and - bgwriter_maxpages reduce the extra I/O load + Smaller values of bgwriter_all_percent and + bgwriter_all_maxpages reduce the extra I/O load caused by the background writer, but leave more work to be done at checkpoint time. To reduce load spikes at checkpoints, - increase the values. To disable background writing entirely, - set bgwriter_percent and/or - bgwriter_maxpages to zero. + increase these two values. + Similarly, smaller values of bgwriter_lru_percent and + bgwriter_lru_maxpages reduce the extra I/O load + caused by the background writer, but make it more likely that server + processes will have to issue writes for themselves, delaying interactive + queries. + To disable background writing entirely, + set both maxpages values and/or both + percent values to zero. @@ -3866,20 +3915,6 @@ plruby.bar = true # generates error, unknown class name - - debug_shared_buffers (integer) - - debug_shared_buffers configuration parameter - - - - Number of seconds between ARC reports. - If set greater than zero, emit ARC statistics to the log every so many - seconds. Zero (the default) disables reporting. - - - - pre_auth_delay (integer) -- cgit v1.2.3