nGrinder性能测试平台搭建(LVS压力测试)
1、?nGrinder是什么
nGrinder是一個免費的、開放源代碼的Web性能測試平臺。運行在應用中間件服務器中運行。它由一個控制端和多個代理端組成。通過控制端(瀏覽器訪問)建立測試場景,然后通過分發到代理端進行壓力測試,是一個分布式的測試場景。
測試過程是基于Jython腳本來模擬瀏覽器或其他終端使用HTTP協議訪問站點來完成的。測試過程中采集的數據將通過動態圖和數據表的形式展示出來。用戶可以方便的看到tps、以及測試目標機器的cpu和內存等情況。
??nGrinder依賴的其他開源項目:
??Grinder一個開源的Java負載測試框架,它通過很多負載注射器來為分布式測試提供了便利。支持用于執行測試腳本的Jython腳本引擎。
???Cubrid是一個全面開源,且完全免費的關系數據庫管理系統。CUBRID為高效執行Web應用進行了高度優化,特別是需要處理大數據量和高并發請求的復雜商務服務。通過提供獨特的最優化特性,CUBRID可以支持更多的并發請求,更少的響應時間。
???Jython是一種完整的語言,而不是一個Java翻譯器或僅僅是一個Python編譯器,它是一個Python語言在Java中的完全實現。 Jython也有很多從CPython中繼承的模塊庫。最有趣的事情是Jython不像CPython或其他任何高級語言,它提供了對其實現語言的一切存 取。所以Jython不僅給你提供了Python的庫,同時也提供了所有的Java類。這使其有一個巨大的資源庫。
???Spring是一個開源框架,是為了解決企業應用程序開發復雜性由Rod Johnson創建的??蚣艿闹饕獌瀯葜痪褪瞧浞謱蛹軜?#xff0c;分層架構允許使用者選擇使用哪一個組件,同時為 J2EE 應用程序開發提供集成的框架。Spring使用基本的JavaBean來完成以前只可能由EJB完成的事情。然而,Spring的用途不僅限于服務器端的 開發。從簡單性、可測試性和松耦合的角度而言,任何 Java應用都可以從Spring中受益。
2、?windows平臺的nGrinder配置
2.1 前提條件
nGrinder下在:http://sourceforge.net/projects/ngrinder/files/ngrinder-3.2.3/。本次演示使用了tomcat因此需要下載ngrinder-controller-3.2.3-with-tomcat.zip和ngrinder-core-3.2.3-agent-package.zip。
jdk1.6:下載地址http://www.java.net/download/jdk6/6u10/promoted
/b32/binaries/jdk-6u10-rc2-bin-b32-windows-i586-p-12_sep_2008.exe
tomcat 6 下載地址:http://tomcat.apache.org/
2.2 配置控制端
安裝jkd1.6和tomcat 在這就不再累述,配置JAVA_HOME和JRE_HOME,放到系統環境變量的最前面。然后將ngrinder-controller-3.2.3- with-tomcat.zip加壓縮后,放入webapps文件夾下,運行該文件夾下的 startup.bat。將如下圖啟動成功:
在瀏覽器中輸入http://localhost:8080/ ngrinder-controller ,進入登錄頁面,輸入用戶名密碼(用戶名admin,密碼admin),進入系統,點擊右上角admin下拉菜單,選擇系統配置,如下圖所示:
?
?
修改配置如下:| # Set verbose to print the detailed log #verbose=true # testmode makes some several constraints not applied. # if testmode is true, security and pluginsupport is disabled. #testmode=false # true if enabling security manager. The default value is false #security=true # false if disabling ngrinder usage report. it will send host ip and executed tests number to Goolge Analytics. # The default value is true #usage.report=false # true if the plugin is enabled. # This is not the option applied on the fly. You need to restart the controller. #pluginsupport=true # false if you want to make the user profile fields not mandatory. # Default value is true. #user.security=false # the maximum number of agents which can be attached into one test. #agent.max.size=10 # the maximum number of vusers which can be initiated per one agent #agent.max.vuser=2000 # the maximum runcount of test per one agent #agent.max.runcount=10000 # the maximum running hour of one test. #agent.max.runhour=8 # the listener port of monitor. monitor.listen.port=13243 #provide the base URL of the ngrinder. #ngrinder.http.url= # the starting port number of consoles which will be mapped to each test. # This is not the option applied on the fly. You need to reboot to apply this. #ngrinder.console.portbase=12000 # the port number for the agent connection. ngrinder.agent.control.port=8088 # The count of allowed concurrent tests. #ngrinder.max.concurrenttest=10 # How many milliseconds console will wait until all agents are connected. #ngrinder.max.waitingmilliseconds=5000 # select the ip for controller to use. ngrinder.controller.ipaddress=192.168.68.134 # validation timeout in the unit of sec. #ngrinder.validation.timeout=100 # To be compatible with old agents (before 3.1.1), please set following to true. # If you use the latest version agent, just set it false. ngrinder.dist.logback=false # From 3.1.1, nGrinder doesn't check the file distribution result to speed up the test execution. # If your agent is located in the far places or you distribute big files everyday, you'd better to change this to true. ngrinder.dist.safe=false # If some region has the slow network, it may need the safe distribution by force #ngrinder.dist.safe.region= # Set the safe distribution threshold to enable safe distribution for specific transfer size by force. # ngrinder.dist.safe.threshold=1000000 # You can point your own rss page on the ngrinder first page. #ngrinder.frontpage.rss=http://www.cubrid.org/wiki_ngrinder/rss # If you want to provide your own custom help page. please modify this #ngrinder.help.url=http://www.cubrid.org/wiki_ngrinder/entry/user-guide # language default en/kr/cn is available. #ngrinder.langauge.default=en # The monitor port is configurable. The default port is 13243. #monitor.listen.port=13243 ###################################################################################### # clustering configuration. # This is not the option applied on the fly. You need to reboot to apply this. ###################################################################################### # These should be very carefully set. # You can refer http://www.cubrid.org/wiki_ngrinder/entry/controller-clustering-guide # if you want to enable ngrinder controller clustering. please enable below. #ngrinder.cluster.mode=false # cache cluster uri of all clustered controller servers. #ngrinder.cluster.uris=192.168.1.1;192.168.2.2;192.168.3.3 # cache cluster listener port. #ngrinder.cluster.listener.port=40003 # region setting of this controller. # When running ngrinder as cluster mode, the ${NGRINDER_HOME} should be shared by multiple controllers. # We expect this to be done by running ${NGRINDER_HOME} on NFS. # However this option is not to set here. Because each controller in cluster must have system-ex.conf # which should be stored in ${NGRINDER_EX_HOME} in the local so that each node cluster looks different value.? # Please locate followings this on the ${NGRINDER_EX_HOME}(by default .ngrinder_ex)/system-ex.conf # ngrinder.cluster.region=Beijing |
?
2.3 配置代理端
? 將ngrinder-core-3.2.3-agent-package.zip解壓,建立環境變量NGRINDER_AGENT_HOME,變量值為C:\DOCUME~1\ADMINI~1\.grinder_agent。
?運行代理文件夾下的startuo.bat后,進入C:\Documents and Settings\Administrator\.ngrinder_agent,修改agent.conf如下:
?
| #start.mode=monitor #monitor.listen.port=13243 # If you want to monitor bind to the different local ip not automatically selected ip. Specify below field. #monitor.host=hostname_or_ip start.mode=agent agent.console.ip=192.168.68.134 agent.console.port=8088 #agent.region= #agent.hostid= #agent.servermode=true # provide more agent java execution option if necessary. #agent.javaopt= # set following false if you want to use more than 1G Xmx memory per a agent process. #agent.useXmxLimit=true #agent.same.console.host=true # please uncomment the following option if you want to send all logs to the controller. #agent.send.all.logs=true |
其中agent.console.ip為控制端ip,agent.console.port為控制端監聽端口。
3、?應用
啟動nGrinder控制端和代理端,通過http://localhost:8080/ ngrinder-controller 進入登錄頁輸入用戶名密碼,進入nGrinder平臺。在快速測試的url地址框中輸入www.cstc.org.cn,點擊開始測試。進入如下頁面:
?
在代理里面輸入1,虛擬用戶中點擊右側 按鈕,輸入2個進程,5可形成后,點擊右上角的保存并開始測試,測試開始了
等待測試結束后,可以對其進行一下結果的導出等操作。
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的nGrinder性能测试平台搭建(LVS压力测试)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MyEclipse 2014中 Wi
- 下一篇: Tomcat内存设置详解