Введение в тестирование производительности

advertisement
ТЕСТИРОВАНИЕ
ПРОИЗВОДИТЕЛЬНОСТИ.
JMETER
Доц. каф. МО ЭВМ Емельяненко Т.Г.
Содержание
• Введение в тестирование производительности
• Три основных компонента тестирования
производительности
• Формальные или неформальные требования?
• Обзор инструментов тестирования
производительности
• Введение в JMeter
• Элементы тест плана
• Первый сценарий в JMeter
Введение в тестирование
производительности
Модель качества согласно ISO/IEC 9126 –
структурированное множество характеристик:
• Функциональность (Functionality)
• Надежность (Reliability)
• Практичность (Usability)
• Эффективность (Efficiency)
• Сопровождаемость (Maintainability)
• Переносимость (Portability)
Три основных компонента тестирования
производительности
• Генерирование нагрузки (ресурсов
недостаточно при высокой нагрузке)
• Мониторинг характеристик
производительности (неочевидность
узких мест)
• Анализ результатов (должны
анализироваться не только средние
значения, но и любые отклонения)
Формальные или неформальные
требования?
При нагрузке до 100 одновременно работающих с
системой клиентов, среднее время отклика должно
составлять не более 2,5 секунд.
2) При нагрузке до 100 транзакций в секунду типа «ping» и
10 транзакций в секунду типа «action»:
• среднее время отклика для транзакций типа «action»
должно составлять не более 2,5 секунд,
• количество отказов не должно превышать 1%,
• дисперсия не должна превышать 5%,
• сервер приложений должен потреблять не более 50% CPU
и не более 1,2 гигабайта ОЗУ,
• система должна расходовать не более трёх соединений с
СУБД
В большинстве случаев ответ «Да, тест прошел» или «Нет,
тест не прошел» бесполезен!
1)
Обзор инструментов тестирования
производительности
Генерация нагрузки:
JMeter
Curl-loader
FuncLoad
FWPTT
Grinder
Hammerora
Httpperf (unix)
Jcrawler
Multi-Mechanize
OpenSTA
Pylot
TestMaker
Tsung
Обзор инструментов тестирования
производительности
Онлайн-генераторы нагрузки:
LoadStorm
BrowserMob
LoadImpact
Loadea
Keynote KITE
Мониторинг нагрузки
• Встроенные в инструменты средства
• Средства операционной системы
• Средства серверов, СУБД, …
• Специализированные средства
мониторинга – IxoraRMS
Анализ результатов
• Встроенные в инструменты средства
• Электронные таблицы
• Пакеты для статистической обработки
данных
Примеры моделей нагрузки
• Постоянная нагрузка
Примеры моделей нагрузки
• Непрерывно возрастающая нагрузка
• Цель: поиск точки насыщения
Примеры моделей нагрузки
• Нагрузка с «всплесками»
• Цель: проверка устойчивости
Введение в JMeter
JMeter является проектом Apache Jakarta, может быть
использован в качестве инструмента нагрузочного
тестирования для анализа и измерения производительности
различных сервисов, с акцентом на веб-приложения.
JMeter был разработан в качестве средства тестирования вебприложений, поэтому он способен провести стресс-тесты для
JDBC-соединений, FTP, LDAP, SOAP, JMS, POP3, IMAP, HTTP
и TCP.
Вы можете создавать большое количество запросов с помощью
нескольких компьютеров для управления процессом с одного из
них. Архитектура, которая поддерживает сторонние плагины,
инструмент позволяет добавлять новые функции.
Архитектура JMeter основана на плагинах. Разработчики могут
легко расширить JMeter с помощью подключаемых модулей.
Введение в JMeter
• Apache JMeter является десктопным приложением написанным на Java,
разработанным для нагрузочного тестирования клиент/ серверного
программного обеспечения (такого, как веб-приложения).
• Он может быть использован для тестирования производительности как
статических так и динамических ресурсов, таких как статические
файлы, Java-сервлеты, CGI скрипты, JavaObjects, базы данных, FTPсервера и т.д.
• JMeter может быть использован для моделирования большой нагрузки
на сервера, сети или объект, чтобы проверить его силу или
проанализировать общую производительность при различных видах
нагрузки.
• Кроме того, JMeter может быть полезен при регрессионном
тестирования, позволяя создавать тестовые скрипты для проверки того,
что приложение возвращает ожидаемые результаты. Для максимальной
гибкости, JMeter позволяет создавать эти проверки с использованием
регулярных выражений.
Введение в JMeter
• http://jakarta.apache.org/jmeter/
Элементы тест плана
• Concept Jmeter - the Test Plan. Element tree initially consists of two
points "Test Plan" and the "Workbench". Workbench - it looks like a
temporary folder.
• Jmeter interface is built on a "drag" from place to place items in the tree
scenario. Plan tree to be performed, it is just a "Test Plan". You design
the plan tree, and then can move on his part of the "bench"
(Workbench). Performed in the course of testing only the contents of the
Test Plan, and the contents of Workbench not even saved to disk.
• The most important element is the Thread Group. He had not invested
in any of the above groups of elements and there is like over them all.
Thread Group allows you to specify the parameters generated at the site
loads. Its parameters are:
•
•
•
•
"Number of threads" - the number of simulated concurrent users working with the site;
"Ramp-up period" - the time interval through which runs the launch of the next process.
To specify how many times the script will be executed within the "Thread Group" used "Loop count".
Possible, or specify a number or tick "Forever", so that the script runs until terminated by you directly.
The last parameter is set to "Thread Group" - activities that occur after an error
(mismatch detected with the help of Assertion). Possible values: either
continue the test or to interrupt a flow (in which the error occurred), or abort the
whole test plan.
Элементы тест плана
• All the added elements are divided into categories:
• "Logic Controller" to control the progress of the script contains an analog
•
•
•
•
•
•
•
loops, conditional statements.
The next category of items "Listener", - analysis of the script, for example, the
construction of a graph or a table with test results.
Category of elements "Sampler" is used to execute queries (http, ftp, access
the databases, etc.).
Category "Assertions" is used to check that formed the server page
corresponds to a criterion of "correctness."
Elements in the group "Timers" are used to generate the pauses between the
individual steps (Samplers) inside the Thread Group. If you do not specify the
value of a pause, in which case the steps the script will be executed one after
another without delay, and hence generated by a single Thread on a site load
will exceed the load, which could create a regular visitor.
The next group of elements the script is "Config Element", their task to create
a standard configuration for the Sampler-s.
Group Pre-Processor and Post-Processor contain elements that are
executed before the Sampler-s (eg, modification of the request parameters
before sending it) and once worked Sampler (extracted from the query result
any variables).
Thus, a typical blank test plan consists of a Thread Group, HTTP Request
Defaults, HTTP Request, Response Assertion, Graph Results.
Элементы тест плана
• Inside the "Thread Group" elements are added to the request to the web-
pages. Is responsible for this "HTTP Request Defaults" and "HTTP Request".
•
•
"HTTP Request Defaults" is used to configure the query type.
"HTTP Request" fulfills the request itself.
• If we test the same site, the parameters such as protocol, server name, port
number and directory with the test page will be the same. Partially coincide
and variables, such as all pages of the site can be transmitted session number.
We can provide all the common properties for the query, as well as a sign to
download from the site not just the html-code page, and all associated
resources (images, css) by using the "HTTP Request Defaults". The following
elements of "HTTP Request" indicates only options other than those specified
in the settings Defaults-a.
• Element script Graph Results, - the purpose of this element plot based on
data received during the test.
• For the organization of steps, the script into a hierarchy of "a set of tests-> test> step ..." used "Simple Controller". Visually, this item will be presented in the
form of "folders" that holds the other elements.
• Loop Controller, used for looping. His behavior is similar to the Thread Group,
but the actions are executed sequentially, not parallel. As the only
configuration options Loop Controller supports a number of repetitions of the
cycle.
Первый сценарий в JMeter
Первый сценарий в JMeter
Первый сценарий в JMeter
Первый сценарий в JMeter
Первый сценарий в JMeter
Спасибо за внимание
Download