出家如初,成佛有余

使用APR( Apache Portable Runtime)来提升jboss性能

Posted in Uncategorized by chuanliang on 2008/05/16

从tomcat5.0后,可以用 Apache Portable Runtime 来通过jni来使用native接口,提升Tomcat及Jboss的性能,同时可以提升Web静态页面的处理能力,从理论上可以不再需要专门的Web Server来处理静态页面了。当然考虑到负载均衡、rewrite、虚拟主机等支持的考虑,还会采用lighttpd来作为前端的Web Server。

在对eSales系统部署时候,采用Jboss 4.2.2.GA,简单描述一下Jboss-Tomcat 使用APR的方法,关于Tomcat支持APR的参看相关文档。

1、下载boss-4.2.2.GA,最新稳定版本为4.2.2

wget http://jaist.dl.sourceforge.net/sourceforge/jboss/jboss-4.2.2.GA.zip

2、下载APR,由于Jboss对APR有一些特别的改动,因此需要从Jboss网站下载:

wget http://www.jboss.org/file-access/default/members/jbossweb/freezone/dist/2.0.4.GA/jboss-native-2.0.4-linux2-x86-ssl.tar.gz

3、解压jboss,假设安装路径为/opt

unzip jboss-4.2.2.GA.zip

mv jboss-4.2.2.GA  /opt

4、启动jboss,测试一下Jboss安装情况

cd jboss-4.2.0.GA/bin
./run.sh
 
注意console输出中类似如下信息:
21:51:56,325 INFO  [AprLifecycleListener] The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /opt/jdk/jre/lib/i386/server:/opt/jdk/jre/lib/i386:/opt/jdk/jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib

退出Jboss

5、解压jboss-native-2.0.4-linux2-x86-ssl.tar.gz

mkdir jboss-native

mv  jboss-native-2.0.4-linux2-x86-ssl.tar.gz  jboss-native/

cd jboss-native/

tar zxvf jboss-native-2.0.4-linux2-x86-ssl.tar.gz

mv  bin/META-INF/bin/linux2/x86/*  /opt/jboss-4.2.2.GA/bin/

mkdir /opt/jboss-4.2.2.GA/bin/native

cp –r bin/META-INF/lib/linux2/x86/*   /opt/jboss-4.2.2.GA/bin/native

6、再次启动jboss

/opt//jboss-4.2.2.GA/bin/run.sh &

注意console输出的如下信息:

21:57:36,150 INFO  [AprLifecycleListener] Loaded Apache Tomcat Native library 1.1.13.

21:57:36,156 INFO  [AprLifecycleListener] APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].

21:57:44,286 INFO  [Http11AprProtocol] Initializing Coyote HTTP/1.1 on http-127.0.0.1-8080

21:57:44,288 INFO  [AjpAprProtocol] Initializing Coyote AJP/1.3 on ajp-127.0.0.1-8009

说明apr已经正常启用

参考文档:

http://wiki.jboss.org/wiki/HowToAddAprToJBoss

 

Technorati 标签: ,,,
Tagged with: , , ,

No Responses Yet

Subscribe to comments with RSS.

  1. […] 参看使用APR( Apache Portable Runtime)来提升jboss性能 […]

  2. higkoo said, on 2010/05/14 at 13:55

    有一个问题想请教:
    安装Native到Jboss很简单,问题是安装之后再启动Jboss就非常慢。总是卡在这个地方好几分钟:
    13:53:19,122 INFO [NativeServerConfig] jbossws-3.0.1-native-2.0.4.GA (build=200803312044)
    13:53:19,807 INFO [Embedded] Catalina naming disabled
    13:53:19,913 INFO [AprLifecycleListener] Loaded Apache Tomcat Native library 1.1.16.
    13:53:19,913 INFO [AprLifecycleListener] APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].

    如果去掉Native,启动只需要十多秒。请赐教!

  3. higkoo said, on 2010/05/14 at 13:58

    补充一下环境:
    Linux testServer 2.6.18-164.el5 #1 SMP Thu Sep 3 03:28:30 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

    java version “1.6.0_12”
    Java(TM) SE Runtime Environment (build 1.6.0_12-b04)
    Java HotSpot(TM) 64-Bit Server VM (build 11.2-b01, mixed mode)

    jboss-4.2.3.GA.zip

    jboss-native-2.0.6-linux2-x64-ssl.tar.gz


发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: