Re: Postgres refusing to use >1 core

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Aren Cambre <aren(at)arencambre(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Postgres refusing to use >1 core
Date: 2011-05-09 21:56:34
Message-ID: BANLkTik3Yrg9O_0Sjxae5=556nROrfq0hg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Mon, May 9, 2011 at 4:50 PM, Aren Cambre <aren(at)arencambre(dot)com> wrote:
>> Are you sure you are really using > 1 connection?  While your test is
>> running, log onto postgres with psql and grab the output of
>> pg_stat_activity a few times.  What do you see?
>
> Thanks. If a connection corresponds to a process, then this suggests I am
> using 1 connection for my main thread, and all the threads it spawns are
> sharing another connection.

Yes. However I can tell you with absolute certainly that postgres
will distribute work across cores. Actually the o/s does it -- each
unique connection spawns a single threaded process on the backend. As
long as your o/s of choice is supports using more than once process at
once, your work will distribute. So, given that, your problem is:

*) your code is actually using only one connection
*) you have contention on the server side (say, a transaction
outstanding that it blocking everyone)
*) you have contention on the client side -- a lock in your code or
inside npgsql
*) your measuring is not correct.

so follow the advice above. we need to see pg_stat_activity, and/or
pg_locks while your test is running (especially take note of pg_lock
records with granted=f)

merlin

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Kevin Grittner 2011-05-09 21:59:02 Re: Postgres refusing to use >1 core
Previous Message Aren Cambre 2011-05-09 21:52:36 Re: Postgres refusing to use >1 core