Re: XLogInsert scaling, revisited
Andres Freund <andres@2ndquadrant.com>
From: Andres Freund <andres@2ndquadrant.com>
To: Heikki Linnakangas <hlinnakangas@vmware.com>
Cc: Jeff Janes <jeff.janes@gmail.com>,
Alvaro Herrera <alvherre@2ndquadrant.com>,
PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2013-07-02T17:15:23Z
Lists: pgsql-hackers
On 2013-07-02 19:48:40 +0300, Heikki Linnakangas wrote: > >If so, why isn't it sufficient to > >initialize it in ReserveXLogInsertLocation? > > It would be, but then ReserveXLogInsertLocation would need to hold the > slot's spinlock at the same time with insertpos_lck, so that it could > atomically read the current CurrBytePos value and copy it to > xlogInsertingAt. It's important to keep ReserveXLogInsertLocation() as > lightweight as possible, to maximize concurrency. If you make it so that you always acquire the slot's spinlock first and insertpos_lck after, the scalability shouldn't be any different from now? Both the duration during which insertpos_lck is held and the overall amount of atomic ops should be the same? Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services