X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id D18B9D1B4E8 for ; Fri, 31 Oct 2003 10:12:08 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 63002-02 for ; Fri, 31 Oct 2003 06:11:38 -0400 (AST) Received: from mail.tpi.pl (mail.tpi.pl [193.110.121.18]) by svr1.postgresql.org (Postfix) with ESMTP id 2F605D1B4F8 for ; Fri, 31 Oct 2003 06:11:36 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by mail.tpi.pl (Postfix) with ESMTP id 74AEB4704A for ; Fri, 31 Oct 2003 11:11:36 +0100 (CET) Received: from mail.tpi.pl ([127.0.0.1]) by localhost (silver [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 23074-07 for ; Fri, 31 Oct 2003 11:11:36 +0100 (CET) Received: from [10.5.3.38] (lan-out [193.110.121.17]) by mail.tpi.pl (Postfix) with ESMTP id AFDB14703E for ; Fri, 31 Oct 2003 11:11:35 +0100 (CET) Subject: performance problem - 10.000 databases From: Marek Florianczyk To: pgsql-admin@postgresql.org Content-Type: text/plain Organization: Message-Id: <1067594647.22286.57.camel@franki-laptop.tpi.pl> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 Date: 31 Oct 2003 11:04:08 +0100 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at TP Internet X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/383 X-Sequence-Number: 10944 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