[关闭]
@maorongrong 2015-05-18T12:14:33.000000Z 字数 3350 阅读 682

TPC_W容器测试前配置及测试命令

docker TPC_W 毕设


TPC_W中测试相关配置

更改TPCW_Database.java中代码,而重新编译运行

  1. [root@f953c5a06d2d servlets]# pwd
  2. /root/tpcw1.0/servlets
  3. [root@f953c5a06d2d servlets]# rm TPCW_Database.java
  4. rm: remove regular file 'TPCW_Database.java'? y
  5. [root@f953c5a06d2d servlets]# cp /usr/aaa/TPCW_Database.java .
  6. (这里的TPCW_Database.java放在164主机C:\Users\123\Desktop\环\TPC_W\要改的java文件下,名字为TPCW_Database(new))
  7. [root@f953c5a06d2d servlets]# source /etc/profile
  8. [root@f953c5a06d2d servlets]# javac *.java
  9. Note: Some input files use or override a deprecated API.
  10. Note: Recompile with -Xlint:deprecation for details.
  11. Note: Some input files use unchecked or unsafe operations.
  12. Note: Recompile with -Xlint:unchecked for details.
  13. [root@f953c5a06d2d servlets]# cd /usr/local/apache-tomcat-8.0.20/webapps/servlet/WEB-INF/classes/
  14. [root@f953c5a06d2d classes]# rm -f *.class
  15. [root@f953c5a06d2d classes]# ll
  16. total 0
  17. [root@f953c5a06d2d classes]# pwd
  18. /usr/local/apache-tomcat-8.0.20/webapps/servlet/WEB-INF/classes
  19. [root@f953c5a06d2d classes]# cd -
  20. /root/tpcw1.0/servlets
  21. [root@f953c5a06d2d servlets]# pwd
  22. /root/tpcw1.0/servlets
  23. [root@f953c5a06d2d servlets]# cp *.class /usr/local/apache-tomcat-8.0.20/webapps/servlet/WEB-INF/classes/
  24. [root@f953c5a06d2d servlets]# cd -
  25. /usr/local/apache-tomcat-8.0.20/webapps/servlet/WEB-INF/classes
  26. [root@f953c5a06d2d classes]# ll
  27. total 180

Linux 下面 Mysql的默认最大连接数是150,如果需要更大的连接数 ,需要在 Mysql/bin/mysql_safe中加上 :-O max_connections=1000

  1. [root@f953c5a06d2d classes]# service mysqld start
  2. Starting mysqld: [ OK ]
  3. [root@f953c5a06d2d classes]# mysql -uroot -proot(show variables;)
  4. [root@f953c5a06d2d classes]# vi /etc/my.cnf
  5. max_connections=1000

Tomcat 中8080端口的最大连接数是l00如果测试需要设置大于100的EB数,需要把其配置文件
server.xml( Server.xml--文件位置是<%CATALINA_HOME%>/conf/server.xml) 中 8080 端 口 的 maxProessors 和 acceptCount 同时增大,Linux 系统下 最大可以设置为 1000。

  1. [root@f953c5a06d2d conf]# vi server.xml
  2. <Connector port="8080" protocol="HTTP/1.1"
  3. maxThreads="1000"
  4. minSpareThreads="200"
  5. maxSpareThreads="600"
  6. acceptCount="200"
  7. connectionTimeout="30000"
  8. redirectPort="8443" />
  9. [root@f953c5a06d2d ~]# service mysqld start
  10. Starting mysqld: [ OK ]
  11. [root@f953c5a06d2d ~]# cd /usr/local/apache-tomcat-8.0.20/bin/
  12. [root@f953c5a06d2d bin]# ./catalina.sh run

更改tpcw1.0/rbe/EB.java后重新编译

  1. [root@492c7fa1734d rbe]# cd util/
  2. [root@492c7fa1734d util]# javac *.java
  3. [root@492c7fa1734d util]# cd ../args/
  4. [root@492c7fa1734d args]# mkdir -p rbe/util
  5. [root@492c7fa1734d args]# cp ../util/*.class rbe/util/
  6. [root@492c7fa1734d args]# mkdir rbe/args
  7. [root@492c7fa1734d args]# javac *.java
  8. Note: ArgDB.java uses unchecked or unsafe operations.
  9. Note: Recompile with -Xlint:unchecked for details.
  10. [root@492c7fa1734d args]# cp *.class rbe/args/
  11. [root@492c7fa1734d args]# mv rbe ../
  12. [root@492c7fa1734d args]# cd ..
  13. [root@492c7fa1734d rbe]# javac *.java

测试运行命令

  1. SUT容器 root用户)
  2. 启动容器
  3. sudo docker run -ti -P --name tpcw6 498ce0fd59b7 /bin/bash
  4. 498ce0fd59b7tpcw:good
  5. 容器设置
  6. source /etc/profile & service mysqld start
  7. ./usr/local/apache-tomcat-8.0.20/bin/catalina.sh run
  8. 容器性能
  9. sudo docker stats tpcw1 tpcw2 tpcw3 tpcw4 tpcw5 tpcw6 tpcw7 tpcw8 > 8sets
  10. (更简单的方法)
  11. #docker stats `docker ps -q` > data_performance (将当前容器性能数据导入文件中)
  12. TEST容器(amy用户)
  13. 启动容器
  14. sudo docker run -ti -P --name console5 -v /home/amy/console5:/usr/aaa 66b12bb65dd7 /bin/bash
  15. 容器设置
  16. source /etc/profile & cd ~/tpcw1.0/
  17. java rbe.RBE -EB rbe.EBTPCW1Factory 100 -OUT test_console1.m -RU 100 -MI 500 -RD 100 -WWW http://202.117.16.187:49168/ -CUST 10000 -ITEM 10000
  18. (test_console1.mconsole5中的数字、http://202.117.16.187:49168/的端口号都要每次更改)
  19. 主机性能数据收集
  20. 原文链接:http://www.huacolor.com/article/5765.html(代码已经记录在印象笔记里面了)
  21. 使用方法:新建两个java文件 LinuxSystemTool.java JaverTest.java
  22. 内容如下,注意两个文件是用虚线隔开的。编译运行就可以了。但是linux主机必须安装了jdk
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注