Running JMeter,JMeter.bat文件解析20210725

JMeter.bat文件,运行JMeter

https://jmeter.apache.org/usermanual/get-started.html

To run JMeter, run the jmeter.bat (for Windows) or jmeter (for Unix) file. These files are found in the bin directory. After a short time, the JMeter GUI should appear.

GUI mode should only be used for creating the test script, CLI mode (NON GUI) must be used for load testing
There are some additional scripts in the bin directory that you may find useful. Windows script files (the .CMD files require Win2K or later):

jmeter.bat
run JMeter (in GUI mode by default)
jmeterw.cmd
run JMeter without the windows shell console (in GUI mode by default)
jmeter-n.cmd
drop a JMX file on this to run a CLI mode test
jmeter-n-r.cmd
drop a JMX file on this to run a CLI mode test remotely
jmeter-t.cmd
drop a JMX file on this to load it in GUI mode
jmeter-server.bat
start JMeter in server mode
mirror-server.cmd
runs the JMeter Mirror Server in CLI mode
shutdown.cmd
Run the Shutdown client to stop a CLI mode instance gracefully
stoptest.cmd
Run the Shutdown client to stop a CLI mode instance abruptly
The special name LAST can be used with jmeter-n.cmd, jmeter-t.cmd and jmeter-n-r.cmd and means the last test plan that was run interactively.
There are a few environment variables, that can be used to customize the JVM settings for JMeter. An easy way to set those is by creating a file named setenv.bat in the bin directory. Such a file could look like:

rem This is the content of bin\setenv.bat,
rem it will be called by bin\jmeter.bat

set JVM_ARGS=-Xms1024m -Xmx1024m -Dpropname=value
The JVM_ARGS can be used to override JVM settings in the jmeter.bat script and will get set when starting JMeter, e.g.:

jmeter -t test.jmx …
The following environment variables can be defined:

DDRAW
JVM options to influence usage of direct draw, e.g. -Dsun.java2d.ddscale=true. Default is empty.
GC_ALGO
JVM garbage collector options. Defaults to -XX:+UseG1GC -XX:MaxGCPauseMillis=250 -XX:G1ReservePercent=20
HEAP
JVM memory settings used when starting JMeter. Defaults to -Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m
JMETER_BIN
JMeter bin directory (must end in ). Value will have been guessed, when setenv.bat is called.
JMETER_COMPLETE_ARGS
If set indicates, that JVM_ARGS and JMETER_OPTS are to be used, only. All other options like HEAP and GC_ALGO will be ignored. Default is empty.
JMETER_HOME
installation directory. Will be guessed from location of jmeter.bat
JMETER_LANGUAGE
Java runtime options to specify used language. Defaults to: -Duser.language=“en” -Duser.region=“EN”
JM_LAUNCH
Name of the java executable, like java.exe (default) or javaw.exe
JVM_ARGS
Java options to be used when starting JMeter. These will be added last to the java command. Default is empty
Un*x script files; should work on most Linux/Unix systems:

jmeter
run JMeter (in GUI mode by default). Defines some JVM settings which may not work for all JVMs.
jmeter-server
start JMeter in server mode (calls jmeter script with appropriate parameters)
jmeter.sh
very basic JMeter script (You may need to adapt JVM options like memory settings).
mirror-server.sh
runs the JMeter Mirror Server in CLI mode
shutdown.sh
Run the Shutdown client to stop a CLI mode instance gracefully
stoptest.sh
Run the Shutdown client to stop a CLI mode instance abruptly
It may be necessary to set a few environment variables to configure the JVM used by JMeter. Those variables can be either set directly in the shell starting the jmeter script. For example setting the variable JVM_ARGS will override most pre-defined settings, for example

JVM_ARGS="-Xms1024m -Xmx1024m" jmeter -t test.jmx [etc.]
will override the HEAP settings in the script.

To set those variables permanently, you can place them in a file called setenv.sh in the bin directory. This file will be sourced when running JMeter by calling the jmeter script. An example for bin/setenv.sh could look like:

This is the file bin/setenv.sh,

it will be sourced in by bin/jmeter

Use a bigger heap, but a smaller metaspace, than the default

export HEAP="-Xms1G -Xmx1G -XMaxMetaspaceSize=192m"

Try to guess the locale from the OS. The space as value is on purpose!

export JMETER_LANGUAGE=" "
The following environment variables can be defined:

GC_ALGO
Java runtime options to specify JVM garbage collection algorithm. Defaults to -XX:+UseG1GC -XX:MaxGCPauseMillis=250 -XX:G1ReservePercent=20
HEAP
Java runtime options for memory management used when JMeter is started. Defaults to -Xms1g -Xmx1g -X:MaxMetaspaceSize=256m
JAVA_HOME
Must point at your Java Development Kit installation. Required to run the with the “debug” argument. On some OSes it JMeter will try its best to guess the location of the JVM.
JMETER_COMPLETE_ARGS
If set indicates, that JVM_ARGS and JMETER_OPTS are to be used, only. All other options like HEAP and GC_ALGO will be ignored. Default is empty.
JMETER_HOME
May point to your JMeter install dir. If empty it will be set relative to the jmeter script.
JMETER_LANGUAGE
Java runtime options to specify used language. Defaults to -Duser.language=en -Duser.region=EN
JMETER_OPTS
Java runtime options used when JMeter is started. Special options for operating systems might be added by JMeter.
JRE_HOME
Must point at your Java Runtime installation. Defaults to JAVA_HOME if empty. If JRE_HOME and JAVA_HOME are both empty, JMeter will try to guess JAVA_HOME. If JRE_HOME and JAVA_HOME are both set, JAVA_HOME is used.
JVM_ARGS
Java options to be used when starting JMeter. These will be added before JMETER_OPTS and after the other JVM options. Default is empty

中文版
1.4 运行 JMeter

要运行 JMeter,请运行jmeter.bat(对于 Windows)或jmeter(对于 Unix)文件。这些文件位于bin目录中。片刻之后,JMeter GUI 应该会出现。

GUI 模式只能用于创建测试脚本,CLI 模式(非 GUI)必须用于负载测试
bin目录中 有一些额外的脚本,您可能会发现它们很有用。Windows 脚本文件(.CMD 文件需要 Win2K 或更高版本):

jmeter.bat
运行 JMeter(默认在 GUI 模式下)
jmeterw.cmd
在没有 windows shell 控制台的情况下运行 JMeter(默认为 GUI 模式)
jmeter-n.cmd
在此放置一个 JMX 文件以运行 CLI 模式测试
jmeter-nr.cmd
在此放置一个 JMX 文件以远程运行 CLI 模式测试
jmeter-t.cmd
在此放置一个 JMX 文件以在 GUI 模式下加载它
jmeter-server.bat
在服务器模式下启动 JMeter
镜像服务器.cmd
在 CLI 模式下运行 JMeter 镜像服务器
关机命令
运行 Shutdown 客户端以优雅地停止 CLI 模式实例
停止测试命令
运行 Shutdown 客户端以突然停止 CLI 模式实例
特殊名称LAST可与jmeter-n.cmd、jmeter-t.cmd和jmeter-nr.cmd 一起使用 ,表示交互式运行的最后一个测试计划。
有一些环境变量可用于自定义 JMeter 的 JVM 设置。设置这些的一种简单方法是在bin目录中创建一个名为setenv.bat的文件。这样的文件可能如下所示:

rem 这是bin\setenv.bat的内容,
rem会被bin\jmeter.bat调用

set JVM_ARGS=-Xms1024m -Xmx1024m -Dpropname=value
该JVM_ARGS可用于覆盖在JVM设置jmeter.bat脚本和启动JMeter的,例如,当将设置:

jmeter -t test.jmx …
可以定义以下环境变量:

绘图
影响直接绘制使用的 JVM 选项,例如-Dsun.java2d.ddscale=true。默认为空。
GC_ALGO
JVM 垃圾收集器选项。默认为-XX:+UseG1GC -XX:MaxGCPauseMillis=250 -XX:G1ReservePercent=20

启动 JMeter 时使用的 JVM 内存设置。默认为-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m
JMETER_BIN
JMeter bin 目录(必须以\结尾)。当setenv.bat被调用时,值将被猜测。
JMETER_COMPLETE_ARGS
如果设置指示,则仅使用JVM_ARGS和JMETER_OPTS。所有其他选项,如HEAP和GC_ALGO将被忽略。默认为空。
JMETER_HOME
安装目录。将从jmeter.bat 的位置猜测
JMETER_LANGUAGE
用于指定所用语言的 Java 运行时选项。默认为:-Duser.language=“en” -Duser.region=“EN”
JM_LAUNCH
java 可执行文件的名称,如java.exe(默认)或javaw.exe
JVM_ARGS
启动 JMeter 时要使用的 Java 选项。这些将最后添加到 java 命令中。默认为空
un*x 脚本文件;应该适用于大多数 Linux/Unix 系统:

电表
运行 JMeter(默认为 GUI 模式)。定义一些可能不适用于所有 JVM 的 JVM 设置。
jmeter-服务器
在服务器模式下启动 JMeter(使用适当的参数调用 jmeter 脚本)
jmeter.sh
非常基本的 JMeter 脚本(您可能需要调整 JVM 选项,例如内存设置)。
镜像服务器.sh
在 CLI 模式下运行 JMeter 镜像服务器
关机.sh
运行 Shutdown 客户端以优雅地停止 CLI 模式实例
停止测试
运行 Shutdown 客户端以突然停止 CLI 模式实例
可能需要设置一些环境变量来配置 JMeter 使用的 JVM。这些变量可以直接在启动jmeter脚本的 shell 中设置。例如设置变量JVM_ARGS将覆盖大多数预定义的设置,例如

JVM_ARGS="-Xms1024m -Xmx1024m" jmeter -t test.jmx [等]
将覆盖脚本中的 HEAP 设置。

要永久设置这些变量,您可以将它们放在bin目录中名为setenv.sh的文件中。该文件将在通过调用jmeter脚本运行 JMeter 时获取。bin/setenv.sh的示例可能如下所示:

这是文件 bin/setenv.sh,

它将来自 bin/jmeter

使用更大的堆,但比默认的更小的元空间

export HEAP="-Xms1G -Xmx1G -XMaxMetaspaceSize=192m"

Try从操作系统猜测语言环境。作为价值的空间是故意的!

导出 JMETER_LANGUAGE=""
可以定义以下环境变量:

GC_ALGO
用于指定 JVM 垃圾收集算法的 Java 运行时选项。默认为-XX:+UseG1GC -XX:MaxGCPauseMillis=250 -XX:G1ReservePercent=20

启动 JMeter 时使用的用于内存管理的 Java 运行时选项。默认为-Xms1g -Xmx1g -X:MaxMetaspaceSize=256m
JAVA_HOME
必须指向您的 Java Development Kit 安装。需要使用“ debug ”参数运行。在某些操作系统上,JMeter 会尽力猜测 JVM 的位置。
JMETER_COMPLETE_ARGS
如果设置指示,则仅使用JVM_ARGS和JMETER_OPTS。所有其他选项,如HEAP和GC_ALGO将被忽略。默认为空。
JMETER_HOME
可能指向您的 JMeter 安装目录。如果为空,它将相对于jmeter脚本进行设置。
JMETER_LANGUAGE
用于指定所用语言的 Java 运行时选项。默认为-Duser.language=en -Duser.region=EN
JMETER_OPTS
JMeter 启动时使用的 Java 运行时选项。JMeter 可能会添加操作系统的特殊选项。
JRE_HOME
必须指向您的 Java 运行时安装。如果为空,则默认为JAVA_HOME。如果JRE_HOME和JAVA_HOME都为空,JMeter 将尝试猜测JAVA_HOME。如果JRE_HOME和JAVA_HOME都设置,则使用JAVA_HOME。
JVM_ARGS
启动 JMeter 时要使用的 Java 选项。这些将在JMETER_OPTS之前和其他 JVM 选项之后添加。默认为空

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值