pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: vincent <vinny@xs4all.nl>
To: pgsql-performance@postgresql.org
Subject: Re: slow pg_connect()
Date: Mon, 24 Mar 2008 09:35:44 +0100 (CET)
Message-ID: <24238.194.109.235.253.1206347744.squirrel@webmail.xs4all.nl> (raw)

>
> It takes more then 0.05s :(
>
> Only this function reduce server speed max to 20request per second.

First, benchmarking using only PHP is not very accurate, you're probably
also measuring some work that PHP needs to do just to get started in the
first place.

Second, this 20r/s is not requests/sec but connections per second per PHP
script. One pageview in PHP needs one connection, so it will delay the
pageview by 0.05 seconds.

If you need raw speed, you can use pg_pconnect(), but be VERY carefull
because that will keep one databaseconnection open for every database for
every webserverprocess. If you have 10 databasedriven websites running on
the same webserver and that server is configured to run 100 processes at
the same time, you will get 10x100=1000 open connections, which eats more
RAM than you have.




view thread (7+ messages)  latest in thread

Message-ID: <24238.194.109.235.253.1206347744.squirrel@webmail.xs4all.nl>
Permalink:  ../24238.194.109.235.253.1206347744.squirrel@webmail.xs4all.nl/
Also on:    postgresql.org/message-id/24238.194.109.235.253.1206347744.squirrel@webmail.xs4all.nl

 · 

reply

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-performance@postgresql.org
  Cc: vinny@xs4all.nl
  Subject: Re: slow pg_connect()
  In-Reply-To: <24238.194.109.235.253.1206347744.squirrel@webmail.xs4all.nl>
  References: <24238.194.109.235.253.1206347744.squirrel@webmail.xs4all.nl>

* 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