Skip to content
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

Exact documentation of @nestia/benchmark #961

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/benchmark/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestia/benchmark",
"version": "0.1.1",
"version": "0.1.2",
"description": "NestJS Performance Benchmark Program",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand All @@ -22,14 +22,14 @@
"author": "Jeongho Nam",
"license": "MIT",
"devDependencies": {
"@nestia/core": "^3.6.1",
"@nestia/core": "^3.7.0",
"@nestia/e2e": "^0.7.0",
"@nestia/sdk": "^3.6.1",
"@nestia/sdk": "^3.7.0",
"@nestjs/common": "^10.3.10",
"@nestjs/core": "^10.3.10",
"@nestjs/platform-express": "^10.3.10",
"@types/uuid": "^10.0.0",
"nestia": "^5.3.1",
"nestia": "^5.4.0",
"ts-node": "^10.9.2",
"ts-patch": "^3.2.1",
"typescript": "^5.5.3",
Expand All @@ -38,7 +38,7 @@
"uuid": "^10.0.0"
},
"dependencies": {
"@nestia/fetcher": "^3.6.1",
"@nestia/fetcher": "^3.7.0",
"tgrid": "^1.0.2",
"tstl": "^3.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/benchmark/src/DynamicBenchmarker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ export namespace DynamicBenchmarker {
].join(" | ");
return [
`# Benchmark Report`,
"> Generated by [`@nestia/e2e`](https://github.com/samchon/nestia)",
"> Generated by [`@nestia/benchmark`](https://github.com/samchon/nestia)",
``,
` - Specifications`,
` - CPU: ${os.cpus()[0].model}`,
Expand Down
10 changes: 5 additions & 5 deletions website/pages/docs/e2e/benchmark.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { Tabs, Tab } from 'nextra-theme-docs'
## Outline
Benchmark your backend server with e2e test functions.

If you've developed e2e test functions utilizing [SDK library of `@nestia/sdk`](../sdk/sdk), you can re-use those e2e test functions in the benchmark program supported by `@nestia/e2e`. The benchmark program will run these e2e test functions in parellel and randomly to measure the performance of your backend server.
If you've developed e2e test functions utilizing [SDK library of `@nestia/sdk`](../sdk/sdk), you can re-use those e2e test functions in the benchmark program supported by `@nestia/benchmark`. The benchmark program will run these e2e test functions in parellel and randomly to measure the performance of your backend server.

If you want to pre-exprience the benchmark program utliizng the e2e test functions of `@nestia/sdk`, visit below playground website. Also, here is the benchmark report example generated by the benchmark program of `@nestia/e2e` executed in the below playgroud link.
If you want to pre-exprience the benchmark program utliizng the e2e test functions of `@nestia/sdk`, visit below playground website. Also, here is the benchmark report example generated by the benchmark program of `@nestia/benchmark` executed in the below playgroud link.

> 💻 [https://stackblitz.com/~/github.com/samchon/nestia-start](https://stackblitz.com/~/github.com/samchon/nestia-start?file=README.md,docs/benchmarks/AMD%20Ryzen%209%207940HS%20w%20Radeon%20780M%20Graphics.md!,test/benchmark/index.ts,test/benchmark/servant.ts,test/features/api/bbs/test_api_bbs_article_create.ts&startScript=build:test,benchmark&view=editor)
>
Expand All @@ -28,7 +28,7 @@ If you want to pre-exprience the benchmark program utliizng the e2e test functio
]}>
<Tab>
```typescript filename="test/benchmark/index.ts" showLineNumbers {76-94}
import { DynamicBenchmarker } from "@nestia/e2e";
import { DynamicBenchmarker } from "@nestia/benchmark";
import cliProgress from "cli-progress";
import fs from "fs";
import os from "os";
Expand Down Expand Up @@ -152,7 +152,7 @@ main().catch((exp) => {
</Tab>
<Tab>
```typescript filename="test/benchmark/servant.ts" showLineNumbers
import { DynamicBenchmarker } from "@nestia/e2e";
import { DynamicBenchmarker } from "@nestia/benchmark";

import { MyConfiguration } from "../../src/MyConfiguration";

Expand All @@ -171,7 +171,7 @@ DynamicBenchmarker.servant({
</Tab>
</Tabs>

To compose the benchmark program of `@nestia/e2e` on your backend application, you have to create two executable TypeScript programs; the main program and the servant program.
To compose the benchmark program of `@nestia/benchmark` on your backend application, you have to create two executable TypeScript programs; the main program and the servant program.

The main program is executed by user (`npm run benchmark` command in the playground project), and centralizes the benchmark progress. It creates multiple servant programs parallel, and aggregate the benchmark results from them. After the aggregation, it publishes the benchmark report with markdown format.

Expand Down
6 changes: 3 additions & 3 deletions website/pages/docs/e2e/why.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ E2E test functions rather than unit test functions.

When developing a test program for NestJS developed backend server, I recommend to adapt E2E test paradigm instead of unit test paradigm. It's because with the [`@nestia/sdk` generated SDK library](../sdk/sdk), E2E test functions can be much easier, safer and efficient for production than the traditional unit test functions.

Furthermore, if you develop test functions utilizing the SDK library, you can easily switch the e2e test functions to the performance benchmark functions. Just by utilizing `@nestia/e2e` library, you can easily measure your NestJS developed backend server's performance through the SDK library utilizing e2e test functions.
Furthermore, if you develop test functions utilizing the SDK library, you can easily switch the e2e test functions to the performance benchmark functions. Just by utilizing `@nestia/e2e` nd `@nestia/benchmark` libraries, you can easily measure your NestJS developed backend server's performance through the SDK library utilizing e2e test functions.

- [E2E Test Function Example](https://github.com/samchon/nestia-start/blob/master/test/features/api/bbs/test_api_bbs_article_create.ts)
- [Benchmark Result Example](https://github.com/samchon/nestia-start/blob/master/docs/benchmarks/AMD%20Ryzen%209%207940HS%20w%20Radeon%20780M%20Graphics.md)
Expand Down Expand Up @@ -429,7 +429,7 @@ If you want to experience the test program earlier, visit below playground websi
selectedIndex={1}>
<Tab>
```typescript filename="test/benchmark/index.ts" showLineNumbers {76-94}
import { DynamicBenchmarker } from "@nestia/e2e";
import { DynamicBenchmarker } from "@nestia/benchmark";
import cliProgress from "cli-progress";
import fs from "fs";
import os from "os";
Expand Down Expand Up @@ -553,7 +553,7 @@ main().catch((exp) => {
</Tab>
<Tab>
```typescript filename="test/benchmark/servant.ts" showLineNumbers
import { DynamicBenchmarker } from "@nestia/e2e";
import { DynamicBenchmarker } from "@nestia/benchmark";

import { MyConfiguration } from "../../src/MyConfiguration";

Expand Down