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 on-screen instructions. -
Go to Yandex Cloud Billing
and make sure you have a billing account linked and its status isACTIVE
orTRIAL_ACTIVE
. If you do not have a billing account yet, 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 the
loadtesting.generatorClient
role to it. -
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 the agent. - From the list of services, select Load Testing.
- In the Agents tab, click Create agent.
- Enter a name for the agent:
test-agent
. - 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 has changed 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
as the agent. -
Configuration method: Select
Form
. -
Load generator: Select
Pandora
as the generator. -
Target address: Enter the address of the service to test,
example.myservice.ru
. -
Target port:
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:
1
. - To:
100
. - Duration:
60s
.
- Profile 1: Select
-
Add another Load profile:
- Profile 2: Select
const
. - Responses per second:
100
. - Duration:
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:
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 tagged as
index
andget_test
. The load generator will repeat them in turn within the specified 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 that each connection will be closed following the request. This mode is heavier on the application and load generator. If you do not want the connections closed, setKeep-Alive
.
-
-
Under Forced test termination time, specify the time to autostop the test unless it is stopped for other reasons. This parameter value should be slightly greater than the expected test duration.
-
Under Test information, specify the name, description, and number of the test version. This will make the report easier to read.
-
Click Create.
-
That done, the configuration go through checks, and the agent will start test loading the application. You can view the report on the Tests tab.