jmeter工具下載及工具功能操做介紹

 本博文jmeter介紹的是在windows下使用,linux後期看狀況更新,謝謝html

 

簡單介紹,想更多瞭解的去官方,多的很:java

The Apache JMeter™ application is open source software, a 100% pure Java application designed to load test functional behavior and measure performance. It was originally designed for testing Web Applications but has since expanded to other test functions.linux

What can I do with it?

Apache JMeter may be used to test performance both on static and dynamic resources, Web dynamic applications. 
It can be used to simulate a heavy load on a server, group of servers, network or object to test its strength or to analyze overall performance under different load types.web

Apache JMeter features include:shell

    • Ability to load and performance test many different applications/server/protocol types:
      • Web - HTTP, HTTPS (Java, NodeJS, PHP, ASP.NET, …)
      • SOAP / REST Webservices
      • FTP
      • Database via JDBC
      • LDAP
      • Message-oriented middleware (MOM) via JMS
      • Mail - SMTP(S), POP3(S) and IMAP(S)
      • Native commands or shell scripts
      • TCP
      • Java Objects
    • Full featured Test IDE that allows fast Test Plan recording (from Browsers or native applications), building and debugging.
    • CLI mode (Command-line mode (previously called Non GUI) / headless mode) to load test from any Java compatible OS (Linux, Windows, Mac OSX, …)
    • A complete and ready to present dynamic HTML report
    • Easy correlation through ability to extract data from most popular response formats, HTMLJSON XML or any textual format
    • Complete portability and 100% Java purity.
    • Full multi-threading framework allows concurrent sampling by many threads and simultaneous sampling of different functions by separate thread groups.
    • Caching and offline analysis/replaying of test results.
    • Highly Extensible core:
      • Pluggable Samplers allow unlimited testing capabilities.
      • Scriptable Samplers (JSR223-compatible languages like Groovy and BeanShell)
      • Several load statistics may be chosen with pluggable timers.
      • Data analysis and visualization plugins allow great extensibility as well as personalization.
      • Functions can be used to provide dynamic input to a test or provide data manipulation.
      • Easy Continuous Integration through 3rd party Open Source libraries for Maven, Gradle and Jenkins.

 

 建議軟件你們都從官方下載,最新版,安全可靠值得信賴apache

基礎瞭解完了,開始下載吧,jmeter是純java的程序,須要java環境才能使用,因此先下載一個jdkwindows

java的官方直接下載https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html安全

 

jmeter官方直接下載:https://jmeter.apache.org/download_jmeter.cgi服務器

一、點擊下載oracle

二、下載二進制的zip:

別問其餘的是幹啥的,我也不知道,下載zip就對了

下載完以後進行解壓 ,解壓以後是這個包:

不須要安裝,解壓以後直接使用,下面介紹一下每一個文件夾的做用,爲啥介紹,那確定有用,萌新銘記呦

一、backups :備份,jmeter項目腳本

二、bin : 啓動文件和配置文件

  (1)、ApacheJMeter.jar 啓動文件

  (2)、jmeter.bat cmd 啓動文件,後臺會開一個cmd窗口

  (3)、jmeter.sh linux 啓動文件

  (4)、jmeter.properties 系統配置文件

  (5)、jmeter-server.bat windows 分佈式測試 服務器配置

  (6)、jmeter-server linux 分佈式測試 服務器配置

三、docs : 接口文檔目錄

四、extras : 擴展插件目錄

五、lib : 用到的插件目錄,裏面都是jar包,jmeter使用過程當中會在lib和extras目錄下尋找須要的類

六、licenses : 證書目錄

七、printable_docs : 用戶使用手冊,你們自學不懂的時候也能夠看裏面文檔  (有不懂得能夠多看看,挺不錯的,雖然版本有點老)

 

一、性能基本知識  -  先大概過一遍每一個插件的大概含義,下面再開始進行性能或接口測試,請看另外博文

測試片斷 - 控制器上的一個特殊的線程組,和線程組是一個層級,可是他是不被主動執行的 ,除非它是一個模塊控制器或者是被控制器引用纔會執行

 

配置元件 - 用於對靜態數據配置的支持 ,如CSV,Data ,config能夠將本地數據文件造成數據池

 

定時器 -  操做之間設置等待時間 ,多種類型定時器,後面可能會用到

前置處理器 - 用於實際的請求發出以前對即將發出的請求進行特殊處理,如HTTP ,URl 重寫修復符

後置處理器 - 對發出請求後獲得的服務器響應進行處理,通常用來提取響應中的特定數據

斷言 - 用於檢測測試中獲得的相應數據是否等於預期結果,設置檢查點 ,若是沒有知足斷言則是失敗case

監聽器 - 用來對測試結果進行處理和可視化展現的一系列, 圖形結果,查看結果樹,聚合報告,都是經常使用的

 取樣器 - 向服務器發送請求,根據不用協議有不用的取樣器

邏輯控制器 - 2類 ,一類是用於控制test plan中sampler節點發送請求的邏輯順序的控制器,一類是用來組織可控制sampler節點的!

 

 

 

 

 

用戶使用手冊裏的分佈式測試:

25. Apache JMeter Distributed Testing Step-by-step

This short tutorial explains how to use multiple systems to perform stress testing. Before we start, there are a couple of things to check.

  • the firewalls on the systems are turned off or correct ports are opened.
  • all the clients are on the same subnet.
  • the server is in the same subnet, if 192.x.x.x or 10.x.x.x IP addresses are used. If the server doesn't use 192.xx or 10.xx IP address, there shouldn't be any problems.
  • Make sure JMeter can access the server.
  • Make sure you use the same version of JMeter and Java on all the systems. Mixing versions will not work correctly.
  • You have setup SSL for RMI or disabled it.

Once you've made sure the systems are ready, it's time to setup remote testing. The tutorial assumes you already have JMeter installed on all the systems. The way JMeter works is one master controller initiates the test on multiple slave systems.

 

In this tutorial we use GUI Mode just for demonstration. In real life you should use CLI mode (NON GUI) to start your load test

 


One master controls multiple slaves
25.1 Terminology

Before we dive into the step-by-step instructions, it's a good idea to define the terms and make sure the definition is clear.

Master
the system running JMeter GUI, which controls the test
Slave
the system running  jmeter-server, which takes commands from the GUI and send requests to the target system(s)
Target
the webserver we plan to stress test

Categories of systems
 
25.2 Step-by-Step
  1. On the slave systems, go to jmeter/bin directory and execute jmeter-server.bat (jmeter-server on unix).
  2. On master system acting as the console, open windows explorer and go to jmeter/bin directory
  3. Open jmeter.properties in a text editor
  4. Edit the line remote_hosts=127.0.0.1
  5. Add the IP address. For example, if I have JMeter server running on 192.168.0.10, …, 192.168.0.15, the entry would like like this:
    remote_hosts=192.168.0.10,192.168.0.11,192.168.0.12,192.168.0.13,192.168.0.14
  6. Start JMeter.
  7. Open the test plan you want to use

Simple test plan
 
25.2 Starting the Test

At this point, you are ready to start load testing. If you want to double check the slave systems are working, open jmeter.log in your editor. You should see the following in the log.

Writing log file to: /XXXX/XXXXX/bin/jmeter-server.log
Created remote object: UnicastServerRef [liveRef: [endpoint:[192.X.X.X:XXXXX](local),objID:[-6a665beb:15a2c8b9419:-7fff, 3180474504933847586]]]

If you do not see this message, it means jmeter-server did not start correctly. For tips on debugging the issue, go to the tips section. There are two ways to initiate the test: a single system and all systems.

 
25.3 Start a single clients
  1. Click Run at the top
  2. Select Remote Start
  3. Select the IP address

Start a single slave
 
25.4 Start all clients
  1. Click Run at the top
  2. Select Remote Start all or use Ctrl + Shift + R

Start all slaves
 
25.5 Limitations

There are some basic limitations for distributed testing. Here's the list of the known items in no specific order.

  1. RMI cannot communicate across subnets without a proxy; therefore neither can JMeter without a proxy.
  2. Since version 2.9, JMeter sends all the test results stripping Response data to the controlling console, this allows us to reduce impact on network IO. Ensure you monitor your network traffic so that this traffic does not incur contention
  3. A single JMeter client running on a 2-3 GHz CPU (recent CPU) can handle 1000-2000 threads depending on the type of test.
 
25.6 Additional resources

Wiki page on remote testing

Remote Testing in the user manual

 
25.7 Tips

In some cases, the firewall may still be blocking RMI traffic.

Anti Virus and Firewall

 

Antivirus should be stopped during a Load Test as it can drastically impact timings leading to wrong results.

 

Firewall needs to be stopped from windows services or at least some ports need to be opened.

  1. Open control panel
  2. Open administrative tools
  3. Double click services
  4. Go to down to Symantec anti virus, right click and select stop

Windows firewall

  1. Open network connections
  2. Select the network connection
  3. Right click and select properties
  4. Select advanced tab
  5. Uncheck internet connection firewall

Linux

On Linux, iptables might be turned on by default. For instructions, please refer to the Remote Testing in the user manual

On RedHat (or derivatives), iptables is turned on by default. Execute

service iptables stop
to stop the Linux firewall or ensure you open the correct ports.
相關文章
相關標籤/搜索