Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 0A2BD1336B42 for ; Tue, 28 Dec 2010 11:13:39 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 45477-02 for ; Tue, 28 Dec 2010 15:13:33 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smadev.internal.net (host3.dynacom.ondsl.gr [62.103.35.211]) by mail.postgresql.org (Postfix) with ESMTP id AD4CE1337B53 for ; Tue, 28 Dec 2010 11:13:30 -0400 (AST) Received: from smadev.internal.net (localhost.internal.net [127.0.0.1]) by smadev.internal.net (8.14.2/8.14.2) with ESMTP id oBSFDR8d094535 for ; Tue, 28 Dec 2010 17:13:28 +0200 (EET) (envelope-from achill@matrix.gatewaynet.com) Received: from localhost (localhost [[UNIX: localhost]]) by smadev.internal.net (8.14.2/8.14.2/Submit) id oBSFDRs6094534 for pgsql-jdbc@postgresql.org; Tue, 28 Dec 2010 17:13:27 +0200 (EET) (envelope-from achill@matrix.gatewaynet.com) From: Achilleas Mantzios Organization: Dynacom Tankers Mgmt To: pgsql-jdbc@postgresql.org Subject: Re: PostgreSQL Authentication and Pooling in JBoss : static 'postgres' user VS dynamic jboss user Date: Tue, 28 Dec 2010 18:13:27 +0300 User-Agent: KMail/1.9.7 References: <201012281200.11993.achill@matrix.gatewaynet.com> <201012281405.08236.achill@matrix.gatewaynet.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <201012281713.27550.achill@matrix.gatewaynet.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.451 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_BRBL_LASTEXT=1.449 X-Spam-Level: X-Archive-Number: 201012/83 X-Sequence-Number: 21321 =CE=A3=CF=84=CE=B9=CF=82 Tuesday 28 December 2010 15:26:11 =CE=BF/=CE=B7 Le= w =CE=AD=CE=B3=CF=81=CE=B1=CF=88=CE=B5: > Achilleas Mantzios wrote: > > Yes that's the logic. One connection pool per user. > > I find it more clever, fine grained and just better from > > many perspectives (security/auditing/diagnosis/debugging being the main= ones). >=20 > Too clever by half. What do you do with the pool when a user is logged o= ff=20 > for a few days, then comes back? =20 Personally, i do not do anything ;) Its the Jboss JCA pool that does the ma= gic. To answer your question, simply defining min-pool-size=3D0 will mean that w= hen the user goes home, after a defined timeout all his connections will be closed. When he comes back tomorrow, his connection(s) will be automatically create= d. > How many pools will you have when a thousand =20 > users log off and another thousand log on? How many connections will you= keep=20 > in each pool? How will the DB engine keep up with all that? Each pool will have the minimum connections, in order for the app to work o= k. e.g. if in my code the max simulteanous connections opened are 4, then i wi= ll define that number. The max number of users is known. >=20 > I predict that you will get no increase in security or auditing capabilit= y=20 > that couldn't be handled with the conventional "one user per application"= =20 > approach, and that diagnosis and debugging will be complicated in some ot= her=20 > way, and that you'll have performance and resource issues. >=20 You most probably are referring to a low-complexity system. Lets see this scenario. Imagine you want to indentify a cause for a variety= of problems. Examples a) High load, you want to find what/who causes a very high load on the serv= er b) Peculiar errors in the pgsql log files, with no streight forward source = or explanation (imagine loads of points of access for a db) What do you do? You identify the sql either by looking in pg_stat_activity or by looking at= the error in the pgsql log. Then you do a grep in the application to find possible programs which build= and call such SQL. (Unfortunately in the case of dynamic SQL generation our task becomes an un= pleasant procedure of guessing). Then you look in the jboss server logs and in the jboss access logs (hint := actual http GET/POST with users are *ONLY* recorded in the access logs) to see which user might be calling that program/page. Imagine that the syst= em gets many hits/second. At this point, you are simply lost, in the best case you might have some cl= ue about who run the program, but you would not be able to prove anything for sure. Now compare this, with a nice line from the pgsql log file which looks like: dynacom amantzio 92607 4d19fd48.169bf 2010-12-28 17:08:01.379 EET ERROR: p= ermission denied for relation vessels (where amantzio is the user) >=20 > --=20 > Lew > Ceci n'est pas une pipe. >=20 =2D-=20 Achilleas Mantzios