非GUI模式压测(NON-GUI模式)结果解析TPS

准备工作

  1. 从脚本已录制成功之后开始进行压测
  2. 安装Jmeter拓展插件 查看 Transactions per Second https://jmeter-plugins.org/wiki/TransactionsPerSecond/       ←插件地址
  3. 在压测前先安装 Nmon监控工具在服务器linux性能监控分析及通过nmon_analyse生成分析报

安装 TPS教程

解压安装

将 jpgc-graphs-basic-2.0.zip 解压缩后只有一个 lib 目录,该目录下有一个 ext 文件夹和一个 jmeter-plugins-cmn-jmeter-0.3.jar 包,ext 文件夹中有 jmeter-plugins-graphs-basic-2.0.jar 和 jmeter-plugins-manager-0.10.jar 包。
将 lib 目录下的 jmeter-plugins-cmn-jmeter-0.3.jar 拷贝到 %JMeter%/lib 目录下,将 ext 目录下的 jmeter-plugins-graphs-basic-2.0.jar 和 jmeter-plugins-manager-0.10.jar 拷贝到 %JMeter%/lib/ext 目录下,重启 JMeter,发现已经支持 TPS、TRT 等视图了:

TPS导入解析测试报告

导入之后就可以看到 TPS数据了

取至Jmeter官方文档

1.0.2 Load Test running

Once your Test Plan is ready, you can start your Load Test. The first step is to configure the injectors that will run JMeter, this as for any other Load Testing tool includes:

  • Correct machine sizing in terms of CPU, memory and network
  • OS Tuning
  • Java setup: Ensure you install the latest version of Java supported by JMeter
  • Correct sizing of Java Heap. By default JMeter runs with a heap of 512MB, this might not be enough for your test and depends on your test plan and number of threads you want to run

Once everything is ready, you will use Command-line mode (called Non-GUI mode) to run it for the Load Test.

Don't run load test using GUI mode !
不要使用GUI模式运行负载测试!因为GUI模式的话会占用比较大的内存空间,并发数量上不去等等的问题

Using Non-GUI mode, you can generate a CSV (or XML) file containing results and have JMeter generate an HTML report at end of Load Test. JMeter will by default provide a summary of load test while it's running.

You can also have real-time results during your test using Backend Listener.
NON-GUI模式允许得到结果后可以在后端监听器的测试期间获得实时结果。这句话如何理解呢,见上面“TPS导入解析测试报告”

Running JMeter

To run Apache JMeter in NON_GUI

直接进入脚本路径,输入 Jmeter的启动路径

可以查看到Jmeter的相关命令帮助

C:\Users\lamw\Desktop\lamw
λ D:\Jmeter\jmeter-3.1\bin\jmeter -h

---------------------------------------------------

上面包含了一些参数 可以输入 -l  查看

C:\Users\lamw\Desktop\lamw
λ D:\Jmeter\jmeter-3.1\bin\jmeter -l
Usage
--?
print command line options and exit
-h, --help
print usage information and exit
-v, --version
print the version information and exit
-p, --propfile <argument>
the jmeter property file to use
-q, --addprop <argument>
additional JMeter property file(s)
-t, --testfile <argument>
the jmeter test(.jmx) file to run
-l, --logfile <argument>
the file to log samples to
-j, --jmeterlogfile <argument>
jmeter run log file (jmeter.log)
-n, --nongui
run JMeter in nongui mode
-s, --server
run the JMeter server
-H, --proxyHost <argument>
Set a proxy server for JMeter to use
-P, --proxyPort <argument>
Set proxy server port for JMeter to use
-N, --nonProxyHosts <argument>
Set nonproxy host list (e.g. *.apache.org|localhost)
-u, --username <argument>
Set username for proxy server that JMeter is to use
-a, --password <argument>
Set password for proxy server that JMeter is to use
-J, --jmeterproperty <argument>=<value>
Define additional JMeter properties
-G, --globalproperty <argument>=<value>
Define Global properties (sent to servers)
e.g. -Gport=123
or -Gglobal.properties
-D, --systemproperty <argument>=<value>
Define additional system properties
-S, --systemPropertyFile <argument>
additional system property file(s)
-L, --loglevel <argument>=<value>
[category=]level e.g. jorphan=INFO or jmeter.util=DEBUG
-r, --runremote
Start remote servers (as defined in remote_hosts)
-R, --remotestart <argument>
Start these remote servers (overrides remote_hosts)
-d, --homedir <argument>
the jmeter home directory to use
-X, --remoteexit
Exit the remote servers at end of test (non-GUI)
-g, --reportonly <argument>
generate report dashboard only, from a test results file
-e, --reportatendofloadtests
generate report dashboard after load test
-o, --reportoutputfolder <argument>
output folder for report dashboard

下面我们就采用 NON_GUI模式执行脚本 如下:(每次执行脚本之前都要把jtl文件删除,report文件夹清空!不然会报错)

--------------------------------------------------

To run Apache JMeter in NON_GUI mode and generate a report at end :
Open a command prompt (or Unix shell) and type: jmeter.bat(Windows)/jmeter.sh(Linux) -n -t test-file [-p property-file] [-l results-file] [-j log-file] -e -o [Path to o
utput folder] --------------------------------------------------
输入以下命令直接执行录制好的脚本文件

D:\Jmeter\apache-jmeter-5.0\apache-jmeter-5.0\jm> #先进入测试脚本所在的文件目录 
D:\Jmeter\apache-jmeter-5.0\apache-jmeter-5.0\jm>jmeter -n -t Script.jmx -l result.jtl -e -o D:\Jmeter\apache-jmeter-5.0\apache-jmeter-5.0\jm\report
Script.jmx 是脚本名称
result.jtl 是压测生成的中间件,可以在jmeter中打开
D:\Jmeter\apache-jmeter-5.0\apache-jmeter-5.0\jm\report  是测试报告的路径
 
 

运行脚本进行压测

当然,在运行脚本进行压测的时候 需要在服务器 先执行 采集命令

ps -ef | grep nmon 查看采集数据的进程

[root@lamw /home/lam7/nmon]# ps -ef | grep nmon

[root@lamw /home/lam7/nmon]# nmon -f -s 1 -c 60

-f 表示生成的数据文件名中有时间;

-t 输出中包括占用率较高的进程;

-s 1 表示每 1 秒采集一次数据;

-c 60 表示采集 60 次,1s*60=60秒;

至于监控的方式可以查看上面所讲的准备工作第三点。

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.

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.

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

  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.30.50:1099, …, 192.168.30.51:1099,the entry would like like this

:

  1. Start JMeter.
  2. Open the test plan you want to use

Start a single clients

  1. Click Run at the top
  2. Select Remote Start
  3. Select the IP address

Start all clients

  1. Click Run at the top
  2. Select Remote Start all or use Ctrl + Shift + R

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 trafic 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.

简单点的说

Jmeter分布式执行原理:

  1、Jmeter分布式测试时,选择其中一台作为调度机(master),其它机器做为执行机(slave)。

  2、执行时,master会把脚本发送到每台slave上,slave 拿到脚本后就开始执行,slave执行时不需要启动GUI,我理解它应该是通过命令行模式执行的。

  3、执行完成后,slave会把结果回传给master,master会收集所有slave的信息并汇总。

术语解析

  • master,以GUI模式运行,同时控制测试的运行,在这里就是client,启动脚本所在的那台机器。
  • slave,运行jmeter-server并从master接收指令、向目标服务器发送请求
  • 设置jmeter-server:

    用文本编辑器打开Jmeter/bin目录下的jmeter.properties文件,添加运行jmeter-server的主机IP到remote_hosts

remote_hosts=192.168.30.50:1099,192.168.30.51:1099,localhost.....

小白解释分割线

----------------------------------------------------------

再白痴点的解释就是   有 A B C  三台压力机器,属于同一个内网IP

A作为 Master

B跟C两台作为slave

通过A去控制B跟C进行压测服务器
在压测的过程中 需要先开启B跟C的Jmeter的bin目录下的jmeter-server.bat 服务

然后通过A去进行NON-GUI模式去压测,B跟C分布式的压测结果会反馈到A

-----------------------------------------------------------

小白解释结束线

下面进行实战命令 压测

通过 jmeter -l 的帮助命令可以查看到

C:\Users\lamw\Desktop\lamw
λ D:\Jmeter\jmeter-3.1\bin\jmeter -l
Error: Missing argument to option -l
Usage
--?
print command line options and exit
-h, --help
print usage information and exit
-v, --version
print the version information and exit
-p, --propfile <argument>
the jmeter property file to use
-q, --addprop <argument>
additional JMeter property file(s)
-t, --testfile <argument>
the jmeter test(.jmx) file to run
-l, --logfile <argument>
the file to log samples to
-j, --jmeterlogfile <argument>
jmeter run log file (jmeter.log)
-n, --nongui
run JMeter in nongui mode
-s, --server
run the JMeter server
-H, --proxyHost <argument>
Set a proxy server for JMeter to use
-P, --proxyPort <argument>
Set proxy server port for JMeter to use
-N, --nonProxyHosts <argument>
Set nonproxy host list (e.g. *.apache.org|localhost)
-u, --username <argument>
Set username for proxy server that JMeter is to use
-a, --password <argument>
Set password for proxy server that JMeter is to use
-J, --jmeterproperty <argument>=<value>
Define additional JMeter properties
-G, --globalproperty <argument>=<value>
Define Global properties (sent to servers)
e.g. -Gport=123
or -Gglobal.properties
-D, --systemproperty <argument>=<value>
Define additional system properties
-S, --systemPropertyFile <argument>
additional system property file(s)
-L, --loglevel <argument>=<value>
[category=]level e.g. jorphan=INFO or jmeter.util=DEBUG
-r, --runremote
Start remote servers (as defined in remote_hosts)
-R, --remotestart <argument>
Start these remote servers (overrides remote_hosts)
-d, --homedir <argument>
the jmeter home directory to use
-X, --remoteexit
Exit the remote servers at end of test (non-GUI)
-g, --reportonly <argument>
generate report dashboard only, from a test results file
-e, --reportatendofloadtests
generate report dashboard after load test
-o, --reportoutputfolder <argument>
output folder for report dashboard Error: Missing argument to option -l

其中

-r, --runremote    

Start remote servers (as defined in remote_hosts)------------------启动远程服务器(如remote_hosts中定义)
-R, --remotestart <argument>
Start these remote servers (overrides remote_hosts)-------------------启动这些远程服务器(覆盖remote_hosts)

那么我们就可以去选择执行所有的配置中的压测机器

D:\Jmeter\jmeter-3.1\bin\jmeter.bat -n -r -t test.jmx -l test.csv -e -o test

可以看到已经成功执行了配置中的2台压测机

PS 如果压测指标是1000并发数,比如我们现在配置了2台需要达到1000并发数,那么就是一台压测并发数500即可

原文地址:https://www.cnblogs.com/Lam7/p/6830449.html

https://www.cnblogs.com/Lam7/p/6833501.html

Jmeter(一)非GUI模式压测(NON-GUI模式)结果解析TPS的更多相关文章

  1. Jmeter之http性能测试实战 非GUI模式压测 NON-GUI模式 结果解析TPS——干货(十一)

    性能测试计划 性能测试用例 录制脚本 性能测试结果 性能测试报告 性能测试监控报告 准备工作 从脚本已录制成功之后开始进行压测 安装Jmeter拓展插件 查看 Transactions per Sec ...

  2. JMeter-命令行模式压测

    前言 使用非GUI模式,即命令行模式运行jmeter测试脚本能够大大缩减系统资源,今天跟小伙伴们讲一下JMeter如何在命令行模式进行压测吧! 一:配置好JDK和JMeter的环境变量(过程略) 二: ...

  3. JMeter在linux上分布式压测步骤(二)

    哈喽,我又来了~ 前提:三台linux虚拟机,一台作为master,另外两台作为slave. 一.server端 1.修改1099端口,client和server通信的端口,可以不修改,默认就是109 ...

  4. jmeter针对websocket协议的压测

    之前一直没有接触过websocket协议,所以一直对websocket的压测存在疑惑,在网上参考文章并不断尝试之后,终于有所得:第一次用jmeter的websoket插件,用的ws非加密协议,请求都能 ...

  5. Jmeter安装与使用(压测)

    一.介绍 Apache JMeter是100%纯JAVA桌面应用程序,被设计为用于测试客户端/服务端结构的软件(例如web应用程序).它可以用来测试静态和动态资源的性能,例如:静态文件,Java Se ...

  6. SwingBench 字符模式压测最佳实践

    之前写过<使用SwingBench 对Oracle RAC DB性能 压力测试>,使用的是最基础直观的图形模式,已经可以满足大多数需求. 但是在有些场景下,图形模式可能本身消耗资源过大,尤 ...

  7. my31_MGR单写模式压测以及对比普通从库记录

    场景MGR单写模式三节点,db46写节点,db47/db48为读节点工具sysbencn.压测15个小时,db46上18线程纯写,12线程oltp混合测试,db48上12线程select在压测2个小时 ...

  8. Jmeter(十三)阶梯式压测

    阶梯式压测,就是对系统的压力呈现阶梯性增加的过程,每个阶段压力值都要增加一个数量值,最终达到一个预期值.然后保持该压力值,持续运行一段时间. Jmeter中有个插件可以实现这个场景,这个插件就是:Co ...

  9. jmeter实现SMTP邮件协议压测

    实现目的 通过jmeter的SMTP取样器,调用SMTP协议,批量进行邮件的发送,已达到压测的目的. 脚本实现 User Defined Variables定义用户变量 编辑SMTP Sampler取 ...

随机推荐

  1. selenium3.0不兼容火狐的解决方案

    当直接调用火狐出现不兼容错误时,如何解决? 详看Message中提示:Expected browser binary location,but unable to find binary in def ...

  2. @ResponseBody使用

    @responseBody注解的作用是将controller的方法返回的对象通过适当的转换器转换为指定的格式之后,写入到response对象的body区,通常用来返回JSON数据或者是XML 数据,需 ...

  3. [转帖]如何禁止VirtualBox虚拟机和物理机之间的时间同步

    如何禁止VirtualBox虚拟机和物理机之间的时间同步 乐者为王 2014-11-02 706 阅读   http://ju.outofmemory.cn/entry/97301 验证了下 修改注册 ...

  4. 学习Elasticsearch原理笔记

    Elasticsearch是一个分布式可拓展的实时搜索和分析引擎 分布式实时文件存储,并将每一个字段都编入索引,使其可以被搜索 实时分析的分布式搜索引擎 可以拓展到上百台服务器,处理PB级别的结构化或 ...

  5. PHP和Memcached - Memcached的介绍及常用命令

    1.什么是Memcached 自由开源的,高性能,分布式内存对象缓存系统,分布式是基于客户的缓存系统,服务器之间是不相互通讯的. 2.Memcached的使用场景 储存session. 缓存数据. 解 ...

  6. 希尔排序——C语言

    希尔排序 希尔排序是插入排序的一种,又称“缩小增量排序”,希尔排序是直接插入排序算法的一种更高效的改进版本,关于插入排序可以看下这篇随笔:插入排序——C语言 (图片来源:https://www.cnb ...

  7. C++ 中不能声明为虚函数的函数有哪些?

    目录 普通函数 构造函数 内联成员函数 静态成员函数 友元函数 普通函数 普通函数(非成员函数)只能被overload,不能被override,而且编译器会在编译时绑定函数. 多态的运行期行为体现在虚 ...

  8. php底层变量存储

    变量存储 php的变量使用一个结构体 zval来保存的,在Zend/zend.h中我们可以看到zval的定义 struct _zval_struct { /* Variable information ...

  9. 怎样在网页中嵌入JS代码

    有四种方法: 方法1: 在<script>标签内直接写代码 <body> <button id="btn">click</button&g ...

  10. 怎样通过混入(Mixin)实现多继承

    js不提供现成的多重继承的方法, 但可以通过Object.assign()来手动实现: function Father1(name){ this.name = name; } function Fat ...