May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Categories

May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

IPV6 Can Cause Poor Java Performance

echnote (troubleshooting)

Problem(Abstract)

If the entire network is not IPv6-enabled or capable, users may find that Java programs perform poorly.
Resolving the problem

This document explains that if the entire network is not IPv6-enabled or capable, users may find that Java programs perform poorly.

On IBM i 6.1 and 7.1, the default JVM is the IBM Technology for Java (J9). This JVM runs in the PASE environment. When IPv6 is enabled (which is the default), each DNS entry is checked to see if it is IPv6-capable. When PASE hits a slow or unresponsive DNS entry, it will wait for a reply or timeout. A java thread dump (javacore) will confirm that IPv6 is the source of the poor performance. The stack will show “Inet6AddressImpl” as shown below:


at java/net/Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java/net/InetAddress$2.lookupAllHostAddr(InetAddress.java:949)
at java/net/InetAddress.getAddressFromNameService(InetAddress.java:1318)
at java/net/InetAddress.getLocalHost(InetAddress.java:1505)

Resolution:

Disable IPv6 at JVM invocation by using the following java properties:

o -Dcom.ibm.cacheLocalHost=true
o -Djava.net.preferIPv4Stack=true
o -Djava.net.preferIPv6Addresses=false

Note: These properties can be passed as command-line arguments or added to a SystemDefault.properties file.

If the JVM is a WebSphere Application Server job, use caution when adding these properties. You should review the following technote to fully understand
how these properties could adversely affect your application server environment.

http://www-01.ibm.com/support/docview.wss?uid=swg21498126

If you decide to add the properties to your server, they can be added as generic JVM arguments as shown below. The following graphic shows the properties set in WebSphere Application Server 7.0 Express:

docview.wss

Slow performance or hang in HostName lookup

Technote (troubleshooting)

Problem(Abstract)

There is slow performance or a hang during HostName lookup.
Symptom

Thread dumps or javacores taken during the time of the slow response, or “hang threads” will show threads with the following lines at the top of the stack:

at java.net.Inet6AddressImpl.getLocalHostName(Native Method)
at java.net.InetAddress.getLocalHost(InetAddress.java:123)

Cause

The problem could be lookup issues between IPv6 versus IPv4. If the Domain Name System (DNS) server is not configured to handle IPv6 queries, the application may have to wait for the IPv6 query to time out for IPv6 queries.

These threads are waiting for a response for an IPv6 query. It is likely the the DNS server is not responding to the IPv6 query.

Resolving the problem

If your environment only uses IPv4, set the following argument for each process:

-Djava.net.preferIPv4Stack=true

This will disable IPv6 lookup requests and only use IPv4. To set this in the WebSphere Application Server, do the following:

Open the administrative console and navigate to:

Servers > Application Servers > server_name > Process Definition > Java Virtual Machine > Custom Properties(/Environment Entries)

Add the following name and value pair:

Name: java.net.preferIPv4Stack
Value: true

Click Apply, then save all changes.

Restart the application server.
If your environment uses IPv6, please have your network administrator check the DNS set up to ensure that it can respond properly to IPv6 queries.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>