Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TPCZO-0004Sr-DA for pgsql-jdbc@postgresql.org; Fri, 19 Oct 2012 13:24:58 +0000 Received: from nyc15.sns-usa.com ([173.231.131.23]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TPCZH-0006Dp-EE for pgsql-jdbc@postgresql.org; Fri, 19 Oct 2012 13:24:57 +0000 Received: from turks.localdomain (rrcs-24-199-145-40.midsouth.biz.rr.com [24.199.145.40]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by nyc15.sns-usa.com (Postfix) with ESMTP id 869C037004B for ; Fri, 19 Oct 2012 09:24:50 -0400 (EDT) Date: Fri, 19 Oct 2012 09:24:49 -0400 (Eastern Daylight Time) From: Scott Harrington To: pgsql-jdbc@postgresql.org Subject: Re: Severe performance degradation when using the 9.2-1000 JDBC 4 driver In-Reply-To: <5080FFA9.70402@ringerc.id.au> Message-ID: References: , <507FC5EA.6070905@ringerc.id.au> <51061EFB789B4A45AC6598C83649B7BE8DB56604@NBL-EXCD1-01.nebula.local>, <51061EFB789B4A45AC6598C83649B7BE8DB56894@NBL-EXCD1-01.nebula.local> <5080FFA9.70402@ringerc.id.au> User-Agent: Alpine 2.00 (WNT 1167 2008-08-23) X-X-Sender: scotth-spam@mx7.forexster.com MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Pg-Spam-Score: -2.3 (--) X-Archive-Number: 201210/89 X-Sequence-Number: 23413 On Fri, 19 Oct 2012, Craig Ringer wrote: > On 10/19/2012 02:36 PM, Mikko Tiihonen wrote: >>>> I think the DNS lookup is part of the JDBC failover connection patch >>>> that I created. I initially used a InetSocketAddress.getHostString() >>>> that does not do any DNS lookups, but since that method was added in >>>> Java7 I had to revert to getHostName() method which does. >>>> >>> >>> Is there any functionality that we need that is provided by using >>> InetSocketAddress or is it just a convenient object to pass around host >>> and port together? The simplest option to me seems to be reverting to >>> passing simple strings/ints around (possibly in some kind of our own >>> container). >> >> It is just a convenient container. And it seems on older JVMs it cannot be >> used for such purposes. >> I agree that we should just replace it with our own container that contains >> the host/port pair. > > If that's all you're using it for, then that's the simplest and best choice. > +1 from me on that. Could the new container contain the localAddress (null for "any") as well as the target host and port? I'm using a simple patch that allows binding my JDBC connections to specific localAddress (unit tests & docs still to-do), and I can envision scenarios where a client with multiple NICs might need to initiate connections to failover hostA from localAddress X and to failover hostB from localAddress Y, in environments where iptables SNAT may not be an option. By creating an appropriate factory class for this laddr/caddr/cport container we could select the best implementation (Java7-only or pre-Java7) in a static initializer and avoid having to resort to reflection to avoid the unwanted DNS calls as discussed earlier in this thread. Want me to take a stab at this this weekend? I'm not git-skilled yet so I'll just have to email a patch.