Re: [HACKERS] postgres processes

Поиск
Список
Период
Сортировка
От wieck@debis.com (Jan Wieck)
Тема Re: [HACKERS] postgres processes
Дата
Msg-id m10sOn7-0003kGC@orion.SAPserv.Hamburg.dsh.de
обсуждение исходный текст
Ответ на postgres processes  (Remigiusz Sokolowski <rems@gdansk.sprint.pl>)
Ответы Re: [HACKERS] postgres processes
Список pgsql-hackers
Remigiusz Sokolowski wrote:

>
> Hi!
> I have following problem:
>
> I use php with postgres as backend. Every time, I run some queries,
> postgres creates a lot of processes - this causes extremely high processor
> usage.
> I execute some queries in quasi-parallel way, cause I need its results.
> But other are executing and every time I free result - all of those
> queries are executing on the same connection. So is it normal, that I get
> so much processes? And if there is some way to limit it? Or may be change
> process live time?

    That's  a  general  problem  when  using  PostgreSQL  in  the
    background for Apache CGI or php scripts.

    The defaults in the Apache configuration are

      StartServers          5
      MaxClients            256
      MinSpareServers       5
      MaxSpareServers       10

    This means, that at  startup  Apache  will  create  5  server
    processes  that  can handle requests simultaneously. When the
    site gets busy  and  some  of  them  take  longer  to  handle
    requests  (especially  scripting requests), it will start new
    servers (max one per second) until the limit of 256  parallel
    server  processes  is  reached. If they finish their requests
    and become idle again, some of them get killed if  there  are
    more than 10 idle Apache processes.

    This  is  normally  a good policy. It ensures that small file
    requests can still get served while some long  running  CGI's
    block their server process.

    In  the case of having PostgreSQL in the background, any such
    CGI request causes another backend to  get  started  too.  So
    when there's a peak of such requests, PostgreSQL will have to
    serve more parallel queries, Apache will start  more  servers
    to  handle  the  incoming  requests,  causing more PostgreSQL
    connections and more parallel queries...

    What you can try is to take down the MaxClients directive  in
    the  Apache  configuration. But that would mean, that a plain
    html file request, that could be served in milliseconds, will
    have to wait if all servers are blocked waiting for CGI's.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#========================================= wieck@debis.com (Jan Wieck) #

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Daniel Kalchev
Дата:
Сообщение: Re: [HACKERS] another locale problem
Следующее
От: Remigiusz Sokolowski
Дата:
Сообщение: Re: [HACKERS] postgres processes