postgresql/src/backend
Andres Freund d72731a704 Lockless StrategyGetBuffer clock sweep hot path.
StrategyGetBuffer() has proven to be a bottleneck in a number of
buffer acquisition heavy workloads. To some degree this has already
been alleviated by 5d7962c6, but it still can be quite a heavy
bottleneck.  The problem is that in unfortunate usage patterns a
single StrategyGetBuffer() call will have to look at a large number of
buffers - in turn making it likely that the process will be put to
sleep while still holding the spinlock.

Replace most of the usage of the buffer_strategy_lock spinlock for the
clock sweep by a atomic nextVictimBuffer variable. That variable,
modulo NBuffers, is the current hand of the clock sweep. The buffer
clock-sweep then only needs to acquire the spinlock after a
wraparound. And even then only in the process that did the wrapping
around. That alleviates nearly all the contention on the relevant
spinlock, although significant contention on the cacheline can still
exist.

Reviewed-By: Robert Haas and Amit Kapila

Discussion: 20141010160020.GG6670@alap3.anarazel.de,
    20141027133218.GA2639@awork2.anarazel.de
2014-12-25 18:26:25 +01:00
..
access Convert the PGPROC->lwWaitLink list into a dlist instead of open coding it. 2014-12-25 17:24:30 +01:00
bootstrap Fix off-by-one loop count in MapArrayTypeName, and get rid of static array. 2014-12-16 15:35:33 -05:00
catalog Revert "Use a bitmask to represent role attributes" 2014-12-23 15:35:49 -03:00
commands Revert "Use a bitmask to represent role attributes" 2014-12-23 15:35:49 -03:00
executor Fix corner case where SELECT FOR UPDATE could return a row twice. 2014-12-11 19:37:36 -05:00
foreign Implement IMPORT FOREIGN SCHEMA. 2014-07-10 15:01:43 -04:00
lib Move rbtree.c from src/backend/utils/misc to src/backend/lib. 2014-12-22 17:52:08 +02:00
libpq Fix poorly worded error message. 2014-12-17 13:14:53 -05:00
main Windows: use GetSystemTimePreciseAsFileTime if available 2014-12-08 23:36:06 +09:00
nodes Remove unused fields from ReindexStmt. 2014-12-24 21:40:47 +09:00
optimizer Improve hash_create's API for selecting simple-binary-key hash functions. 2014-12-18 13:36:36 -05:00
parser Suppress MSVC warning in typeStringToTypeName function. 2014-12-24 12:30:08 +01:00
po Translation updates 2014-12-15 00:25:35 -05:00
port Add a basic atomic ops API abstracting away platform/architecture details. 2014-09-25 23:49:05 +02:00
postmaster Lockless StrategyGetBuffer clock sweep hot path. 2014-12-25 18:26:25 +01:00
regex Fix incorrect search for "x?" style matches in creviterdissect(). 2014-09-23 20:26:14 -04:00
replication Remove duplicate include of slot.h. 2014-12-25 22:47:53 +09:00
rewrite Revert "Use a bitmask to represent role attributes" 2014-12-23 15:35:49 -03:00
snowball Finish adding file version information to installed Windows binaries. 2014-08-18 22:59:53 -04:00
storage Lockless StrategyGetBuffer clock sweep hot path. 2014-12-25 18:26:25 +01:00
tcop get_object_address: separate domain constraints from table constraints 2014-12-23 09:06:44 -03:00
tsearch Cope with more than 64K phrases in a thesaurus dictionary. 2014-11-06 20:52:40 -05:00
utils Add capability to suppress CONTEXT: messages to elog machinery. 2014-12-25 17:24:30 +01:00
.gitignore Add gitignore for mingw/cygwin build outputs 2011-06-09 18:11:47 +02:00
common.mk Remove maintainer-check target, fold into normal build 2013-10-10 20:11:56 -04:00
Makefile Get rid of use of dlltool in Mingw builds. 2014-02-11 12:56:20 -05:00
nls.mk Translation updates 2014-12-15 00:25:35 -05:00