-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[App config] Perf tests #15763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[App config] Perf tests #15763
Changes from all commits
acf0f5f
d1fe1a6
2153d83
4c541cf
078edc9
0a8fad7
21cf8d2
fdc1eb3
4fc305a
0fd779b
4b31a06
34fd59d
7afc134
f06fd58
c57d4d4
b4be4fe
db4b861
84ec846
851bec7
d22e04f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| ### Guide | ||
|
|
||
| 1. Build the app-config perf tests package `rush build -t perf-app-configuration`. | ||
| 2. Copy the `sample.env` file and name it as `.env`. | ||
| 3. Create a App Configuration resource and populate the `.env` file with `APPCONFIG_CONNECTION_STRING` variable. | ||
| 4. Run the tests as follows | ||
|
|
||
| - list configuration settings | ||
| - `npm run perf-test:node -- ListSettingsTest --warmup 2 --duration 7 --iterations 2 --parallel 2` | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this service rate-limited?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is throttling similar to Form recognizer or metrics advisor.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if the operation is not a LRO, can you experiment with the number for the parallel param if the limit is not too bad?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The limit is 20,000 requests per hour, it is quite simple to hit the limit. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| { | ||
| "name": "@azure-tests/perf-app-configuration", | ||
| "version": "1.0.0", | ||
| "description": "", | ||
| "main": "", | ||
| "keywords": [], | ||
| "author": "", | ||
| "license": "ISC", | ||
| "dependencies": { | ||
| "@azure/app-configuration": "^1.2.0-beta.2", | ||
| "@azure/core-http": "^2.0.0", | ||
| "@azure/test-utils-perfstress": "^1.0.0", | ||
| "dotenv": "^8.2.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/uuid": "^8.0.0", | ||
| "@types/node": "^8.0.0", | ||
| "uuid": "^8.3.0", | ||
| "tslib": "^2.2.0", | ||
| "ts-node": "^9.0.0", | ||
| "typescript": "~4.2.0" | ||
| }, | ||
| "private": true, | ||
| "scripts": { | ||
| "perf-test:node": "ts-node test/index.spec.ts", | ||
| "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", | ||
| "build": "tsc -p .", | ||
| "build:samples": "echo skipped", | ||
| "build:test": "echo skipped", | ||
| "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", | ||
| "clean": "rimraf dist dist-esm test-dist typings *.tgz *.log", | ||
| "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", | ||
| "integration-test:browser": "echo skipped", | ||
| "integration-test:node": "echo skipped", | ||
| "integration-test": "echo skipped", | ||
| "lint:fix": "eslint package.json src test --ext .ts --fix --fix-type [problem,suggestion]", | ||
| "lint": "eslint package.json src test --ext .ts -f html -o app-config-perf-test-lintReport.html || exit 0", | ||
| "pack": "npm pack 2>&1", | ||
| "prebuild": "npm run clean", | ||
| "unit-test:browser": "echo skipped", | ||
| "unit-test:node": "echo skipped", | ||
| "unit-test": "echo skipped", | ||
| "test:browser": "echo skipped", | ||
| "test:node": "echo skipped", | ||
| "test": "echo skipped" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # This is the connection string for your app-configuration resource | ||
| # You can get this from the Azure portal. | ||
| APPCONFIG_CONNECTION_STRING=<app-configuration connection string goes here> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import { PerfStressTest, getEnvVar } from "@azure/test-utils-perfstress"; | ||
| import { AppConfigurationClient } from "@azure/app-configuration"; | ||
| // Expects the .env file at the same level | ||
| import * as dotenv from "dotenv"; | ||
| dotenv.config(); | ||
|
|
||
| export abstract class AppConfigTest<TOptions> extends PerfStressTest<TOptions> { | ||
| client: AppConfigurationClient; | ||
|
|
||
| constructor() { | ||
| super(); | ||
| const connectionString = getEnvVar("APPCONFIG_CONNECTION_STRING"); | ||
HarshaNalluru marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| this.client = new AppConfigurationClient(connectionString); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import { PerfStressProgram, selectPerfStressTest } from "@azure/test-utils-perfstress"; | ||
| import { ListSettingsTest } from "./listSettings.spec"; | ||
|
|
||
| console.log("=== Starting the perfStress test ==="); | ||
|
|
||
| const perfStressProgram = new PerfStressProgram(selectPerfStressTest([ListSettingsTest])); | ||
|
|
||
| perfStressProgram.run(); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT license. | ||
|
|
||
| import { generateUuid } from "@azure/core-http"; | ||
| import { PerfStressOptionDictionary, executeParallel } from "@azure/test-utils-perfstress"; | ||
| import { AppConfigTest } from "./appConfigBase.spec"; | ||
|
|
||
| interface ListTestOptions { | ||
| /** | ||
| * Number of settings to be created/listed in the test | ||
| */ | ||
| count: number; | ||
HarshaNalluru marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| export class ListSettingsTest extends AppConfigTest<ListTestOptions> { | ||
| static prefix = generateUuid(); | ||
| public options: PerfStressOptionDictionary<ListTestOptions> = { | ||
| count: { | ||
| required: true, | ||
| description: "Number of settings to be listed", | ||
| longName: "count", | ||
| defaultValue: 10 | ||
| } | ||
| }; | ||
|
|
||
| public async globalSetup() { | ||
| await executeParallel( | ||
| async (_count: number, _index: number) => { | ||
| await this.client.addConfigurationSetting({ | ||
| key: ListSettingsTest.prefix + generateUuid(), | ||
| value: "random" | ||
| }); | ||
| }, | ||
| this.parsedOptions.count.value!, | ||
| 32 | ||
| ); | ||
| } | ||
|
|
||
| async runAsync(): Promise<void> { | ||
| for await (const response of this.client | ||
| .listConfigurationSettings({ keyFilter: ListSettingsTest.prefix + "*" }) | ||
| .byPage()) { | ||
| for (const _ of response.items) { | ||
HarshaNalluru marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
| } | ||
|
|
||
| public async globalCleanup() { | ||
| const keys: string[] = []; | ||
| for await (const response of this.client | ||
| .listConfigurationSettings({ keyFilter: ListSettingsTest.prefix + "*" }) | ||
| .byPage()) { | ||
| for (const setting of response.items) { | ||
| keys.push(setting.key); | ||
| } | ||
| } | ||
| await executeParallel( | ||
| async (count: number, _: number) => { | ||
| await this.client.deleteConfigurationSetting({ key: keys[count] }); | ||
| }, | ||
| this.parsedOptions.count.value!, | ||
| 32 | ||
| ); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| "extends": "../../../../tsconfig.package", | ||
| "compilerOptions": { | ||
| "module": "CommonJS", | ||
| "declarationDir": "./typings/latest", | ||
| "lib": [ | ||
| "ES6", | ||
| "ESNext.AsyncIterable" | ||
| ], | ||
| "noEmit": true | ||
| }, | ||
| "compileOnSave": true, | ||
| "include": [ | ||
| "./test/**/*.ts" | ||
| ] | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.