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 7AE11D1B55A for ; Fri, 31 Oct 2003 14:24:07 +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 06509-06 for ; Fri, 31 Oct 2003 10:23:39 -0400 (AST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 452B4D1B8C2 for ; Fri, 31 Oct 2003 10:23:35 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h9VENdit009644; Fri, 31 Oct 2003 09:23:39 -0500 (EST) To: Marek Florianczyk Cc: pgsql-admin@postgresql.org 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> Comments: In-reply-to Marek Florianczyk message dated "31 Oct 2003 11:04:08 +0100" Date: Fri, 31 Oct 2003 09:23:39 -0500 Message-ID: <9643.1067610219@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/394 X-Sequence-Number: 10955 Marek Florianczyk writes: > 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. You are going to need much more serious iron than that if you want to support 10000 active databases. The required working set per database is a couple hundred K just for system catalogs (I don't have an exact figure in my head, but it's surely of that order of magnitude). So the system catalogs alone would require 2 gig of RAM to keep 'em swapped in; never mind caching any user data. The recommended way to handle this is to use *one* database and create 10000 users each with his own schema. That should scale a lot better. Also, with a large max_connections setting, you have to beware that your kernel settings are adequate --- particularly the open-files table. It's pretty easy for Postgres to eat all your open files slots. PG itself will usually survive this condition just fine, but everything else you run on the machine will start falling over :-(. For safety you should make sure that max_connections * max_files_per_process is comfortably less than the size of the kernel's open-files table. regards, tom lane