Getting started with Yandex Load Testing
This guide will help you create a test agent in your cloud, configure a simple load test, and view the result.
Getting started
-
Log in to the management console
. If not signed up yet, navigate to the management console and follow the instructions. -
Go to Yandex Cloud Billing
and make sure you have a billing account linked and it has theACTIVE
orTRIAL_ACTIVE
status. If you do not yet have a billing account, create one. -
If you do not have a folder yet, create one. While creating a folder, you can also create a default virtual network with subnets in all availability zones.
-
Create a service account in the folder to host the agents that will generate the load. Assign it the
loadtesting.generatorClient
role. -
The agent connects to Load Testing using a public API. For security purposes, create a security group. To connect to the control service, make sure the agent allows outgoing traffic on port 443. To do this, add the following rule for outgoing traffic to your security group:
- Port range:
443
- Protocol:
TCP
- Destination name:
CIDR
- CIDR blocks:
0.0.0.0/0
- Port range:
-
The agent will need access to the subnet hosting the test target. For the agent to be able to connect to Load Testing, set up a NAT gateway for the subnet.
-
If you do not have an SSH key pair yet, create one.
Create an agent
- In the management console
, select the folder where you want to create your agent. - In the list of services, select Load Testing.
- In the Agents tab, click Create agent.
- Give your agent the
test-agent
name. - Specify the same availability zone where the test target is located.
- Select the appropriate agent type. For more information, see Agent performance.
- Specify the subnet where the test target is located. Make sure you created and set up a NAT gateway in the subnet.
- If security groups are available to you, select a preset group.
- Select the service account with the
loadtesting.generatorClient
role. You must have the permission to use it. - Enter a username. It will be created on the VM.
- Paste the contents of the public key file.
- Click Create.
- Wait for the VM to start. Make sure the agent status changes to
Ready for test
.
This creates a VM in your folder that you will be able to use to load test targets in the selected subnet.
Running a test
This example will test a service located at example.myservice.ru
.
We will use Pandora as load generator, since it is best suited for testing cloud applications.
- Open the
Tests tab in Load Testing. Click Create test. Set the test parameters:-
Agents: Select
test-agent
. -
Configuration method: Select
Form
. -
Load generator: Select
Pandora
. -
Target address: Enter the address of the service to test,
example.myservice.ru
. -
Target port: Set to
80
(default HTTP port). -
Testing threads:
1000
.
This means that the generator can simultaneously process 1,000 operations: either create 1,000 connections or wait for 1,000 responses from the service at the same time.Warning
Make sure the agent has access to
example.myservice.ru:80
. -
Load type: Select
RPS
. -
Add a Load profile:
- Profile 1: Select
line
. - From: Set
1
. - To: Set
100
. - Duration: Specify
60s
.
- Profile 1: Select
-
Add another Load profile:
- Profile 2: Select
const
. - Responses per second: Specify
100
. - Duration: Specify
300s
.
This instructs the generator to increase the load from 1 to 100 requests per second for the first 60 seconds, and then maintain a load of 100 requests per second for 5 minutes.
- Profile 2: Select
-
Request type: Specify
URI
. -
In the Test data field, select Form. In the menu that opens:
-
In the Requests submenu, add the following requests:
/ index
/test?param1=1¶m2=2 get_test
The requests are marked with the
index
andget_test
tags. The load generator will repeat them within a given load profile. -
In the Request headers submenu, specify the following headers:
[Host: example.myservice.ru]
[Connection: Close]
Please note that the
Connection: Close
header means each connection is terminated after making a request. This mode is heavier on the application and load generator. If you do not need to close connections, setKeep-Alive
.
-
-
Under Forced test termination time, specify the time to autostop the test unless it is stopped for other reasons. The parameter value should be slightly greater than the expected duration of the test.
-
Under Test information, specify the name, description, and number of the test version. This will make the report easier to read.
-
Click Create.
-
Afterwards, the configuration will be verified, and the agent will start loading the application being tested. You can view the report on the Tests tab.