soylatte and

Leif Nelson lnelson at
Thu Dec 6 08:56:58 PST 2007

Hi all-

I've been using soylatte for the last few days to work with the Oracle 
application server oc4j.  I was puzzled by it's extremely slow startup 
time using soylatte.  So, I did some investigation, and found that 
setting the system property causes calling 
InetAddress.getLocalHost() to take at least 8 seconds to execute on my 
Mac Pro.  It seems that the oc4j server sets this property in it's 
main() method on startup, and it is not configurable!   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, I found that 
the time is all taken up inside of the native method:

If I trace with (the default), I found 
that the native method gets 
called instead returns very quickly.

I hope this narrows it down enough to find out what's wrong. :-)


Here's my test class:

package test;


public class TestHostName {
    public static void main(String[] args) {
        try {
            long start = System.currentTimeMillis();
            InetAddress addr = InetAddress.getLocalHost();
            long stop = System.currentTimeMillis();
            System.out.println("Found: " + addr.getHostAddress() + " in: 
" + (stop - start) + " ms.");
        } catch (Exception e) {

Here's some results from running the tests.  The results are very 
similar on both Tiger (32 bit) & Leopard (32 & 64 bit)

~/testhost $ uname -a
Darwin bridger.local 8.11.1 Darwin Kernel Version 8.11.1: Wed Oct 10 
18:23:28 PDT 2007; root:xnu-792.25.20~1/RELEASE_I386 i386 i386

~/testhost $ /opt/soylatte16-i386-r3/bin/javac test/
~/testhost $ /opt/soylatte16-i386-r3/bin/java test.TestHostName
Found: in: 8581 ms.
~/testhost $ /opt/soylatte16-i386-r3/bin/java test.TestHostName
Found: in: 208 ms.

~/testhost $ 
~/testhost $ 
/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/bin/java test.TestHostName
Found: in: 41 ms.
~/testhost $ 
Found: in: 3 ms.

~/testhost $ 
~/testhost $ 
/System/Library/Frameworks/JavaVM.framework/Versions/1.4/Home/bin/java test.TestHostName
Found: in: 8 ms.
~/testhost $ 
Found: in: 7 ms.

More information about the porters-dev mailing list