Skip to content

Commit f4c75bc

Browse files
authored
Merge pull request #272944 from ninallam/ninallam-functions
Azure Functions load testing
2 parents 8a64e2c + dfb7341 commit f4c75bc

File tree

6 files changed

+120
-0
lines changed

6 files changed

+120
-0
lines changed
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
---
2+
title: Create load tests in Azure Functions
3+
titleSuffix: Azure Load Testing
4+
description: Learn how to create a load test for an Azure Function App with Azure Load Testing.
5+
services: load-testing
6+
ms.service: load-testing
7+
ms.author: ninallam
8+
author: ninallam
9+
ms.date: 04/22/2024
10+
ms.topic: how-to
11+
---
12+
13+
# Create a load test for Azure Functions
14+
15+
Learn how to create a load test for an app in Azure Functions with Azure Load Testing. In this article, you'll learn how to create a URL-based load test for your function app in the Azure portal, and then use the load testing dashboard to analyze performance issues and identify bottlenecks.
16+
17+
With the integrated load testing experience in Azure Functions, you can:
18+
19+
- Create a [URL-based load test](./quickstart-create-and-run-load-test.md) for functions with an HTTP trigger
20+
- View the load test runs associated with a function app
21+
- Create a load testing resource
22+
23+
24+
## Prerequisites
25+
26+
- An Azure account with an active subscription. If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
27+
- A function app with at least one function with an HTTP trigger. If you need to create a function app, see [Getting started with Azure Functions](/azure/azure-functions/functions-get-started).
28+
29+
## Create a load test for a function app
30+
31+
You can create a URL-based load test directly from your Azure Function App in the Azure portal.
32+
33+
To create a load test for a function app:
34+
35+
1. In the [Azure portal](https://portal.azure.com), go to your function app.
36+
37+
1. On the left pane, select **Load Testing (Preview)** under the **Performance** section.
38+
39+
On this page, you can see the list of tests and the load test runs for this function app.
40+
41+
:::image type="content" source="./media/how-to-create-load-test-azure-functions/azure-functions-load-test.png" lightbox="./media/how-to-create-load-test-azure-functions/azure-functions-load-test.png" alt-text="Screenshot that shows Load Testing page in an app in Azure Functions.":::
42+
43+
1. Optionally, select **Create load testing resource** if you don't have a load testing resource yet.
44+
45+
1. Select **Create test** to start creating a URL-based load test for the function app.
46+
47+
1. On the **Create test** page, first enter the test details:
48+
49+
|Field |Description |
50+
|-|-|
51+
| **Load Testing Resource** | Select your load testing resource. |
52+
| **Test name** | Enter a unique test name. |
53+
| **Test description** | (Optional) Enter a load test description. |
54+
| **Run test after creation** | When selected, the load test starts automatically after creating the test. |
55+
56+
57+
1. Select **Add request** to add HTTP requests to the load test:
58+
59+
On the **Add request** page, enter the details for the request:
60+
61+
|Field |Description |
62+
|-|-|
63+
| **Request name** | Unique name within the load test to identify the request. You can use this request name when [defining test criteria](./how-to-define-test-criteria.md). |
64+
| **Function name** | Select the function that you want to test |
65+
| **Key** | Select the key required for accessing the function |
66+
| **HTTP method** | Select an HTTP method from the list. Azure Load Testing supports GET, POST, PUT, DELETE, PATCH, HEAD, and OPTIONS. |
67+
| **Query parameters** | (Optional) Enter query string parameters to append to the URL. |
68+
| **Headers** | (Optional) Enter HTTP headers to include in the HTTP request. |
69+
| **Body** | (Optional) Depending on the HTTP method, you can specify the HTTP body content. Azure Load Testing supports the following formats: raw data, JSON view, JavaScript, HTML, and XML. |
70+
71+
:::image type="content" source="./media/how-to-create-load-test-azure-functions/azure-functions-create-test-add-requests.png" lightbox="./media/how-to-create-load-test-azure-functions/azure-functions-create-test-add-requests.png" alt-text="Screenshot that shows adding requests to a load test in an app in Azure Functions.":::
72+
73+
Learn more about [adding HTTP requests to a load test](./how-to-add-requests-to-url-based-test.md).
74+
75+
1. Select the **Load configuration** tab to configure the load parameters for the load test.
76+
77+
78+
|Field |Description |
79+
|-|-|
80+
| **Engine instances** | Enter the number of load test engine instances. The load test runs in parallel across all the engine instances. |
81+
| **Load pattern** | Select the load pattern (linear, step, spike) for ramping up to the target number of virtual users. |
82+
| **Concurrent users per engine** | Enter the number of *virtual users* to simulate on each of the test engines. The total number of virtual users for the load test is: #test engines * #users per engine. |
83+
| **Test duration (minutes)** | Enter the duration of the load test in minutes. |
84+
| **Ramp-up time (minutes)** | Enter the ramp-up time of the load test in minutes. The ramp-up time is the time it takes to reach the target number of virtual users. |
85+
86+
1. Optionally, configure the network settings if the function app isn't publicly accessible.
87+
88+
Learn more about [load testing privately hosted endpoints](./how-to-test-private-endpoint.md).
89+
90+
:::image type="content" source="./media/how-to-create-load-test-azure-functions/azure-functions-create-test-load-configuration.png" lightbox="./media/how-to-create-load-test-azure-functions/azure-functions-create-test-load-configuration.png" alt-text="Screenshot that shows the load configuration page for creating a test for an app in Azure Functions.":::
91+
92+
93+
1. Select **Review + create** to review the test configuration, and then select **Create** to create the load test.
94+
95+
Azure Load Testing now creates the load test. If you selected **Run test after creation** previously, the load test starts automatically.
96+
97+
> [!NOTE]
98+
> If the test was converted from a URL test to a JMX test directly from the Load Testing resource, the test cannot be modified from the function app.
99+
100+
## View test runs
101+
102+
You can view the list of test runs and a summary overview of the test results directly from within the function app configuration in the Azure portal.
103+
104+
1. In the [Azure portal](https://portal.azure.com), go to your Azure Function App.
105+
106+
1. On the left pane, select **Load testing**.
107+
108+
1. In the **Test runs** tab, you can view the list of test runs for your function app.
109+
110+
For each test run, you can view the test details and a summary of the test outcome, such as average response time, throughput, and error state.
111+
112+
1. Select a test run to go to the Azure Load Testing dashboard and analyze the test run details.
113+
114+
:::image type="content" source="./media/how-to-create-load-test-azure-functions/azure-functions-test-runs-list.png" lightbox="./media/how-to-create-load-test-azure-functions/azure-functions-test-runs-list.png" alt-text="Screenshot that shows the test runs list for an app in Azure Functions.":::
115+
116+
## Next steps
117+
118+
- Learn more about [load testing Azure App Service applications](./concept-load-test-app-service.md).
166 KB
Loading
Loading
181 KB
Loading
159 KB
Loading

articles/load-testing/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ items:
5555
href: how-to-parameterize-load-tests.md
5656
- name: Test App Service web apps
5757
href: how-to-create-load-test-app-service.md
58+
- name: Test Azure Functions
59+
href: how-to-create-load-test-function-app.md
5860
- name: Test private endpoints
5961
displayName: virtual network, vnet, hybrid, on-premises, onprem, private link, subnet
6062
href: how-to-test-private-endpoint.md

0 commit comments

Comments
 (0)