Re: high user cpu, massive SELECTs, no io waiting problem

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Ivan Voras <ivoras(at)freebsd(dot)org>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: high user cpu, massive SELECTs, no io waiting problem
Date: 2011-02-16 01:19:16
Message-ID: AANLkTinM9tWax8u_E-GPbTQZrJcTs1kKE6hAMoEKc73=@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Tue, Feb 15, 2011 at 6:00 PM, Ivan Voras <ivoras(at)freebsd(dot)org> wrote:
> There is an old problem (which I've encountered so I'm replying but it may
> or may not be in your case) in which PostgreSQL starts behaving badly even
> for SELECT queries if the number of simultaneous queries exceeds the number
> of logical CPUs.

Note that this is a problem for most RDBMS engines, not just
postgresql. The performance drop off isn't too bad, but the total
number of connections times even a doubling of response time results
in a slow server.

> To test this, I'd recommend setting up a utility like
> pgpool-II (http://pgpool.projects.postgresql.org/) in front of the database
> to try and limit the number of active connections to nearly 64 (maybe you
> can have good results with 80 or 100).

pgpool IS the answer for most of these issues.

> You might also experiment with pgsql.max_links setting of PHP but IIRC PHP
> will just refuse more connections than that instead of waiting for them (but
> maybe your application can spin-wait for them, possibly while also using
> usleep()).

That setting is PER PROCESS so it might not help that much.

http://www.php.net/manual/en/pgsql.configuration.php#ini.pgsql.max-links

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Robert Haas 2011-02-16 02:41:24 Re: [PERFORM] pgbench to the MAXINT
Previous Message Ivan Voras 2011-02-16 01:00:22 Re: high user cpu, massive SELECTs, no io waiting problem