pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Marek Florianczyk <franki@tpi.pl>
To: pgsql-admin@postgresql.org
Subject: performance problem - 10.000 databases
Date: 31 Oct 2003 11:04:08 +0100
Message-ID: <1067594647.22286.57.camel@franki-laptop.tpi.pl> (raw)

Hi all

We are building hosting with apache + php ( our own mod_virtual module )
with about 10.000 wirtul domains + PostgreSQL.
PostgreSQL is on a different machine ( 2 x intel xeon 2.4GHz 1GB RAM
scsi raid 1+0 )

I've made some test's - 3000 databases and 400 clients connected at same
time. These clients was doing on each database set of query 10 times,
and then connect to next database. These queries:
select * from table1 where number='$i'
update table2 set some_text='int(rand(5))'
select * from table1 where position in (select position from table2
where number in (select number from table3))

Each database has four tables (int,text,int) with 1000 records.
Postgres is taking all memory and all processor ( 4CPU with Hyper
Threading )
The first two queries has time duration 0 to 10 sec
Third query has 15-70 sec.

But my problem is that when I hit command:
psql -h 127.0.0.1 dbname dbuser 
I'm waiting about 3-5 sec to enter psql monitor, so every new connection
from apache will wait about 3-5 sec to put query to server. Thats a very
long time... 
4 sec. to connect to server and 4 sec. to process a query.
Why this time to connect to server is so long ???
I could made persistent connection, but with 10.000 clients it will kill
the server.
Has any one idea how to tune postgres, to accept connection faster?
Maybe some others settings to speed up server ?
My settings:
PostgreSQL:
max_connections = 512
shared_buffers = 8192
max_fsm_relations = 10000       
max_fsm_pages = 100000          
max_locks_per_transaction = 512
wal_buffers = 32
sort_mem = 327681         
vacuum_mem = 8192
fsync = true
effective_cache_size = 1000000
log_connections = true
log_pid = true
log_statement = true
log_duration = true
log_timestamp = true

Kernel:
kernel.shmmni = 8192
kernel.shmall = 134217728
kernel.shmmax = 536870912
RLIMIT_NPROC=1000


greetings
Marek




view thread (50+ messages)  latest in thread

Message-ID: <1067594647.22286.57.camel@franki-laptop.tpi.pl>
Permalink:  ../1067594647.22286.57.camel@franki-laptop.tpi.pl/
Also on:    postgresql.org/message-id/1067594647.22286.57.camel@franki-laptop.tpi.pl

 · 

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-admin@postgresql.org
  Cc: franki@tpi.pl
  Subject: Re: performance problem - 10.000 databases
  In-Reply-To: <1067594647.22286.57.camel@franki-laptop.tpi.pl>
  References: <1067594647.22286.57.camel@franki-laptop.tpi.pl>

* 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