Skip to content

Commit

Permalink
[core-rest-pipeline] WWW-Authenticate challenge perf-stress test (#14659
Browse files Browse the repository at this point in the history
)

This PR is a draft of how the WWW-Authenticate perf-stress would look.

**What this first performance test does:**  

This initial test only sets up a pipeline that does a service request against a fake server that answers once with a WWW-Authenticate challenge, and the next time with a 200. So, the first request will fail, we'll get a challenge, the challenge will be parsed and another request will be sent afterwards, which will succeed.

To run the test, we call to: `npm run perf-test:node -- BearerTokenChallengeAuthenticationPolicyTest --warmup 1 --iterations 1 --parallel 5`.

Here's how it looks when it runs:

```
=== Calling globalSetup() once for (all) the instance(s) of BearerTokenChallengeAuthenticationPolicyTest ===

=== warmup mode, iteration 1. Logs every 1s ===
Current         Total           Average
=== warmup mode, results of iteration 1 ===
Completed 55,001 operations in a weighted-average of 1.00s (55,015.93 ops/s, 0.000 s/op)

=== test mode, iteration 1. Logs every 1s ===
Current         Total           Average
=== test mode, results of iteration 1 ===
Completed 537,426 operations in a weighted-average of 10.00s (53,741.61 ops/s, 0.000 s/op)
```

**Background:**  

Java's perf-stress for challenges uses the ARM kind of challenges, but on TypeScript our more immediate customer is not ARM, but Container Registry and then Key Vault.

This PR uses a copy of the challenge test we have in the main challenge PR: #13888 (this PR hasn't been merged, the plan is to have it merged by next week). Keep in mind that this PR won't pass CI until #13888 is merged.

The idea with this PR is that, besides perf-stress testing a basic scenario, we can use it as the base for further perf-stress tests for core-rest-pipeline.

Fixes #14633
  • Loading branch information
sadasant authored May 3, 2021
1 parent 5d9c0fb commit 0b9d82b
Show file tree
Hide file tree
Showing 9 changed files with 332 additions and 24 deletions.
67 changes: 43 additions & 24 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions rush.json
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,11 @@
"packageName": "@azure-tests/perf-ai-metrics-advisor",
"projectFolder": "sdk/metricsadvisor/perf-tests/ai-metrics-advisor",
"versionPolicyName": "test"
},
{
"packageName": "@azure-tests/perf-core-rest-pipeline",
"projectFolder": "sdk/core/perf-tests/core-rest-pipeline",
"versionPolicyName": "test"
}
]
}
5 changes: 5 additions & 0 deletions sdk/core/perf-tests/core-rest-pipeline/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Release History

## 1.0.0-beta.1 (Unreleased)

- Added a first performance test that processes WWW-Authenticate challenges.
9 changes: 9 additions & 0 deletions sdk/core/perf-tests/core-rest-pipeline/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
### Guide

1. Build the core-rest-pipeline perf tests package `rush build -t perf-core-rest-pipeline`.
3. Copy the `sample.env` file and name it as `.env`.
4. Populate the `.env` file with your Azure Credentials.
5. Refer to the [rate limits](https://docs.microsoft.com/azure/active-directory/enterprise-users/directory-service-limits-restrictions) and then run the tests as follows:

- `bearerTokenChallengeAuthenticationPolicy` test for the `challengeCallbacks`, for simple `WWW-Authenticate` challenges.
- `npm run perf-test:node -- BearerTokenChallengeAuthenticationPolicyTest --warmup 1 --iterations 1 --parallel 5`
48 changes: 48 additions & 0 deletions sdk/core/perf-tests/core-rest-pipeline/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "@azure-tests/perf-core-rest-pipeline",
"version": "1.0.0-beta.1",
"description": "",
"main": "",
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@azure/core-rest-pipeline": "1.1.0-beta.1",
"@azure/core-auth": "^1.3.0",
"@azure/test-utils-perfstress": "^1.0.0",
"dotenv": "^8.2.0"
},
"devDependencies": {
"@types/uuid": "^8.0.0",
"eslint": "^7.15.0",
"prettier": "^1.16.4",
"rimraf": "^3.0.0",
"ts-node": "^9.0.0",
"tslib": "^2.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 --no-eslintrc -c ../../../.eslintrc.internal.json package.json test --ext .ts --fix --fix-type [problem,suggestion]",
"lint": "eslint --no-eslintrc -c ../../../.eslintrc.internal.json package.json test --ext .ts",
"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"
}
}
Empty file.
Loading

0 comments on commit 0b9d82b

Please sign in to comment.