@nestia/e2e 0.5.0-dev.20240617-3 → 0.5.0-dev.20240617-5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/DynamicBenchmarker.d.ts +61 -0
- package/lib/DynamicBenchmarker.js +127 -0
- package/lib/DynamicBenchmarker.js.map +1 -1
- package/lib/DynamicExecutor.d.ts +11 -6
- package/lib/DynamicExecutor.js +11 -6
- package/lib/DynamicExecutor.js.map +1 -1
- package/package.json +1 -1
- package/src/DynamicBenchmarker.ts +136 -0
- package/src/DynamicExecutor.ts +11 -6
|
@@ -2,6 +2,35 @@ import { IConnection } from "@nestia/fetcher";
|
|
|
2
2
|
import { WorkerServer } from "tgrid";
|
|
3
3
|
import { IBenchmarkMaster } from "./structures/IBenchmarkMaster";
|
|
4
4
|
import { IBenchmarkServant } from "./structures/IBenchmarkServant";
|
|
5
|
+
/**
|
|
6
|
+
* Dynamic benchmark executor running prefixed functions.
|
|
7
|
+
*
|
|
8
|
+
* `DynamicBenchmarker` is composed with two programs,
|
|
9
|
+
* {@link DynamicBenchmarker.master} and
|
|
10
|
+
* {@link DynamicBenchmarker.servant servants}. The master program creates
|
|
11
|
+
* multiple servant programs, and the servant programs execute the prefixed
|
|
12
|
+
* functions in parallel. When the pre-congirued count of requests are all
|
|
13
|
+
* completed, the master program collects the results and returns them.
|
|
14
|
+
*
|
|
15
|
+
* Therefore, when you want to benchmark the performance of a backend server,
|
|
16
|
+
* you have to make two programs; one for calling the
|
|
17
|
+
* {@link DynamicBenchmarker.master} function, and the other for calling the
|
|
18
|
+
* {@link DynamicBenchmarker.servant} function. Also, never forget to write
|
|
19
|
+
* the path of the servant program to the
|
|
20
|
+
* {@link DynamicBenchmarker.IMasterProps.servant} property.
|
|
21
|
+
*
|
|
22
|
+
* Also, you when you complete the benchmark execution through the
|
|
23
|
+
* {@link DynamicBenchmarker.master} and {@link DynamicBenchmarker.servant}
|
|
24
|
+
* functions, you can convert the result to markdown content by using the
|
|
25
|
+
* {@link DynamicBenchmarker.markdown} function.
|
|
26
|
+
*
|
|
27
|
+
* Additionally, if you hope to see some utilization cases,
|
|
28
|
+
* see the below example tagged links.
|
|
29
|
+
*
|
|
30
|
+
* @example https://github.com/samchon/nestia-start/blob/master/test/benchmaark/index.ts
|
|
31
|
+
* @example https://github.com/samchon/backend/blob/master/test/benchmark/index.ts
|
|
32
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
33
|
+
*/
|
|
5
34
|
export declare namespace DynamicBenchmarker {
|
|
6
35
|
/**
|
|
7
36
|
* Properties of the master program.
|
|
@@ -90,7 +119,13 @@ export declare namespace DynamicBenchmarker {
|
|
|
90
119
|
*/
|
|
91
120
|
parameters: (connection: IConnection, name: string) => Parameters;
|
|
92
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Benchmark report.
|
|
124
|
+
*/
|
|
93
125
|
interface IReport {
|
|
126
|
+
count: number;
|
|
127
|
+
threads: number;
|
|
128
|
+
simultaneous: number;
|
|
94
129
|
time: number;
|
|
95
130
|
statistics: IReport.IStatistics;
|
|
96
131
|
endpoints: Array<IReport.IEndpoint & IReport.IStatistics>;
|
|
@@ -109,6 +144,32 @@ export declare namespace DynamicBenchmarker {
|
|
|
109
144
|
maximum: number | null;
|
|
110
145
|
}
|
|
111
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* Master program.
|
|
149
|
+
*
|
|
150
|
+
* Creates a master program that executing the servant programs in parallel.
|
|
151
|
+
*
|
|
152
|
+
* Note that, {@link IMasterProps.servant} property must be the path of
|
|
153
|
+
* the servant program executing the {@link servant} function.
|
|
154
|
+
*
|
|
155
|
+
* @param props Properties of the master program
|
|
156
|
+
* @returns Benchmark report
|
|
157
|
+
*/
|
|
112
158
|
const master: (props: IMasterProps) => Promise<IReport>;
|
|
159
|
+
/**
|
|
160
|
+
* Create a servant program.
|
|
161
|
+
*
|
|
162
|
+
* Creates a servant program executing the prefixed functions in parallel.
|
|
163
|
+
*
|
|
164
|
+
* @param props Properties of the servant program
|
|
165
|
+
* @returns Servant program as a worker server
|
|
166
|
+
*/
|
|
113
167
|
const servant: <Parameters extends any[]>(props: IServantProps<Parameters>) => Promise<WorkerServer<null, IBenchmarkServant, IBenchmarkMaster>>;
|
|
168
|
+
/**
|
|
169
|
+
* Convert the benchmark report to markdown content.
|
|
170
|
+
*
|
|
171
|
+
* @param doc Benchmark report
|
|
172
|
+
* @returns Markdown content
|
|
173
|
+
*/
|
|
174
|
+
const report: (doc: DynamicBenchmarker.IReport) => string;
|
|
114
175
|
}
|
|
@@ -111,11 +111,52 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
111
111
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
112
112
|
exports.DynamicBenchmarker = void 0;
|
|
113
113
|
var fs_1 = __importDefault(require("fs"));
|
|
114
|
+
var os_1 = __importDefault(require("os"));
|
|
114
115
|
var tgrid_1 = require("tgrid");
|
|
115
116
|
var tstl_1 = require("tstl");
|
|
117
|
+
/**
|
|
118
|
+
* Dynamic benchmark executor running prefixed functions.
|
|
119
|
+
*
|
|
120
|
+
* `DynamicBenchmarker` is composed with two programs,
|
|
121
|
+
* {@link DynamicBenchmarker.master} and
|
|
122
|
+
* {@link DynamicBenchmarker.servant servants}. The master program creates
|
|
123
|
+
* multiple servant programs, and the servant programs execute the prefixed
|
|
124
|
+
* functions in parallel. When the pre-congirued count of requests are all
|
|
125
|
+
* completed, the master program collects the results and returns them.
|
|
126
|
+
*
|
|
127
|
+
* Therefore, when you want to benchmark the performance of a backend server,
|
|
128
|
+
* you have to make two programs; one for calling the
|
|
129
|
+
* {@link DynamicBenchmarker.master} function, and the other for calling the
|
|
130
|
+
* {@link DynamicBenchmarker.servant} function. Also, never forget to write
|
|
131
|
+
* the path of the servant program to the
|
|
132
|
+
* {@link DynamicBenchmarker.IMasterProps.servant} property.
|
|
133
|
+
*
|
|
134
|
+
* Also, you when you complete the benchmark execution through the
|
|
135
|
+
* {@link DynamicBenchmarker.master} and {@link DynamicBenchmarker.servant}
|
|
136
|
+
* functions, you can convert the result to markdown content by using the
|
|
137
|
+
* {@link DynamicBenchmarker.markdown} function.
|
|
138
|
+
*
|
|
139
|
+
* Additionally, if you hope to see some utilization cases,
|
|
140
|
+
* see the below example tagged links.
|
|
141
|
+
*
|
|
142
|
+
* @example https://github.com/samchon/nestia-start/blob/master/test/benchmaark/index.ts
|
|
143
|
+
* @example https://github.com/samchon/backend/blob/master/test/benchmark/index.ts
|
|
144
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
145
|
+
*/
|
|
116
146
|
var DynamicBenchmarker;
|
|
117
147
|
(function (DynamicBenchmarker) {
|
|
118
148
|
var _this = this;
|
|
149
|
+
/**
|
|
150
|
+
* Master program.
|
|
151
|
+
*
|
|
152
|
+
* Creates a master program that executing the servant programs in parallel.
|
|
153
|
+
*
|
|
154
|
+
* Note that, {@link IMasterProps.servant} property must be the path of
|
|
155
|
+
* the servant program executing the {@link servant} function.
|
|
156
|
+
*
|
|
157
|
+
* @param props Properties of the master program
|
|
158
|
+
* @returns Benchmark report
|
|
159
|
+
*/
|
|
119
160
|
DynamicBenchmarker.master = function (props) { return __awaiter(_this, void 0, void 0, function () {
|
|
120
161
|
var completes, servants, started_at, events, time, endpoints, events_1, events_1_1, e;
|
|
121
162
|
var e_1, _a;
|
|
@@ -183,6 +224,9 @@ var DynamicBenchmarker;
|
|
|
183
224
|
finally { if (e_1) throw e_1.error; }
|
|
184
225
|
}
|
|
185
226
|
return [2 /*return*/, {
|
|
227
|
+
count: props.count,
|
|
228
|
+
threads: props.threads,
|
|
229
|
+
simultaneous: props.simultaneous,
|
|
186
230
|
time: time,
|
|
187
231
|
statistics: statistics(events),
|
|
188
232
|
endpoints: __spreadArray([], __read(endpoints), false).map(function (it) { return (__assign(__assign({}, statistics(it.second)), it.first)); }),
|
|
@@ -190,6 +234,14 @@ var DynamicBenchmarker;
|
|
|
190
234
|
}
|
|
191
235
|
});
|
|
192
236
|
}); };
|
|
237
|
+
/**
|
|
238
|
+
* Create a servant program.
|
|
239
|
+
*
|
|
240
|
+
* Creates a servant program executing the prefixed functions in parallel.
|
|
241
|
+
*
|
|
242
|
+
* @param props Properties of the servant program
|
|
243
|
+
* @returns Servant program as a worker server
|
|
244
|
+
*/
|
|
193
245
|
DynamicBenchmarker.servant = function (props) { return __awaiter(_this, void 0, void 0, function () {
|
|
194
246
|
var server;
|
|
195
247
|
return __generator(this, function (_a) {
|
|
@@ -208,6 +260,81 @@ var DynamicBenchmarker;
|
|
|
208
260
|
}
|
|
209
261
|
});
|
|
210
262
|
}); };
|
|
263
|
+
/**
|
|
264
|
+
* Convert the benchmark report to markdown content.
|
|
265
|
+
*
|
|
266
|
+
* @param doc Benchmark report
|
|
267
|
+
* @returns Markdown content
|
|
268
|
+
*/
|
|
269
|
+
DynamicBenchmarker.report = function (doc) {
|
|
270
|
+
var format = function (value) {
|
|
271
|
+
return value === null ? "N/A" : (Math.floor(value * 100) / 100).toLocaleString();
|
|
272
|
+
};
|
|
273
|
+
var writeHead = function () {
|
|
274
|
+
return [
|
|
275
|
+
"Type",
|
|
276
|
+
"Count",
|
|
277
|
+
"Success",
|
|
278
|
+
"Mean.",
|
|
279
|
+
"Stdev.",
|
|
280
|
+
"Minimum",
|
|
281
|
+
"Maximum",
|
|
282
|
+
].join(" | ") +
|
|
283
|
+
"\n" +
|
|
284
|
+
new Array(7).fill("----").join("|");
|
|
285
|
+
};
|
|
286
|
+
var writeRow = function (title, statistics) {
|
|
287
|
+
return [
|
|
288
|
+
title,
|
|
289
|
+
statistics.count.toLocaleString(),
|
|
290
|
+
statistics.success.toLocaleString(),
|
|
291
|
+
format(statistics.mean),
|
|
292
|
+
format(statistics.stdev),
|
|
293
|
+
format(statistics.minimum),
|
|
294
|
+
format(statistics.maximum),
|
|
295
|
+
].join(" | ");
|
|
296
|
+
};
|
|
297
|
+
return __spreadArray(__spreadArray(__spreadArray([
|
|
298
|
+
"## Benchmark Report",
|
|
299
|
+
"> - CPU: ".concat(os_1.default.cpus()[0].model),
|
|
300
|
+
"> - RAM: ".concat(Math.floor(os_1.default.totalmem() / 1024 / 1024 / 1024).toLocaleString(), " GB"),
|
|
301
|
+
"> - NodeJS Version: ".concat(process.version),
|
|
302
|
+
"> - Backend Server: 1 core / 1 thread",
|
|
303
|
+
"> - Arguments: ",
|
|
304
|
+
"> - Count: ".concat(doc.count.toLocaleString()),
|
|
305
|
+
"> - Threads: ".concat(doc.threads.toLocaleString()),
|
|
306
|
+
"> - Simultaneous: ".concat(doc.simultaneous.toLocaleString()),
|
|
307
|
+
"> - Total Elapsed Time: ".concat(doc.time.toLocaleString(), " ms"),
|
|
308
|
+
"",
|
|
309
|
+
"### Total",
|
|
310
|
+
writeHead(),
|
|
311
|
+
writeRow("Total", doc.statistics),
|
|
312
|
+
"",
|
|
313
|
+
"### Endpoints",
|
|
314
|
+
writeHead()
|
|
315
|
+
], __read(doc.endpoints
|
|
316
|
+
.slice()
|
|
317
|
+
.sort(function (a, b) { var _a, _b; return ((_a = b.mean) !== null && _a !== void 0 ? _a : 0) - ((_b = a.mean) !== null && _b !== void 0 ? _b : 0); })
|
|
318
|
+
.map(function (endpoint) {
|
|
319
|
+
return writeRow("".concat(endpoint.method, " ").concat(endpoint.path), endpoint);
|
|
320
|
+
})), false), [
|
|
321
|
+
"",
|
|
322
|
+
"### Failures",
|
|
323
|
+
"Method | Path | Count | Success",
|
|
324
|
+
"-------|------|-------|--------"
|
|
325
|
+
], false), __read(doc.endpoints
|
|
326
|
+
.filter(function (e) { return e.success !== e.count; })
|
|
327
|
+
.slice()
|
|
328
|
+
.sort(function (a, b) { return b.count - a.count; })
|
|
329
|
+
.map(function (e) {
|
|
330
|
+
return [
|
|
331
|
+
e.method,
|
|
332
|
+
e.path,
|
|
333
|
+
e.count.toLocaleString(),
|
|
334
|
+
e.success.toLocaleString(),
|
|
335
|
+
].join(" | ");
|
|
336
|
+
})), false).join("\n");
|
|
337
|
+
};
|
|
211
338
|
var execute = function (ctx) {
|
|
212
339
|
return function (mass) { return __awaiter(_this, void 0, void 0, function () {
|
|
213
340
|
var functions, events;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicBenchmarker.js","sourceRoot":"","sources":["../src/DynamicBenchmarker.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,0CAAoB;AACpB,+BAA8D;AAC9D,6BAAqC;AAMrC,IAAiB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"DynamicBenchmarker.js","sourceRoot":"","sources":["../src/DynamicBenchmarker.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,0CAAoB;AACpB,0CAAoB;AACpB,+BAA8D;AAC9D,6BAAqC;AAMrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,IAAiB,kBAAkB,CAwYlC;AAxYD,WAAiB,kBAAkB;;IA6HjC;;;;;;;;;;OAUG;IACU,yBAAM,GAAG,UAAO,KAAmB;;;;;;;;oBACxC,SAAS,GAAa,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;oBAKvD,qBAAM,OAAO,CAAC,GAAG,CACrB,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,UAAO,CAAC;;;;;;wCACxC,SAAS,GAIX,IAAI,uBAAe,CACrB,IAAI,EACJ;4CACE,MAAM,EAAE,MAAA,KAAK,CAAC,MAAM,mCAAI,CAAC,cAAM,OAAA,IAAI,EAAJ,CAAI,CAAC;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Executor` runs every
|
|
5
|
-
*
|
|
6
|
-
* `--include` or `--exclude` option in the CLI (Command Line Interface) level.
|
|
4
|
+
* `DynamicExecutor` runs every (or some filtered) prefixed functions
|
|
5
|
+
* in a specific directory.
|
|
7
6
|
*
|
|
8
|
-
*
|
|
7
|
+
* For reference, it's useful for test program development of a backend server.
|
|
8
|
+
* Just write test functions under a directory, and just specify it.
|
|
9
|
+
* Furthermore, if you compose e2e test programs to utilize the `@nestia/sdk`
|
|
10
|
+
* generated API functions, you can take advantage of {@link DynamicBenchmarker}
|
|
11
|
+
* at the same time.
|
|
9
12
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
13
|
+
* When you want to see some utilization cases, see the below example links.
|
|
14
|
+
*
|
|
15
|
+
* @example https://github.com/samchon/nestia-start/blob/master/test/index.ts
|
|
16
|
+
* @example https://github.com/samchon/backend/blob/master/test/index.ts
|
|
12
17
|
* @author Jeongho Nam - https://github.com/samchon
|
|
13
18
|
*/
|
|
14
19
|
export declare namespace DynamicExecutor {
|
package/lib/DynamicExecutor.js
CHANGED
|
@@ -106,14 +106,19 @@ var StopWatch_1 = require("./StopWatch");
|
|
|
106
106
|
/**
|
|
107
107
|
* Dynamic Executor running prefixed functions.
|
|
108
108
|
*
|
|
109
|
-
* `DynamicExecutor` runs every
|
|
110
|
-
*
|
|
111
|
-
* `--include` or `--exclude` option in the CLI (Command Line Interface) level.
|
|
109
|
+
* `DynamicExecutor` runs every (or some filtered) prefixed functions
|
|
110
|
+
* in a specific directory.
|
|
112
111
|
*
|
|
113
|
-
*
|
|
112
|
+
* For reference, it's useful for test program development of a backend server.
|
|
113
|
+
* Just write test functions under a directory, and just specify it.
|
|
114
|
+
* Furthermore, if you compose e2e test programs to utilize the `@nestia/sdk`
|
|
115
|
+
* generated API functions, you can take advantage of {@link DynamicBenchmarker}
|
|
116
|
+
* at the same time.
|
|
114
117
|
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
118
|
+
* When you want to see some utilization cases, see the below example links.
|
|
119
|
+
*
|
|
120
|
+
* @example https://github.com/samchon/nestia-start/blob/master/test/index.ts
|
|
121
|
+
* @example https://github.com/samchon/backend/blob/master/test/index.ts
|
|
117
122
|
* @author Jeongho Nam - https://github.com/samchon
|
|
118
123
|
*/
|
|
119
124
|
var DynamicExecutor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicExecutor.js","sourceRoot":"","sources":["../src/DynamicExecutor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,0CAAoB;AACpB,8CAA4B;AAE5B,yCAAwC;AAExC
|
|
1
|
+
{"version":3,"file":"DynamicExecutor.js","sourceRoot":"","sources":["../src/DynamicExecutor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAC1B,0CAAoB;AACpB,8CAA4B;AAE5B,yCAAwC;AAExC;;;;;;;;;;;;;;;;;GAiBG;AACH,IAAiB,eAAe,CAiQ/B;AAjQD,WAAiB,eAAe;;IAuH9B;;;;;;;;;OASG;IACU,sBAAM,GACjB,UAA0B,OAA4B;QACtD;;;;WAIG;QACH,OAAA,UAAC,IAAY;YACX,OAAA,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;QAAzB,CAAyB;IAD3B,CAC2B,CAAC;IAE9B;;;;;;;;;OASG;IACU,wBAAQ,GACnB,UAA0B,OAA4B;QACtD;;;;;WAKG;QACH,OAAA,UAAC,IAAY;YACX,OAAA,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;QAA1B,CAA0B;IAD5B,CAC4B,CAA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,EAjQgB,eAAe,+BAAf,eAAe,QAiQ/B"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IConnection } from "@nestia/fetcher";
|
|
2
2
|
import fs from "fs";
|
|
3
|
+
import os from "os";
|
|
3
4
|
import { Driver, WorkerConnector, WorkerServer } from "tgrid";
|
|
4
5
|
import { HashMap, hash } from "tstl";
|
|
5
6
|
|
|
@@ -7,6 +8,35 @@ import { IBenchmarkEvent } from "./structures/IBenchmarkEvent";
|
|
|
7
8
|
import { IBenchmarkMaster } from "./structures/IBenchmarkMaster";
|
|
8
9
|
import { IBenchmarkServant } from "./structures/IBenchmarkServant";
|
|
9
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Dynamic benchmark executor running prefixed functions.
|
|
13
|
+
*
|
|
14
|
+
* `DynamicBenchmarker` is composed with two programs,
|
|
15
|
+
* {@link DynamicBenchmarker.master} and
|
|
16
|
+
* {@link DynamicBenchmarker.servant servants}. The master program creates
|
|
17
|
+
* multiple servant programs, and the servant programs execute the prefixed
|
|
18
|
+
* functions in parallel. When the pre-congirued count of requests are all
|
|
19
|
+
* completed, the master program collects the results and returns them.
|
|
20
|
+
*
|
|
21
|
+
* Therefore, when you want to benchmark the performance of a backend server,
|
|
22
|
+
* you have to make two programs; one for calling the
|
|
23
|
+
* {@link DynamicBenchmarker.master} function, and the other for calling the
|
|
24
|
+
* {@link DynamicBenchmarker.servant} function. Also, never forget to write
|
|
25
|
+
* the path of the servant program to the
|
|
26
|
+
* {@link DynamicBenchmarker.IMasterProps.servant} property.
|
|
27
|
+
*
|
|
28
|
+
* Also, you when you complete the benchmark execution through the
|
|
29
|
+
* {@link DynamicBenchmarker.master} and {@link DynamicBenchmarker.servant}
|
|
30
|
+
* functions, you can convert the result to markdown content by using the
|
|
31
|
+
* {@link DynamicBenchmarker.markdown} function.
|
|
32
|
+
*
|
|
33
|
+
* Additionally, if you hope to see some utilization cases,
|
|
34
|
+
* see the below example tagged links.
|
|
35
|
+
*
|
|
36
|
+
* @example https://github.com/samchon/nestia-start/blob/master/test/benchmaark/index.ts
|
|
37
|
+
* @example https://github.com/samchon/backend/blob/master/test/benchmark/index.ts
|
|
38
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
39
|
+
*/
|
|
10
40
|
export namespace DynamicBenchmarker {
|
|
11
41
|
/**
|
|
12
42
|
* Properties of the master program.
|
|
@@ -105,7 +135,14 @@ export namespace DynamicBenchmarker {
|
|
|
105
135
|
*/
|
|
106
136
|
parameters: (connection: IConnection, name: string) => Parameters;
|
|
107
137
|
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Benchmark report.
|
|
141
|
+
*/
|
|
108
142
|
export interface IReport {
|
|
143
|
+
count: number;
|
|
144
|
+
threads: number;
|
|
145
|
+
simultaneous: number;
|
|
109
146
|
time: number;
|
|
110
147
|
statistics: IReport.IStatistics;
|
|
111
148
|
endpoints: Array<IReport.IEndpoint & IReport.IStatistics>;
|
|
@@ -125,6 +162,17 @@ export namespace DynamicBenchmarker {
|
|
|
125
162
|
}
|
|
126
163
|
}
|
|
127
164
|
|
|
165
|
+
/**
|
|
166
|
+
* Master program.
|
|
167
|
+
*
|
|
168
|
+
* Creates a master program that executing the servant programs in parallel.
|
|
169
|
+
*
|
|
170
|
+
* Note that, {@link IMasterProps.servant} property must be the path of
|
|
171
|
+
* the servant program executing the {@link servant} function.
|
|
172
|
+
*
|
|
173
|
+
* @param props Properties of the master program
|
|
174
|
+
* @returns Benchmark report
|
|
175
|
+
*/
|
|
128
176
|
export const master = async (props: IMasterProps): Promise<IReport> => {
|
|
129
177
|
const completes: number[] = new Array(props.threads).fill(0);
|
|
130
178
|
const servants: WorkerConnector<
|
|
@@ -184,6 +232,9 @@ export namespace DynamicBenchmarker {
|
|
|
184
232
|
)
|
|
185
233
|
.push(e);
|
|
186
234
|
return {
|
|
235
|
+
count: props.count,
|
|
236
|
+
threads: props.threads,
|
|
237
|
+
simultaneous: props.simultaneous,
|
|
187
238
|
time,
|
|
188
239
|
statistics: statistics(events),
|
|
189
240
|
endpoints: [...endpoints].map((it) => ({
|
|
@@ -193,6 +244,14 @@ export namespace DynamicBenchmarker {
|
|
|
193
244
|
};
|
|
194
245
|
};
|
|
195
246
|
|
|
247
|
+
/**
|
|
248
|
+
* Create a servant program.
|
|
249
|
+
*
|
|
250
|
+
* Creates a servant program executing the prefixed functions in parallel.
|
|
251
|
+
*
|
|
252
|
+
* @param props Properties of the servant program
|
|
253
|
+
* @returns Servant program as a worker server
|
|
254
|
+
*/
|
|
196
255
|
export const servant = async <Parameters extends any[]>(
|
|
197
256
|
props: IServantProps<Parameters>,
|
|
198
257
|
): Promise<WorkerServer<null, IBenchmarkServant, IBenchmarkMaster>> => {
|
|
@@ -207,6 +266,83 @@ export namespace DynamicBenchmarker {
|
|
|
207
266
|
return server;
|
|
208
267
|
};
|
|
209
268
|
|
|
269
|
+
/**
|
|
270
|
+
* Convert the benchmark report to markdown content.
|
|
271
|
+
*
|
|
272
|
+
* @param doc Benchmark report
|
|
273
|
+
* @returns Markdown content
|
|
274
|
+
*/
|
|
275
|
+
export const report = (doc: DynamicBenchmarker.IReport): string => {
|
|
276
|
+
const format = (value: number | null) =>
|
|
277
|
+
value === null ? "N/A" : (Math.floor(value * 100) / 100).toLocaleString();
|
|
278
|
+
const writeHead = () =>
|
|
279
|
+
[
|
|
280
|
+
"Type",
|
|
281
|
+
"Count",
|
|
282
|
+
"Success",
|
|
283
|
+
"Mean.",
|
|
284
|
+
"Stdev.",
|
|
285
|
+
"Minimum",
|
|
286
|
+
"Maximum",
|
|
287
|
+
].join(" | ") +
|
|
288
|
+
"\n" +
|
|
289
|
+
new Array(7).fill("----").join("|");
|
|
290
|
+
const writeRow = (
|
|
291
|
+
title: string,
|
|
292
|
+
statistics: DynamicBenchmarker.IReport.IStatistics,
|
|
293
|
+
) =>
|
|
294
|
+
[
|
|
295
|
+
title,
|
|
296
|
+
statistics.count.toLocaleString(),
|
|
297
|
+
statistics.success.toLocaleString(),
|
|
298
|
+
format(statistics.mean),
|
|
299
|
+
format(statistics.stdev),
|
|
300
|
+
format(statistics.minimum),
|
|
301
|
+
format(statistics.maximum),
|
|
302
|
+
].join(" | ");
|
|
303
|
+
return [
|
|
304
|
+
`## Benchmark Report`,
|
|
305
|
+
`> - CPU: ${os.cpus()[0].model}`,
|
|
306
|
+
`> - RAM: ${Math.floor(os.totalmem() / 1024 / 1024 / 1024).toLocaleString()} GB`,
|
|
307
|
+
`> - NodeJS Version: ${process.version}`,
|
|
308
|
+
`> - Backend Server: 1 core / 1 thread`,
|
|
309
|
+
`> - Arguments: `,
|
|
310
|
+
`> - Count: ${doc.count.toLocaleString()}`,
|
|
311
|
+
`> - Threads: ${doc.threads.toLocaleString()}`,
|
|
312
|
+
`> - Simultaneous: ${doc.simultaneous.toLocaleString()}`,
|
|
313
|
+
`> - Total Elapsed Time: ${doc.time.toLocaleString()} ms`,
|
|
314
|
+
"",
|
|
315
|
+
"### Total",
|
|
316
|
+
writeHead(),
|
|
317
|
+
writeRow("Total", doc.statistics),
|
|
318
|
+
"",
|
|
319
|
+
"### Endpoints",
|
|
320
|
+
writeHead(),
|
|
321
|
+
...doc.endpoints
|
|
322
|
+
.slice()
|
|
323
|
+
.sort((a, b) => (b.mean ?? 0) - (a.mean ?? 0))
|
|
324
|
+
.map((endpoint) =>
|
|
325
|
+
writeRow(`${endpoint.method} ${endpoint.path}`, endpoint),
|
|
326
|
+
),
|
|
327
|
+
"",
|
|
328
|
+
"### Failures",
|
|
329
|
+
"Method | Path | Count | Success",
|
|
330
|
+
"-------|------|-------|--------",
|
|
331
|
+
...doc.endpoints
|
|
332
|
+
.filter((e) => e.success !== e.count)
|
|
333
|
+
.slice()
|
|
334
|
+
.sort((a, b) => b.count - a.count)
|
|
335
|
+
.map((e) =>
|
|
336
|
+
[
|
|
337
|
+
e.method,
|
|
338
|
+
e.path,
|
|
339
|
+
e.count.toLocaleString(),
|
|
340
|
+
e.success.toLocaleString(),
|
|
341
|
+
].join(" | "),
|
|
342
|
+
),
|
|
343
|
+
].join("\n");
|
|
344
|
+
};
|
|
345
|
+
|
|
210
346
|
const execute =
|
|
211
347
|
<Parameters extends any[]>(ctx: {
|
|
212
348
|
driver: Driver<IBenchmarkMaster>;
|
package/src/DynamicExecutor.ts
CHANGED
|
@@ -7,14 +7,19 @@ import { StopWatch } from "./StopWatch";
|
|
|
7
7
|
/**
|
|
8
8
|
* Dynamic Executor running prefixed functions.
|
|
9
9
|
*
|
|
10
|
-
* `DynamicExecutor` runs every
|
|
11
|
-
*
|
|
12
|
-
* `--include` or `--exclude` option in the CLI (Command Line Interface) level.
|
|
10
|
+
* `DynamicExecutor` runs every (or some filtered) prefixed functions
|
|
11
|
+
* in a specific directory.
|
|
13
12
|
*
|
|
14
|
-
*
|
|
13
|
+
* For reference, it's useful for test program development of a backend server.
|
|
14
|
+
* Just write test functions under a directory, and just specify it.
|
|
15
|
+
* Furthermore, if you compose e2e test programs to utilize the `@nestia/sdk`
|
|
16
|
+
* generated API functions, you can take advantage of {@link DynamicBenchmarker}
|
|
17
|
+
* at the same time.
|
|
15
18
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
19
|
+
* When you want to see some utilization cases, see the below example links.
|
|
20
|
+
*
|
|
21
|
+
* @example https://github.com/samchon/nestia-start/blob/master/test/index.ts
|
|
22
|
+
* @example https://github.com/samchon/backend/blob/master/test/index.ts
|
|
18
23
|
* @author Jeongho Nam - https://github.com/samchon
|
|
19
24
|
*/
|
|
20
25
|
export namespace DynamicExecutor {
|