nexus1.9(maven私服)安装及性能优化
介绍
nexus的服务器有2个版本
1.集成web应用服务器版本,用的是jetty
2.war包版本,我们可以自己部署在WEB应用服务器上
3.服务器地址
nexus.mgt.pangu365.com:80 --> 10.10.160.243:8080
注:使用IP地址,在服务器发生故障的时候,服务器可能会迁移到其他IP,所以请尽量不要使用IP。
nexus安装
tomcat:7.0.34
服务器IP:10.10.160.243
服务器域名:http://nexus.mgt.pangu365.com
nexus:nexus-webapp-1.9.2.4.war
tomcat安装目录
/application/search/maven/apache-tomcat-7.0.34
nexus war部署路径
/application/search/maven/nexus-webapp-1.9.2.4
jar数据目录
/data0/search/nexus
apr与tomcat-native安装目录
/application/search/usr
修改nexus配置文件/application/search/maven/nexus-webapp-1.9.2.4/WEB-INF/plexus.properties如下
nexus-work=/data0/search/nexus
security-xml-file=${nexus-work}/conf/security.xml
application-conf=${nexus-work}/conf
runtime=${basedir}/runtime
apps=${runtime}/apps
webapp=${runtime}/apps/nexus/webapp
nexus-app=${runtime}/apps/nexus
runtime-tmp=${runtime}/tmp
修改tomcat的war部署位置,即:修改conf/server.xml
在Host节点下,增加
<Context path="/" docBase="/application/search/maven/nexus-webapp-1.9.2.4"/>
nexus的定时任务配置
选择Administration–>Scheduled Tasks 并添加以下任务
为了提高效率,不影响正常使用
任务在晚上0点开始运行,同时任务之间间隔半小时
nexus的tomcat配置与性能测试
1 安装apr
参考tomcat优化与web压力测试
2 修改${TOMAT_HOME}/bin/catalina.sh
JAVA_OPTS="-Xmx16g -Xms16g -Xmn6g"
3 修改${TOMAT_HOME}/conf/server.xml
<Connector port="8080"
protocol="org.apache.coyote.http11.Http11AprProtocol"
connectionTimeout="20000"
URIEncoding="UTF-8"
maxPostSize="0"
useBodyEncodingForURI="true"
enableLookups="false"
maxHttpHeaderSize="1048576"
maxThreads="768"
minSpareThreads="128"
acceptCount="10240" />
4 压力测试结果,主要测试spring2.5.6(3169452 bytes)的下载
./ab -n 100000 -c 512 -H 'User-Agent: panguso_yace' 'http://10.10.160.243:8080/content/groups/public/org/springframework/spring/2.5.6/spring-2.5.6-sources.jar'
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 10.10.160.243 (be patient)
Completed 10000 requests
Completed 20000 requests
Completed 30000 requests
Completed 40000 requests
Completed 50000 requests
Completed 60000 requests
Completed 70000 requests
Completed 80000 requests
Completed 90000 requests
Completed 100000 requests
Finished 100000 requests
Server Software: Noelios-Restlet-Engine/1.1.6-SONATYPE-5348-V4
Server Hostname: 10.10.160.243
Server Port: 8080
Document Path: /content/groups/public/org/springframework/spring/2.5.6/spring-2.5.6-sources.jar
Document Length: 3169452 bytes
Concurrency Level: 512
Time taken for tests: 369.190 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Total transferred: 316999309694 bytes
HTML transferred: 316954708356 bytes
Requests per second: 270.86 [#/sec] (mean)
Time per request: 1890.253 [ms] (mean)
Time per request: 3.692 [ms] (mean, across all concurrent requests)
Transfer rate: 838510.33 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 1 10 1.8 10 64
Processing: 266 1879 77.4 1875 2732
Waiting: 8 17 44.9 12 849
Total: 276 1889 77.6 1885 2745
Percentage of the requests served within a certain time (ms)
50% 1885
66% 1897
75% 1905
80% 1911
90% 1926
95% 1947
98% 2022
99% 2184
100% 2745 (longest request)
maven客户端配置
修改${M2_HOME}/conf/setting.xml文件
里面mirrors里的节点
<mirror>
<id>nexus</id>
<mirrorOf> * </mirrorOf>
<url>http://nexus.mgt.pangu365.com/content/groups/public/</url>
</mirror>