On Wed, Dec 21, 2016 at 10:37 PM, Stas Kelvich <s.kelv...@postgrespro.ru> wrote: > On 21 Dec 2016, at 19:56, Michael Paquier <michael.paqu...@gmail.com> wrote: >> That's indeed way simpler than before. Have you as well looked at the >> most simple approach discussed? That would be just roughly replacing >> the pg_fsync() calls currently in RecreateTwoPhaseFile() by a save >> into a list as you are doing, then issue them all checkpoint.Even for > >> 2PC files that are created and then removed before the next >> checkpoint, those will likely be in system cache. > > Yes, I tried that as well. But in such approach another bottleneck arises > — > new file creation isn’t very cheap operation itself. Dual xeon with 100 > backends > quickly hit that, and OS routines about file creation occupies first places > in perf top. Probably that depends on filesystem (I used ext4), but avoiding > file creation when it isn’t necessary seems like cleaner approach. > On the other hand it is possible to skip file creation by reusing files, > for example > naming them by dummy PGPROC offset, but that would require some changes > to places that right now looks only at filenames.
Interesting. Thanks for looking at it. Your latest approach looks more promising based on that then. >> And this saves lookups at the WAL segments >> still present in pg_xlog, making the operation at checkpoint much >> faster with many 2PC files to process. > > ISTM your reasoning about filesystem cache applies here as well, but just > without spending time on file creation. True. The more spread the checkpoints and 2PC files, the more risk to require access to disk. Memory's cheap anyway. What was the system memory? How many checkpoints did you trigger for how many 2PC files created? Perhaps it would be a good idea to look for the 2PC files from WAL records in a specific order. Did you try to use dlist_push_head instead of dlist_push_tail? This may make a difference on systems where WAL segments don't fit in system cache as the latest files generated would be looked at first for 2PC data. -- Michael -- Sent via pgsql-hackers mailing list (email@example.com) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers