Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wy31Z-0005yd-QS for pgsql-admin@arkaria.postgresql.org; Fri, 20 Jun 2014 17:54:54 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Wy31Y-0000tR-Kl for pgsql-admin@arkaria.postgresql.org; Fri, 20 Jun 2014 17:54:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Wy31X-0000tF-Ik for pgsql-admin@postgresql.org; Fri, 20 Jun 2014 17:54:51 +0000 Received: from nm9-vm3.bullet.mail.ne1.yahoo.com ([98.138.91.139]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1Wy31T-0004tM-Ht for pgsql-admin@postgresql.org; Fri, 20 Jun 2014 17:54:50 +0000 Received: from [98.138.100.118] by nm9.bullet.mail.ne1.yahoo.com with NNFMP; 20 Jun 2014 17:54:44 -0000 Received: from [98.138.226.163] by tm109.bullet.mail.ne1.yahoo.com with NNFMP; 20 Jun 2014 17:54:43 -0000 Received: from [127.0.0.1] by omp1064.mail.ne1.yahoo.com with NNFMP; 20 Jun 2014 17:54:43 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 977566.60540.bm@omp1064.mail.ne1.yahoo.com Received: (qmail 55600 invoked by uid 60001); 20 Jun 2014 17:54:43 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ymail.com; s=s1024; t=1403286883; bh=/p03chyIKITA+LH3ZFhYvxmvjLsIvJgSglP+zPErm0w=; h=References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=ZUMnapOqpfR/IVSH4sYEePKVhiYtIk/1uYRqdYQYwz67HJpG32ksWo40TmhgOwzVN+ISGFErTY8g0/KxC1dMuB9a7vY026g/x7CvCKJP0cxAOgjSYyDdBfQ2zEk+76dC8QfpjSif3sg37tNDImkkpfn8CJ2KoZcPTzj29KtbdJc= X-YMail-OSG: MsTasU8VM1ls5VfKCZiXyeRxKeOqEPdaT3Fyn.u.1rGskvW 2U.1NkIg1oGrGWx9tVk7s8I7qpy4GWe5Fkv.pa2vLGHXsQJd0T2OxAQukCh4 W9er8lO94GtTYSHfyg8.x.kttwnG28JjDeBQQZ7WttBPB3eCl37Xn2hx2epp CFJ_JJnAs2F5ndw7osAR8EKOZIDzwPH99Bvyf7rW9gMKLBFGenannJkfI7_z UYhuEqNxX7PsY2.6vwcnOH2VxKiPSaAFkc021hZBDBFFf7wQOrfNMfI_.CE8 RfxFLWD_.uAXevVyZLTR5FYACkJiDDxvlv4Fd1yI9GxBHfb40dp.oU_7xJOa v2WLfCJ_idvZSEtFj9mLTEKG2vuUr7MxbD3m4J64U59RzT1cK36.o5OfjFp4 zs0vIiWtJ2KAzLgyLZorTme23ce5c.gzG5QUPSbLCz85wEoBE_aMZ62l52Uw CvBmzcOECPjjDBTH4gyA5ElCdzPVQsbu3CQcl.LJ6h6lNDTu7lehaysBD2ZT ivA75jHTJ8ZS9116LoCLwgYU2aaBvUpLCEsk_TizFPraIcVtpbaB9FHL7ORN SYVswu4pPMidlZa5jOA-- Received: from [24.178.25.147] by web122306.mail.ne1.yahoo.com via HTTP; Fri, 20 Jun 2014 10:54:43 PDT X-Rocket-MIMEInfo: 002.001, 0JXQstCz0LXQvdC40Lkg0KHQtdC70Y_QstC60LAgPGV2Zy5zZWx5YXZrYUBnbWFpbC5jb20.IHdyb3RlOgoKPiBIaSwgS2V2aW4KPiBJIHdhbnQgdG8gYXNrIHlvdSBhYm91dCBleHBlcmllbmNlIHdpdGggamF2YSBhbmQgZGJjcCBwb29sLCBjb3VsZAo.IHlvdSBkZXNjcmliZSB0aGlzIGNhc2UgaW4gZGV0YWlsLgoKV2VsbCwgdGhlIHBvb2xlciBJIGhhdmUgdGhlIG1vc3QgZXhwZXJpZW5jZSB3aXRoIGlzIG9uZSB0aGF0IEkKZGVzaWduZWQgYW5kIHdyb3RlIHVuZGVyIEphdmEgMS4wIGZvciBXaXNjb25zaW4BMAEBAQE- X-Mailer: YahooMailWebService/0.8.191.1 References: <1402507690.19836.YahooMailNeo@web122306.mail.ne1.yahoo.com> <26995497.123.1402508346235.JavaMail.lenovo@lenovo-PC> <1402508911.42015.YahooMailNeo@web122301.mail.ne1.yahoo.com> <1402626535.75204.YahooMailNeo@web122304.mail.ne1.yahoo.com> Message-ID: <1403286883.24376.YahooMailNeo@web122306.mail.ne1.yahoo.com> Date: Fri, 20 Jun 2014 10:54:43 -0700 From: Kevin Grittner Reply-To: Kevin Grittner Subject: Re: PostgreSQL db To: =?utf-8?B?0JXQstCz0LXQvdC40Lkg0KHQtdC70Y/QstC60LA=?= Cc: Frank Zhou , Amit Sharma , "pgsql-admin@postgresql.org" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org =D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9 =D0=A1=D0=B5=D0=BB=D1=8F=D0=B2= =D0=BA=D0=B0 wrote: > Hi, Kevin > I want to ask you about experience with java and dbcp pool, could > you describe this case in detail. Well, the pooler I have the most experience with is one that I designed and wrote under Java 1.0 for Wisconsin Courts.=C2=A0 It continued to work well for us until the time I left, about 16 years later, with minimal adjustments to take advantage of newer capabilities in later versions of Java as they came along.=C2=A0 But before I left they were looking at reworking their software stack using packages from outside, and I reviewed various Java-based poolers to see how well I thought they would work.=C2=A0 IMO, dbcp was the best of the lot that I reviewed. > I have one database and several app each of this app have own > datasource, which is a dbcp pool object. Maybe it is good > practice to use pgbouncer before dbcp data sources(but my opinion > it is not good practice to have 2 pool before database), or i > should calculate all dbcp datasources from all app with formula > sum(maxActive)=3Dmax connection - 3. The goal is to try to limit the total number of active database transactions to the number that the database can handle efficiently, or as close as you can get to that.=C2=A0 When you have multiple pools in parallel, you need to add the maximum database connections from all of them.=C2=A0 I would try to avoid a second layer of pooling, but if you can't limit the numbers and sizes of the Java pools enough to prevent performance problems due to concurrency, putting pgbouncer in front of the server would not be crazy. > And what about another java pool realization, like HikariCP, do > you try them? That is not one I reviewed. > This is my sample property file for dbcp: I don't remember all the settings and what they do, but the goal would be to queue requests to start a transaction when a pool was already at its maximum.=C2=A0 My recollection is that this is what dbcp does by default.=C2=A0 Well, one thing to look at: I might try setting initial and maximum pool sizes the same, to avoid a lot of connection opening and closing during shifts in load.=C2=A0 Logging connections and disconnections will help you spot thrashing of that sort. The best thing is to try incremental changes to the sizing of the pool with production load with your actual application, and closely monitor results.=C2=A0 I know I was surprised by how much reducing the pool size improved performance of our application and allowed it to scale better with thousands of users. -- Kevin Grittner EDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company --=20 Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin