mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
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.
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
* Written by Peter Eisentraut <peter_e@gmx.net>.
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.253 2005/03/01 20:23:34 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.254 2005/03/04 20:21:06 tgl Exp $
|
||||
*
|
||||
*--------------------------------------------------------------------
|
||||
*/
|
||||
@@ -77,7 +77,6 @@ extern bool Log_disconnections;
|
||||
extern DLLIMPORT bool check_function_bodies;
|
||||
extern int CommitDelay;
|
||||
extern int CommitSiblings;
|
||||
extern int DebugSharedBuffers;
|
||||
extern char *default_tablespace;
|
||||
|
||||
static const char *assign_log_destination(const char *value,
|
||||
@@ -1230,15 +1229,6 @@ static struct config_int ConfigureNamesInt[] =
|
||||
-1, -1, INT_MAX / 1000, NULL, NULL
|
||||
},
|
||||
|
||||
{
|
||||
{"debug_shared_buffers", PGC_POSTMASTER, STATS_MONITORING,
|
||||
gettext_noop("Interval to report shared buffer status in seconds"),
|
||||
NULL
|
||||
},
|
||||
&DebugSharedBuffers,
|
||||
0, 0, 600, NULL, NULL
|
||||
},
|
||||
|
||||
{
|
||||
{"bgwriter_delay", PGC_SIGHUP, RESOURCES,
|
||||
gettext_noop("Background writer sleep time between rounds in milliseconds"),
|
||||
@@ -1249,21 +1239,21 @@ static struct config_int ConfigureNamesInt[] =
|
||||
},
|
||||
|
||||
{
|
||||
{"bgwriter_percent", PGC_SIGHUP, RESOURCES,
|
||||
gettext_noop("Background writer percentage of dirty buffers to flush per round"),
|
||||
{"bgwriter_lru_maxpages", PGC_SIGHUP, RESOURCES,
|
||||
gettext_noop("Background writer maximum number of all pages to flush per round"),
|
||||
NULL
|
||||
},
|
||||
&BgWriterPercent,
|
||||
1, 0, 100, NULL, NULL
|
||||
&bgwriter_lru_maxpages,
|
||||
5, 0, 1000, NULL, NULL
|
||||
},
|
||||
|
||||
{
|
||||
{"bgwriter_maxpages", PGC_SIGHUP, RESOURCES,
|
||||
gettext_noop("Background writer maximum number of pages to flush per round"),
|
||||
{"bgwriter_all_maxpages", PGC_SIGHUP, RESOURCES,
|
||||
gettext_noop("Background writer maximum number of LRU pages to flush per round"),
|
||||
NULL
|
||||
},
|
||||
&BgWriterMaxPages,
|
||||
100, 0, 1000, NULL, NULL
|
||||
&bgwriter_all_maxpages,
|
||||
5, 0, 1000, NULL, NULL
|
||||
},
|
||||
|
||||
{
|
||||
@@ -1394,6 +1384,24 @@ static struct config_real ConfigureNamesReal[] =
|
||||
MAX_GEQO_SELECTION_BIAS, NULL, NULL
|
||||
},
|
||||
|
||||
{
|
||||
{"bgwriter_lru_percent", PGC_SIGHUP, RESOURCES,
|
||||
gettext_noop("Background writer percentage of LRU buffers to flush per round"),
|
||||
NULL
|
||||
},
|
||||
&bgwriter_lru_percent,
|
||||
1.0, 0.0, 100.0, NULL, NULL
|
||||
},
|
||||
|
||||
{
|
||||
{"bgwriter_all_percent", PGC_SIGHUP, RESOURCES,
|
||||
gettext_noop("Background writer percentage of all buffers to flush per round"),
|
||||
NULL
|
||||
},
|
||||
&bgwriter_all_percent,
|
||||
0.333, 0.0, 100.0, NULL, NULL
|
||||
},
|
||||
|
||||
{
|
||||
{"seed", PGC_USERSET, UNGROUPED,
|
||||
gettext_noop("Sets the seed for random-number generation."),
|
||||
|
||||
@@ -99,8 +99,10 @@
|
||||
# - Background writer -
|
||||
|
||||
#bgwriter_delay = 200 # 10-10000 milliseconds between rounds
|
||||
#bgwriter_percent = 1 # 0-100% of dirty buffers in each round
|
||||
#bgwriter_maxpages = 100 # 0-1000 buffers max per round
|
||||
#bgwriter_lru_percent = 1.0 # 0-100% of LRU buffers scanned in each round
|
||||
#bgwriter_lru_maxpages = 5 # 0-1000 buffers max written per round
|
||||
#bgwriter_all_percent = 0.333 # 0-100% of all buffers scanned in each round
|
||||
#bgwriter_all_maxpages = 5 # 0-1000 buffers max written per round
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/resowner/resowner.c,v 1.9 2004/12/31 22:02:50 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/resowner/resowner.c,v 1.10 2005/03/04 20:21:06 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -200,12 +200,7 @@ ResourceOwnerReleaseInternal(ResourceOwner owner,
|
||||
* that would indicate failure to clean up the executor correctly ---
|
||||
* so issue warnings. In the abort case, just clean up quietly.
|
||||
*
|
||||
* XXX this is fairly inefficient due to multiple BufMgrLock
|
||||
* grabs if there are lots of buffers to be released, but we
|
||||
* don't expect many (indeed none in the success case) so it's
|
||||
* probably not worth optimizing.
|
||||
*
|
||||
* We are however careful to release back-to-front, so as to
|
||||
* We are careful to do the releasing back-to-front, so as to
|
||||
* avoid O(N^2) behavior in ResourceOwnerForgetBuffer().
|
||||
*/
|
||||
while (owner->nbuffers > 0)
|
||||
|
||||
Reference in New Issue
Block a user