From: Andres Freund <andres@2ndquadrant.com>
To: Valentine Gogichashvili <valgog@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #7494: WAL replay speed depends heavily on the shared_buffers size
Date: Fri, 17 Aug 2012 13:07:16 +0200
Message-ID: <201208171307.16342.andres@2ndquadrant.com> (raw)
In-Reply-To: <CAP93muWv0SAFshj7FE1cJyX3mgXYi0BoL-Cw=NCgkAb3ZK7-jQ@mail.gmail.com>
References: <E1T1aYk-0007Jk-3h@wrigleys.postgresql.org>
<201208170931.43034.andres@2ndquadrant.com>
<CAP93muWv0SAFshj7FE1cJyX3mgXYi0BoL-Cw=NCgkAb3ZK7-jQ@mail.gmail.com>
On Friday, August 17, 2012 12:51:44 PM Valentine Gogichashvili wrote:
> Hello Andreas,
>
> here are the results of perf profiling:
> https://gist.github.com/3b8cb0c15661da439632
> Also attached the files to that mail.
>
> For a problematic case of big shared_buffers:
>
> # Events: 320K cycles
> #
> # Overhead Command Shared Object Symbol
> # ........ ........ ................. ..................................
> #
> 98.70% postgres postgres [.] DropRelFileNodeBuffers
> 0.18% postgres postgres [.] RecordIsValid
> 0.11% postgres [kernel.kallsyms] [k] native_write_msr_safe
> 0.07% postgres [kernel.kallsyms] [k] dyntick_save_progress_counter
> 0.06% postgres [kernel.kallsyms] [k] scheduler_tick
> 0.03% postgres [kernel.kallsyms] [k] _spin_lock
> 0.03% postgres [kernel.kallsyms] [k] __do_softirq
> 0.03% postgres [kernel.kallsyms] [k] rcu_process_callbacks
> 0.03% postgres postgres [.] hash_search_with_hash_value
> 0.03% postgres [kernel.kallsyms] [k] native_read_msr_safe
> 0.02% postgres libc-2.12.so [.] memcpy
> 0.02% postgres [kernel.kallsyms] [k] rcu_process_gp_end
> 0.02% postgres [kernel.kallsyms] [k] apic_timer_interrupt
> 0.02% postgres [kernel.kallsyms] [k] run_timer_softirq
> 0.02% postgres [kernel.kallsyms] [k] system_call
Ok, that explains it. Youre frequently dropping/truncating tables? That
currently requires walking through shared buffers and loosing all buffered
pages related to that table. That obviously scales linearly with shared
buffers and is particularly expensive on multi socket machines.
Unless youre running 9.3 that will even lock each single page which is a
relatively expensive and slow operation. Depending on how adventurous you are
you could try backporting e8d029a30b5a5fb74b848a8697b1dfa3f66d9697 and see how
big the benefits are for you.
Greetings,
Andres
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: andres@2ndquadrant.com, valgog@gmail.com
Subject: Re: BUG #7494: WAL replay speed depends heavily on the shared_buffers size
In-Reply-To: <201208171307.16342.andres@2ndquadrant.com>
References: <E1T1aYk-0007Jk-3h@wrigleys.postgresql.org> <201208170931.43034.andres@2ndquadrant.com> <CAP93muWv0SAFshj7FE1cJyX3mgXYi0BoL-Cw=NCgkAb3ZK7-jQ@mail.gmail.com> <201208171307.16342.andres@2ndquadrant.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox