soylatte and java.net.preferIPv4Stack=true

Leif Nelson lnelson at llnl.gov
Mon Dec 10 17:02:46 PST 2007


Hey Landon-

I re-built the jdk with your patch.  Appserver startup time for the 
10.1.3.3 OC4J container went from 136 seconds (soylatte-1.0) to 7 
seconds (soylatte-patched).   Startup time for 10.1.2.0.2 OC4J container 
went from 72 seconds (soylatte-1.0) to 3 seconds (soylatte-patched).  
Those numbers for the patched soylatte match (almost exactly) what we 
get from java 5.

Thanks so much!

-Leif

Landon Fuller wrote:
>
> On Dec 6, 2007, at 8:56 AM, Leif Nelson wrote:
>
>>   Also, each subsequent invocation of InetAddress.getLocalHost() 
>> takes another 8 seconds, and apparently this method is called several 
>> times!  I did some tests on several macs running both Tiger & Leopard 
>> with java5 and java6 to demonstrate the issue.
>> After some tracing with -Djava.net.preferIPv4Stack=true, I found that 
>> the time is all taken up inside of the native method: 
>> java.net.Inet4AddressImpl.getLocalHostName().
>>
>> If I trace with -Djava.net.preferIPv4Stack=false (the default), I 
>> found that the native method 
>> java.net.Inet6AddressImpl.getLocalHostName() gets called instead 
>> returns very quickly.
>>
>> I hope this narrows it down enough to find out what's wrong. :-)
>
> Thanks!
>
> I tracked it down to this copy/paste bug in the BSD-specific code 
> (which I believe I wrote some time ago, so it's my bug)
>     error = getaddrinfo(hostname, "domain", &hints, &res);
>
> The "domain" service argument causes getaddrinfo() on Mac OS X to make 
> (time consuming) MDNS SRV requests for the service:
>     12:16:03.619145 IP 10.0.50.246.mdns > 224.0.0.251.mdns: 0 SRV 
> (QM)? _domain._udp.max.local. (40)
>
> The service argument should have been NULL. I committed a fix for this 
> upstream, and will include it in the next release:
>     landonf at max:/tmp> /tmp/j-build/bsd-i586/bin/java 
> -Djava.net.preferIPv4Stack=true TestHostName
>     Found: 10.0.50.246 in: 9 ms.
>
> Patch: 
> http://hg.bikemonkey.org/javasrc_1_6_jrl_darwin_stable/rev/219cd1380f35
>
> Thanks again for the report,
> -landonf
>



More information about the porters-dev mailing list