From: Andres Freund <andres@anarazel.de>
To: Merlin Moncure <mmoncure@gmail.com>
Cc: Craig James <cjames@emolecules.com>
Cc: Joshua D. Drake <jd@commandprompt.com>
Cc: Graeme B. Bell <graeme.bell@nibio.no>
Cc: postgres performance list <pgsql-performance@postgresql.org>
Subject: Re: Hmmm... why does CPU-intensive pl/pgsql code parallelise so badly when queries parallelise fine? Anyone else seen this?
Date: Wed, 8 Jul 2015 22:27:33 +0200
Message-ID: <20150708202733.GS10242@alap3.anarazel.de> (raw)
In-Reply-To: <CAHyXU0wO_WMzrbdcdtWwpk-78j_4P-M-Kr0xOyJVg1K15dQNAQ@mail.gmail.com>
References: <6E55113B-FA05-433C-9B21-623F798EE935@skogoglandskap.no>
<CAFwQ8rcEOiGJ79WtoO=uTX33ZhKVUWG9v8iO14TR+AoT_wd1og@mail.gmail.com>
<559CB5BF.2080509@commandprompt.com>
<CAFwQ8rdWcZwUxgQDySOzFAqHJPm6=DVH+bp0XMJzmADF1GVmPw@mail.gmail.com>
<CAHyXU0wO_WMzrbdcdtWwpk-78j_4P-M-Kr0xOyJVg1K15dQNAQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>
On 2015-07-08 13:46:53 -0500, Merlin Moncure wrote:
> On Wed, Jul 8, 2015 at 12:48 PM, Craig James <cjames@emolecules.com> wrote:
> > On Tue, Jul 7, 2015 at 10:31 PM, Joshua D. Drake <jd@commandprompt.com>
> >> Using Apache Fast-CGI, you are going to fork a process for each instance
> >> of the function being executed and that in turn will use all CPUs up to the
> >> max available resource.
> >>
> >> With PostgreSQL, that isn't going to happen unless you are running (at
> >> least) 8 functions across 8 connections.
> >
> >
> > Well, right, which is why I mentioned "even with dozens of clients."
> > Shouldn't that scale to at least all of the CPUs in use if the function is
> > CPU intensive (which it is)?
>
> only in the absence of inter-process locking and cache line bouncing.
And addititionally memory bandwidth (shared between everything, even in
the numa case), cross socket/bus bandwidth (absolutely performance
critical in multi-socket configurations), cache capacity (shared between
cores, and sometimes even sockets!).
--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
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 using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: andres@anarazel.de, mmoncure@gmail.com, cjames@emolecules.com, jd@commandprompt.com, graeme.bell@nibio.no
Subject: Re: Hmmm... why does CPU-intensive pl/pgsql code parallelise so badly when queries parallelise fine? Anyone else seen this?
In-Reply-To: <20150708202733.GS10242@alap3.anarazel.de>
* 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