设为首页 收藏本站
查看: 797|回复: 0

[经验分享] tomcat native

[复制链接]

尚未签到

发表于 2018-11-30 08:34:48 | 显示全部楼层 |阅读模式
Tomcat Native 这个项目可以让 Tomcat 使用 Apache 的 apr 包来处理包括文件和网络IO操作,以提升性能。Tomcat Native 是利用 APR 来提升Tomcat性能的本地API。

  

  软件下载地址:http://tomcat.apache.org/download-native.cgi

  或者在二进制版本包内的bin目录下软件相关的包。建议使用比较新一些的版本,有一个版本有bug,网上搜索一下就知道。

  

  安装环境需求:

Development Tools    需要安装这个组的包

       apr apr-devel

       openssl相关包  



安装过程:



查询是否安装Development Tool

[root@zonghe ~]# yum grouplist
Loaded plugins: fastestmirror
Setting up Group Process
Loading mirror speeds from cached hostfile
addons                                                                                      
Installed Groups:
Development Libraries
Development Tools    需要安装这个组的包
Dialup Networking Support


查看安装那些apr包

[root@zonghe ~]# rpm -qa|grep apr
apr-1.2.7-11.el5_6.5
apr-1.2.7-11.el5_6.5
apr-util-1.2.7-11.el5_5.2
apr-util-1.2.7-11.el5_5.2  

  查看安装那些openssl包
[root@zonghe ~]# rpm -qa|grep openssl
openssl-0.9.8e-20.el5
openssl-devel-0.9.8e-20.el5
openssl-devel-0.9.8e-20.el5
openssl-0.9.8e-20.el5  

      经查看发现少了apr-devel包,直接yum安装  
[root@zonghe ~]# yum install apr-devel
Loaded plugins: fastestmirror
Existing lock /var/run/yum.pid: another copy is running as pid 28125.
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: yum
Memory :  19 M RSS (236 MB VSZ)
Started: Thu Jun 27 00:46:45 2013 - 00:41 ago
State  : Sleeping, pid: 28125
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package apr-devel.i386 0:1.2.7-11.el5_6.5 set to be updated
---> Package apr-devel.x86_64 0:1.2.7-11.el5_6.5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================
Package                    Arch                    Version                              Repository             Size
=====================================================================================================================
Installing:
apr-devel                  i386                    1.2.7-11.el5_6.5                     base                  233 k
apr-devel                  x86_64                  1.2.7-11.el5_6.5                     base                  238 k
Transaction Summary
=====================================================================================================================
Install       2 Package(s)
Upgrade       0 Package(s)
Total download size: 471 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): apr-devel-1.2.7-11.el5_6.5.i386.rpm                                                    | 233 kB     00:00   
(2/2): apr-devel-1.2.7-11.el5_6.5.x86_64.rpm                                                  | 238 kB     00:00   
---------------------------------------------------------------------------------------------------------------------
Total                                                                                 12 kB/s | 471 kB     00:40   
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing     : apr-devel                                                                                     1/2
Installing     : apr-devel                                                                                     2/2
Installed:
apr-devel.i386 0:1.2.7-11.el5_6.5                        apr-devel.x86_64 0:1.2.7-11.el5_6.5                     
Complete!  

       安装native  (我使用的是tomcat二进制包bin目录下的包)
[root@zonghe bin]# pwd
/usr/local/tomcat6/bin
[root@zonghe bin]# ls
bootstrap.jar       commons-daemon-native.tar.gz  setclasspath.sh  tomcat-juli.jar       version.sh
catalina.bat        cpappend.bat                  shutdown.bat     tomcat-native.tar.gz
catalina.sh         digest.bat                    shutdown.sh      tool-wrapper.bat
catalina-tasks.xml  digest.sh                     startup.bat      tool-wrapper.sh
commons-daemon.jar  setclasspath.bat              startup.sh       version.bat
[root@zonghe bin]# tar zxf tomcat-native.tar.gz
[root@zonghe bin]# ls
bootstrap.jar       commons-daemon-native.tar.gz  setclasspath.sh  tomcat-juli.jar           version.bat
catalina.bat        cpappend.bat                  shutdown.bat     tomcat-native-1.1.22-src  version.sh
catalina.sh         digest.bat                    shutdown.sh      tomcat-native.tar.gz
catalina-tasks.xml  digest.sh                     startup.bat      tool-wrapper.bat
commons-daemon.jar  setclasspath.bat              startup.sh       tool-wrapper.sh
[root@zonghe bin]# cd tomcat-native-1.1.22-src/
CHANGELOG.txt  jni/           KEYS           LICENSE        NOTICE         README.txt   
[root@zonghe bin]# cd tomcat-native-1.1.22-src/jni/native/
[root@zonghe native]# ./configure --with-apr=/usr --with-ssl  
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking for working mkdir -p... yes
Tomcat Native Version: 1.1.22
checking for chosen layout... tcnative
checking for APR... yes
setting CC to "gcc"
setting CPP to "gcc -E"
checking for JDK location (please wait)... /usr/local/jdk1.6.0_43 from environment
checking Java platform... checking Java platform...
checking for sablevm... NONE
adding "-I/usr/local/jdk1.6.0_43/include" to TCNATIVE_PRIV_INCLUDES
checking os_type directory...  linux
adding "-I/usr/local/jdk1.6.0_43/include/linux" to TCNATIVE_PRIV_INCLUDES
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for OpenSSL library... using openssl from /usr/lib and /usr/include
checking OpenSSL library version... ok
checking for OpenSSL DSA support... yes
setting TCNATIVE_LDFLAGS to "-lssl -lcrypto"
adding "-DHAVE_OPENSSL" to CFLAGS
setting TCNATIVE_LIBS to ""
setting TCNATIVE_LIBS to " /usr/lib64/libapr-1.la  -lpthread -ldl"
configure: creating ./config.status
config.status: creating tcnative.pc
config.status: creating Makefile
config.status: executing default commands
[root@zonghe bin]#make && make install  

         更新共享库   
[root@zonghe native]# echo "/usr/local/apr/lib" >> /etc/ld.so.conf
[root@zonghe native]# ldconfig  

         检查是否安装好
  
[root@zonghe native]# ldconfig -v|grep native
libtcnative-1.so.0 -> libtcnative-1.so.0.1.22  
        到此,tomcat native已经安装完成




运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-641383-1-1.html 上篇帖子: Jboss迁移到Tomcat之手记(一) 下篇帖子: 安装jdk和tomcat6遇到的问题
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表