- Как установить Apache JMeter в Ubuntu 20.04 LTS
- Как установить Apache JMeter в Ubuntu 20.04 LTS
- Установите Apache JMeter на Ubuntu 20.04 LTS Focal Fossa
- Шаг 1. Во-первых, убедитесь, что все ваши системные пакеты обновлены, выполнив следующие apt команды в терминале.
- Шаг 2. Установка Java.
- Шаг 3. Установка Apache JMeter в Ubuntu 20.04.
- Установка и запуск JMeter на Linux CentOS
- Подготовка системы
- Установка JMeter
- Автозапуск
- Настройка клиента
- Графическая оболочка
- Как установить jmeter в Ubuntu / Debian
- Установка:
- Подробная информация о пакете:
- Зависимости:
- 1. Getting Started¶
- 1.0.1 Test plan building¶
- 1.0.2 Load Test running¶
- 1.0.3 Load Test analysis¶
- 1.0.4 Let’s start¶
- 1.1 Requirements¶
- 1.1.1 Java Version¶
- 1.1.2 Operating Systems¶
- 1.2 Optional¶
- 1.2.1 Java Compiler¶
- 1.2.2 SAX XML Parser¶
- 1.2.3 Email Support¶
- 1.2.4 SSL Encryption¶
- 1.2.5 JDBC Driver¶
- 1.2.6 JMS client¶
- 1.2.7 Libraries for ActiveMQ JMS¶
- 1.3 Installation¶
- 1.4 Running JMeter¶
- 1.4.1 JMeter’s Classpath¶
- 1.4.2 Create Test Plan from Template¶
- 1.4.3 Using JMeter behind a proxy¶
- 1.4.4 CLI Mode (Command Line mode was called NON GUI mode)¶
- 1.4.5 Server Mode¶
- 1.4.6 Overriding Properties Via The Command Line¶
- 1.4.7 Logging and error messages¶
- 1.4.8 Full list of command-line options¶
Как установить Apache JMeter в Ubuntu 20.04 LTS
Как установить Apache JMeter в Ubuntu 20.04 LTS
В этом руководстве мы покажем вам, как установить Apache JMeter в Ubuntu 20.04 LTS. Для тех из вас, кто не знал, приложение Apache JMeter — это программное обеспечение с открытым исходным кодом, приложение на 100% чистой Java, разработанное для нагрузочного тестирования функционального поведения и измерения производительности. Первоначально он был разработан для тестирования веб-приложений, но с тех пор расширился до других функций тестирования.
В этой статье предполагается, что у вас есть хотя бы базовые знания Linux, вы знаете, как использовать оболочку, и, что наиболее важно, вы размещаете свой сайт на собственном VPS. Установка довольно проста и предполагает, что вы работаете с учетной записью root, в противном случае вам может потребоваться добавить ‘ sudo ‘ к командам для получения привилегий root. Я покажу вам пошаговую установку Apache JMeter на Ubuntu 20.04 (Focal Fossa). Вы можете следовать тем же инструкциям для Ubuntu 18.04, 16.04 и любого другого дистрибутива на основе Debian, например Linux Mint.
Установите Apache JMeter на Ubuntu 20.04 LTS Focal Fossa
Шаг 1. Во-первых, убедитесь, что все ваши системные пакеты обновлены, выполнив следующие apt команды в терминале.
Шаг 2. Установка Java.
Добавьте PPA «Linux Uprising» с помощью следующей команды:
После добавления репозитория приступайте к установке Java в Ubuntu Linux:
Затем введите ниже, чтобы подтвердить версию Java:
Шаг 3. Установка Apache JMeter в Ubuntu 20.04.
Теперь мы загружаем последнюю версию Apache JMeter, используя следующую команду:
Затем распакуйте архив JMeter в корневой каталог документов на вашем сервере:
После извлечения загруженного пакета перейдите в извлеченную папку, а затем перейдите в каталог bin внутри извлеченной папки:
Затем запустите файл jmeter.sh с помощью команды. На экране появится графический интерфейс Jmeter: sh jemeter . sh
Поздравляю! Вы успешно установили Apache JMeter . Благодарим за использование этого руководства по установке Apache JMeter в системе Ubuntu 20.04 LTS Focal Fossa. Для получения дополнительной помощи или полезной информации мы рекомендуем вам посетить официальный сайт Apache JMeter .
Источник
Установка и запуск JMeter на Linux CentOS
Данная инструкция показывает только установку на Linux CentOS и настройку в качестве сервиса инструмент для тестирования JMeter.
Подготовка системы
Предварительно, необходимо установить openjdk и wget. Для этого вводим:
yum install java-11-openjdk wget
Смотрим версию openjdk:
Мы должны увидеть что-то на подобие:
openjdk version «11.0.12» 2021-07-20 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.12+7-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.12+7-LTS, mixed mode, sharing)
Установка JMeter
Установку необходимо выполнить как на сервере, так и на всех клиентах.
Переходим на официальную страницу загрузки JMeter. Нам нужен архив tgz с бинарным файлом. Находим его и копируем ссылку:
Используя скопированную ссылку, загружаем на сервер архив:
tar zxvf apache-jmeter-5.4.1.tgz
И переносим распакованный архив в каталог /opt/jmeter:
mv apache-jmeter-*/ /opt/jmeter
Создаем файл для настройки переменных окружения:
export JMETER_HOME=/opt/jmeter
export PATH=$JMETER_HOME/bin:$PATH
* в данном примере мы создаем переменную JMETER_HOME с путем до нашего каталога и добавляем ее значение к переменной PATH, которая используется для поиска системой файлов запуска.
Запускаем на выполнения файл, чтобы создать в текущей сессии нужные нам переменные окружения:
Мы должны увидеть версию нашего jmeter:
_ __ __ _____ _____ _____ ____
| | \/ | ____|_ _| ____| _ \
_ | | |\/| | _| | | | _| | |_) |
| |_| | | | | |___ | | | |___| _ Dmosk
What is the name of your organizational unit?
[Unknown]: DmoskOU
What is the name of your organization?
[Unknown]: Dmosk
What is the name of your City or Locality?
[Unknown]: SPb
What is the name of your State or Province?
[Unknown]: SPb
What is the two-letter country code for this unit?
[Unknown]: RU
Is CN=Dmosk, OU=DmoskOU, O=Dmosk, L=SPb, ST=SPb, C=RU correct?
[no]: yes
В итоге, мы увидим:
Copy the generated rmi_keystore.jks to jmeter/bin folder or reference it in property ‘server.rmi.ssl.keystore.file’
Пробуем запустить сервис командой:
Мы должны увидеть что-то на подобие:
Created remote object: UnicastServerRef2 [liveRef: [endpoint:[10.129.0.12:41899,SSLRMIServerSocketFactory(host=bigdata-mon.ru-central1.internal/10.129.0.12, keyStoreLocation=rmi_keystore.jks, type=JKS, trustStoreLocation=rmi_keystore.jks, type=JKS, alias=rmi),SSLRMIClientSocketFactory(keyStoreLocation=rmi_keystore.jks, type=JKS, trustStoreLocation=rmi_keystore.jks, type=JKS, alias=rmi)](local),objID:[-795e2f04:17b5896bf72:-7fff, -516441775273034593]]]
Наш сервер запускается.
Прерываем его работу комбинацией Ctrl + R и продолжаем настройку.
Автозапуск
Теперь создадим юнит в systemd:
[Unit]
Description=Apache Jmeter server
Documentation=https://jmeter.apache.org/usermanual/remote-test.html
Wants=network-online.target
After=network-online.target
[Service]
LimitNOFILE=10240
Type=simple
Restart=on-failure
RestartSec=180s
WorkingDirectory=/tmp
ExecStart=/opt/jmeter/bin/jmeter-server
* в данном примере мы будем запускать приложение /opt/jmeter/bin/jmeter-server.
Перечитываем конфигурацию в systemd:
Разрешаем автозапуск jmeter-server и стартуем его:
systemctl enable jmeter-server —now
Проверяем статус запущенного сервиса:
systemctl status jmeter-server
Переходим к клиенту.
Настройка клиента
На клиентском компьютере открываем файл:
* где 192.168.0.15 — адрес нашего сервера с jmeter.
Пример запуска тестирования будет выглядеть так:
jmeter -t /tmp/my_test_file.jmx -n -r -X -f -l jmetter.jtl
* где /tmp/my_test_file.jmx — путь до файла с тестами (разработка данного файла не входит в тему данной инструкции).
Графическая оболочка
Настройка jmetter может выполняться с помощью графического интерфейса. Если мы подключены к серверу без графической оболочки по SSH, то нам нужно настроить проброс X11 на рабочий компьютер, с которого мы подключаемся по SSH.
Устанавливаем на сервере пакеты:
yum install xauth xterm
Открываем конфигурационный файл:
И проверяем, что опция X11Forwarding разрешена:
Если данную опцию пришлось изменить, то перезапускаем sshd:
systemctl restart sshd
Теперь мы можем подключиться к нашему серверу по SSH
ssh -X -p 22 root@192.168.0.15
Теперь можно запустить jmetter:
На компьютере, с которого мы подключены по SSH должно открыться окно с настройкой jmetter.
Источник
Как установить jmeter в Ubuntu / Debian
Установка:
Для установки jmeter в Ubuntu / Linux Mint / Debian, введите в Терминал :
Подробная информация о пакете:
Тестирование нагрузки и измерение производительности (основное приложение)
Зависимости:
Стандартная совместимость с Java или Java Runtime
Обертки для исполняемых файлов Java
Рамка регрессии JUnit для Java
Общий фреймворк для серверных приложений Java
Генераторы / процессоры Bouncy Castle для S / MIME и CMS
Bouncy Castle Java API для PKIX, CMS, EAC, TSP, PKCS, OCSP, CMP и CRMF
Bouncy Castle Java Cryptographic Service Provider
Bean Scripting Framework для поддержки языков сценариев в Java
Среда сценариев Java (BeanShell) Версия 2 (библиотека)
Кодировщик и декодеры, такие как Base64 и шестнадцатеричный кодек
Коллекции коллекций Apache — расширенный API коллекций для Java
Commons HTTPClient — библиотека Java для создания HTTP-клиентов
Общие полезные классы, связанные с IO
Apache Commons JEXL — язык выражений Java
Commons Lang — расширение пакета java.lang
Расширение пакета java.lang (для Java 5+)
Легкие математические и статистические компоненты Java
Apache Commons Net — API-интерфейс Java для базовых интернет-протоколов
Apache Commons Pool 2 — Объединение реализации для объектов Java
Реализация DNS в Java
Система управления журналом проекта Excalibur
Легкий и быстрый разработанный инструментарий для ведения журнала для Java
API-интерфейс Geronimo API спецификации JMS 1.1
Java-библиотека для разбора html
Реализация HTTP-агента HTTP.1.1
Набор низкоуровневых транспортных компонентов HTTP для Java
Реализация HTTP-агента с поддержкой HTTP.1.1 — расширение MIME
Библиотека диаграмм на основе Java
Легкая и быстрая библиотека с использованием XML
Java-парсер Java, который имеет смысл реального HTML-супа
Реализация JavaMail API Reference
Драйвер Java MongoDB
Библиотека регулярных выражений для Java
Библиотеки для rhino Java Script Engine
Библиотека Java для подсветки текстового компонента синтаксиса
Процессор XSL Transformations (XSLT) в Java
Многоразовые компоненты, используемые Batik и FOP
Библиотека Java для сериализации объектов в XML и обратно
Источник
1. Getting Started¶
1.0.1 Test plan building¶
To do that, you will run JMeter in GUI Mode.
Then you can either choose to record the application from a browser, or native application. You can use for that the menu File → Templates. → Recording
Note you can also manually build your plan. Ensure you read this documentation to understand major concepts.
You will also debug it using one of these options:
- Run → Start no pauses
- Run → Start
- Validate on Thread Group
and View Results Tree renderers or Testers (CSS/JQUERY, JSON, Regexp, XPath).
Ensure you follow best-practices when building your Test Plan.
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
- Increase the Java Heap size. By default JMeter runs with a heap of 1 GB, 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 CLI mode (Command-line mode previously called Non-GUI mode) to run it for the Load Test.
1.0.3 Load Test analysis¶
1.0.4 Let’s start¶
The easiest way to begin using JMeter is to first download the latest production release and install it. The release contains all of the files you need to build and run most types of tests, e.g. Web (HTTP/HTTPS), FTP, JDBC, LDAP, Java, JUnit and more.
If you want to perform JDBC testing, then you will, of course, need the appropriate JDBC driver from your vendor. JMeter does not come with any JDBC drivers.
JMeter includes the JMS API jar, but does not include a JMS client implementation. If you want to run JMS tests, you will need to download the appropriate jars from the JMS provider.
Next, start JMeter and go through the Building a Test Plan section of the User Guide to familiarize yourself with JMeter basics (for example, adding and removing elements).
Finally, go through the appropriate section on how to build a specific type of Test Plan. For example, if you are interested in testing a Web application, then see the section Building a Web Test Plan. The other specific Test Plan sections are:
- Advanced Web Test Plan
- JDBC
- FTP
- JMS Point-to-Point
- JMS Topic
- LDAP
- LDAP Extended
- WebServices (SOAP)
Once you are comfortable with building and running JMeter Test Plans, you can look into the various configuration elements (timers, listeners, assertions, and others) which give you more control over your Test Plans.
1.1 Requirements¶
JMeter requires that your computing environment meets some minimum requirements.
1.1.1 Java Version¶
Because JMeter uses only standard Java APIs, please do not file bug reports if your JRE fails to run JMeter because of JRE implementation issues.
1.1.2 Operating Systems¶
JMeter is a 100% Java application and should run correctly on any system that has a compliant Java implementation.
Operating systems tested with JMeter can be viewed on this page on JMeter wiki.
Even if your OS is not listed on the wiki page, JMeter should run on it provided that the JVM is compliant.
1.2 Optional¶
If you plan on doing JMeter development, then you will need one or more optional packages listed below.
1.2.1 Java Compiler¶
If you want to build the JMeter source or develop JMeter plugins, then you will need a fully compliant JDK 8 or higher.
1.2.2 SAX XML Parser¶
JMeter comes with Apache’s Xerces XML parser. You have the option of telling JMeter to use a different XML parser. To do so, include the classes for the third-party parser in JMeter’s classpath, and update the jmeter.properties file with the full classname of the parser implementation.
1.2.3 Email Support¶
JMeter has extensive Email capabilities. It can send email based on test results, and has a POP3(S)/IMAP(S) sampler. It also has an SMTP(S) sampler.
1.2.4 SSL Encryption¶
To test a web server using SSL encryption (HTTPS), JMeter requires that an implementation of SSL be provided, as is the case with Sun Java 1.4 and above. If your version of Java does not include SSL support, then it is possible to add an external implementation. Include the necessary encryption packages in JMeter’s classpath. Also, update system.properties to register the SSL Provider.
JMeter HTTP defaults to protocol level TLS. This can be changed by editing the JMeter property https.default.protocol in jmeter.properties or user.properties .
The JMeter HTTP samplers are configured to accept all certificates, whether trusted or not, regardless of validity periods, etc. This is to allow the maximum flexibility in testing servers.
If the server requires a client certificate, this can be provided.
There is also the SSL Manager, for greater control of certificates.
The SMTP sampler can optionally use a local trust store or trust all certificates.
1.2.5 JDBC Driver¶
You will need to add your database vendor’s JDBC driver to the classpath if you want to do JDBC testing. Make sure the file is a jar file, not a zip.
1.2.6 JMS client¶
JMeter now includes the JMS API from Apache Geronimo, so you just need to add the appropriate JMS Client implementation jar(s) from the JMS provider. Please refer to their documentation for details. There may also be some information on the JMeter Wiki.
1.2.7 Libraries for ActiveMQ JMS¶
You will need to add the jar activemq-all-X.X.X.jar to your classpath, e.g. by storing it in the lib/ directory.
1.3 Installation¶
We recommend that most users run the latest release.
To install a release build, simply unzip the zip/tar file into the directory where you want JMeter to be installed. Provided that you have a JRE/JDK correctly installed and the JAVA_HOME environment variable set, there is nothing more for you to do.
The installation directory structure should look something like this (where X.Y is version number): You can rename the parent directory (i.e. apache-jmeter-X.Y ) if you want, but do not change any of the sub-directory names.
1.4 Running JMeter¶
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.
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
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:
The JVM_ARGS can be used to override JVM settings in the jmeter.bat script and will get set when starting JMeter, e.g.:
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
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:
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.1 JMeter’s Classpath¶
JMeter automatically finds classes from jars in the following directories:
JMETER_HOME/lib used for utility jars JMETER_HOME/lib/ext used for JMeter components and plugins
If you have developed new JMeter components, then you should jar them and copy the jar into JMeter’s lib/ext directory. JMeter will automatically find JMeter components in any jars found here. Do not use lib/ext for utility jars or dependency jars used by the plugins; it is only intended for JMeter components and plugins.
If you don’t want to put JMeter plugin jars in the lib/ext directory, then define the property search_paths in jmeter.properties .
Utility and dependency jars (libraries etc) can be placed in the lib directory.
If you don’t want to put such jars in the lib directory, then define the property user.classpath or plugin_dependency_paths in jmeter.properties . See below for an explanation of the differences.
Other jars (such as JDBC, JMS implementations and any other support libraries needed by the JMeter code) should be placed in the lib directory — not the lib/ext directory, or added to user.classpath .
You can also install utility Jar files in $JAVA_HOME/jre/lib/ext , or you can set the property user.classpath in jmeter.properties
Note that setting the CLASSPATH environment variable will have no effect. This is because JMeter is started with » java -jar «, and the java command silently ignores the CLASSPATH variable, and the -classpath / -cp options when -jar is used.
1.4.2 Create Test Plan from Template¶
You have the ability to create a new Test Plan from existing template.
To do so you use the menu File → Templates… or Templates icon: Templates icon item
A popup appears, you can then choose a template among the list: Templates popup
Some templates may need parameters input from the user. For theses ones, after a click on the create button, a new window will appear as follow : Parameters window
When you are done with parameters, click on the Validate button and the template will be created.
A documentation for each template explains what to do once test plan is created from template.
1.4.3 Using JMeter behind a proxy¶
If you are testing from behind a firewall/proxy server, you may need to provide JMeter with the firewall/proxy server hostname and port number. To do so, run the jmeter[.bat] file from a command line with the following parameters:
-E [proxy scheme to use — optional — for non-http] -H [proxy server hostname or ip address] -P [proxy server port] -N [nonproxy hosts] (e.g. *.apache.org|localhost ) -u [username for proxy authentication — if required] -a [password for proxy authentication — if required] Example:
You can also use —proxyScheme , —proxyHost , —proxyPort , —username , and —password as parameter names
If the proxy scheme is provided, then JMeter sets the following System properties:
If the proxy host and port are provided, then JMeter sets the following System properties:
- http.proxyHost
- http.proxyPort
- https.proxyHost
- https.proxyPort
The user and password used for a proxy can be given by the System properties http.proxyUser and http.proxyUser . They will get overridden by the above arguments or values set in the HTTP Samplers.
If a nonproxy host list is provided, then JMeter sets the following System properties:
So if you don’t wish to set both http and https proxies, you can define the relevant properties in system.properties instead of using the command-line parameters.
Proxy Settings can also be defined in a Test Plan, using either the HTTP Request Defaults configuration or the HTTP Request sampler elements.
1.4.4 CLI Mode (Command Line mode was called NON GUI mode)¶
For load testing, you must run JMeter in this mode (Without the GUI) to get the optimal results from it. To do so, use the following command options:
-n This specifies JMeter is to run in cli mode -t [name of JMX file that contains the Test Plan]. -l [name of JTL file to log sample results to]. -j [name of JMeter run log file]. -r Run the test in the servers specified by the JMeter property » remote_hosts » -R [list of remote servers] Run the test in the specified remote servers -g [path to CSV file] generate report dashboard only -e generate report dashboard after load test -o output folder where to generate the report dashboard after load test. Folder must not exist or be empty
The script also lets you specify the optional firewall/proxy server information:
-H [proxy server hostname or ip address] -P [proxy server port] Example
If the property jmeterengine.stopfail.system.exit is set to true (default is false ), then JMeter will invoke System.exit(1) if it cannot stop all threads. Normally this is not necessary.
1.4.5 Server Mode¶
For distributed testing, run JMeter in server mode on the remote node(s), and then control the server(s) from the GUI. You can also use CLI mode to run remote tests. To start the server(s), run jmeter-server[.bat] on each server host.
The script also lets you specify the optional firewall/proxy server information:
-H [proxy server hostname or ip address] -P [proxy server port] Example:
If you want the server to exit after a single test has been run, then define the JMeter property server.exitaftertest=true .
To run the test from the client in CLI mode, use the following command:
where: -G is used to define JMeter properties to be set in the servers -X means exit the servers at the end of the test -Rserver1,server2 can be used instead of -r to provide a list of servers to start. Overrides remote_hosts , but does not define the property.
If the property jmeterengine.remote.system.exit is set to true (default is false ), then JMeter will invoke System.exit(0) after stopping RMI at the end of a test. Normally this is not necessary.
1.4.6 Overriding Properties Via The Command Line¶
Java system properties and JMeter properties can be overridden directly on the command lin (instead of modifying jmeter.properties ). To do so, use the following options:
-D[prop_name]=[value] defines a java system property value. -J[prop_name]=[value] defines a local JMeter property. -G[prop_name]=[value] defines a JMeter property to be sent to all remote servers. -G[propertyfile] defines a file containing JMeter properties to be sent to all remote servers. -L[category]=[priority] overrides a logging setting, setting a particular category to the given priority level.
The -L flag can also be used without the category name to set the root logging level.
1.4.7 Logging and error messages¶
Here is an example log4j2.xml file which defines two log appenders and loggers for each category.
So, if you want to change the log level for org.apache.http category to debug level for instance, you can simply add (or uncomment) the following logger element in log4j2.xml file before launching JMeter.
For more detail on how to configure log4j2.xml file, please see Apache Log4j 2 Configuration page.
Log level for specific categories or root logger can be overridden directly on the command line (instead of modifying log4j2.xml ) as well. To do so, use the following options:
-L[category]=[priority] Overrides a logging setting, setting a particular category to the given priority level. Since 3.2, it is recommended to use a full category name (e.g, org.apache.jmeter or com.example.foo ), but if the category name starts with either jmeter or jorphan , org.apache. will be prepended internally to the category name input to construct a full category name (i.e, org.apache.jmeter or org.apache.jorphan ) for backward compatibility.
Differences in Logging : Old vs New Practices:
As JMeter uses SLF4J as logging API and Apache Log4j 2 as a logging framework since 3.2, not every log level used before 3.2 can match exactly with one of the new available log levels provided by SLF4J/Log4j2. Therefore, please keep the following differences and new suggested practices in mind if you need to migrate any existing logging configurations and logging code.
Category | Old Practices Before 3.2 | New Practices Since 3.2 |
---|---|---|
Logger Reference | Logger reference through LoggingManager : | Use SLF4J API with either category or explicit class: |
Log Levels in Configuration or Command Line Arguments | Old Log Levels:
| Mapping to New Levels through SLF4J/Log4j2:
If JMeter detects an error during a test, a message will be written to the log file. The log file name is defined in the log4j2.xml file (or using the -j option, see below). It defaults to jmeter.log , and will be found in the directory from which JMeter was launched. The menu Options → Log Viewer displays the log file in a bottom pane on main JMeter window. In the GUI mode, the number of error/fatal messages logged in the log file is displayed at top-right.
The command-line option -j jmeterlogfile allow to process after the initial properties file is read, and before any further properties are processed. It therefore allows the default of jmeter.log to be overridden. The jmeter scripts that take a test plan name as a parameter (e.g. jmeter-n.cmd ) have been updated to define the log file using the test plan name, e.g. for the test plan Test27.jmx the log file is set to Test27.log . When running on Windows, the file may appear as just jmeter unless you have set Windows to show file extensions. [Which you should do anyway, to make it easier to detect viruses and other nasties that pretend to be text files …] As well as recording errors, the jmeter.log file records some information about the test run. For example: The log file can be helpful in determining the cause of an error, as JMeter does not interrupt a test to display an error dialogue. 1.4.8 Full list of command-line options¶Invoking JMeter as » jmeter -? » will print a list of all the command-line options. These are shown below. Note: the JMeter log file name is formatted as a SimpleDateFormat (applied to the current date) if it contains paired single-quotes, .e.g. ‘ jmeter_’yyyyMMddHHmmss’.log ‘ If the special name LAST is used for the -t , -j or -l flags, then JMeter takes that to mean the last test plan that was run in interactive mode. Источник |