<< 2014年7月6日 | 首页 | 2014年7月8日 >>

IBM IPV6 Can Cause Poor Java Performance - United States

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.

阅读全文……

标签 : ,

使用nginx sticky模块实现基于cookie的负载均衡

1、nginx sticky 模块工作流程图

ip_hash

nginx sticky

2、下载安装nginx sticky
下载地址:http://code.google.com/p/nginx-sticky-module/downloads/list
目前共有2个版本,一个是1.0,一个是1.1,1.0已经寿终正寝了.1.1增加了权重的参数.

安装nginx + sticky模块

# wget http://nginx-sticky-module.googlecode.com/files/nginx-sticky-module-1.1.tar.gz
# tar -xzvf nginx-sticky-module-1.1.tar.gz

# wget http://nginx.org/download/nginx-1.0.6.tar.gz
# tar -czvf nginx-1.0.6
# cd nginx-1.0.6
# ./configure --prefix=/usr/local/nginx-1.0.6 --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --add-module=../nginx-sticky-module-1.1
# make
# make install

3、配置nginx sticky

nginx 的upstream使用sticky,如下

upstream cluster_test {
     sticky;
     server 192.168.100.209:80;
     server 192.168.100.225:80;
}

配置虚拟主机(以下有配置的可以忽略掉)

server {
        listen        80;
        server_name     test.ttlsa.com;
        index index.jsp;

        access_log /data/logs/nginx/test.ttlsa.com_access.log main;

        set $proxy_pass cluster_test;

        location /
        {
                proxy_pass http://$proxy_pass;
                include proxy.conf;
                add_header Cache-Control no-store;
        }

}

备注:
nginx和apache不同,nginx每次安装一个新的模块都需要重新编译一次,编译完成之后将nginx这一个文件拷贝到sbin下面即可.我这边全新安装一次,因为公司在两年前就选择了这个nginx版本,也没打算去换,所以大家可以把nginx换成自己最合适的一个版本,不用完全跟着文章来安装.

阅读全文……

标签 : , ,