blaze-performance-tester 3.1.54 → 3.1.55
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/dist/cli.js +38 -10
- package/dist/index.win32-x64-msvc.node +0 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -151,6 +151,18 @@ var mathUtils = {
|
|
|
151
151
|
return sorted[Math.max(0, index)];
|
|
152
152
|
}
|
|
153
153
|
};
|
|
154
|
+
function getLoadMultiplier(elapsedMs, rampUpMs, steadyMs, rampDownMs) {
|
|
155
|
+
const totalDurationMs = rampUpMs + steadyMs + rampDownMs;
|
|
156
|
+
if (elapsedMs < rampUpMs && rampUpMs > 0) {
|
|
157
|
+
return elapsedMs / rampUpMs;
|
|
158
|
+
} else if (elapsedMs < rampUpMs + steadyMs) {
|
|
159
|
+
return 1;
|
|
160
|
+
} else if (elapsedMs < totalDurationMs && rampDownMs > 0) {
|
|
161
|
+
const timeIntoRampDown = elapsedMs - (rampUpMs + steadyMs);
|
|
162
|
+
return 1 - timeIntoRampDown / rampDownMs;
|
|
163
|
+
}
|
|
164
|
+
return elapsedMs >= totalDurationMs ? 0 : 1;
|
|
165
|
+
}
|
|
154
166
|
async function generateGeminiRCA(history, finalSummary, errorLogs) {
|
|
155
167
|
const apiKey = process.env.GEMINI_API_KEY;
|
|
156
168
|
if (!apiKey) {
|
|
@@ -272,6 +284,8 @@ function parseArguments(args) {
|
|
|
272
284
|
const clusterLogs = !args.includes("--no-cluster-logs");
|
|
273
285
|
let threads = 10;
|
|
274
286
|
let durationSec = 10;
|
|
287
|
+
let rampUpSec = 0;
|
|
288
|
+
let rampDownSec = 0;
|
|
275
289
|
let targetApdex = 0.85;
|
|
276
290
|
let targetErrorRate = 0.01;
|
|
277
291
|
let maxThreads = 300;
|
|
@@ -281,6 +295,10 @@ function parseArguments(args) {
|
|
|
281
295
|
if (threadsIdx !== -1) threads = parseInt(args[threadsIdx + 1], 10);
|
|
282
296
|
const durationIdx = args.indexOf("--duration");
|
|
283
297
|
if (durationIdx !== -1) durationSec = parseInt(args[durationIdx + 1], 10);
|
|
298
|
+
const rampUpIdx = args.indexOf("--ramp-up");
|
|
299
|
+
if (rampUpIdx !== -1) rampUpSec = parseInt(args[rampUpIdx + 1], 10);
|
|
300
|
+
const rampDownIdx = args.indexOf("--ramp-down");
|
|
301
|
+
if (rampDownIdx !== -1) rampDownSec = parseInt(args[rampDownIdx + 1], 10);
|
|
284
302
|
const apdexIdx = args.indexOf("--target-apdex");
|
|
285
303
|
if (apdexIdx !== -1) targetApdex = parseFloat(args[apdexIdx + 1]);
|
|
286
304
|
const errorIdx = args.indexOf("--target-error");
|
|
@@ -315,6 +333,8 @@ function parseArguments(args) {
|
|
|
315
333
|
clusterLogs,
|
|
316
334
|
threads,
|
|
317
335
|
durationSec,
|
|
336
|
+
rampUpSec,
|
|
337
|
+
rampDownSec,
|
|
318
338
|
targetApdex,
|
|
319
339
|
targetErrorRate,
|
|
320
340
|
maxThreads,
|
|
@@ -334,7 +354,7 @@ async function runBlazeCoreEngine(config) {
|
|
|
334
354
|
} catch (err) {
|
|
335
355
|
}
|
|
336
356
|
if (!rawRequests || rawRequests.length === 0) {
|
|
337
|
-
rawRequests = generateSimulationData(config.threads, config.durationSec, config.maxAllowedLatencyMs);
|
|
357
|
+
rawRequests = generateSimulationData(config.threads, config.durationSec, config.maxAllowedLatencyMs, config.rampUpSec, config.rampDownSec);
|
|
338
358
|
}
|
|
339
359
|
const warmUpCutoff = Math.floor(rawRequests.length * 0.1);
|
|
340
360
|
const steadyStateRequests = rawRequests.slice(warmUpCutoff);
|
|
@@ -492,7 +512,7 @@ async function runIntelligentAgenticStressTest(config) {
|
|
|
492
512
|
exportHtmlDashboard(history, config, verdictReason, semanticReport, { total1xx, total2xx, total3xx, total4xx, total5xx, breakdownRates }, finalSummaryCards, lastRawRequests, geminiAnalysisHtml);
|
|
493
513
|
}
|
|
494
514
|
async function runStandardStressTest(config) {
|
|
495
|
-
console.log(`\u{1F3CB}\uFE0F Running Standard Stress Test [Threads: ${config.threads} | Duration: ${config.durationSec}s]`);
|
|
515
|
+
console.log(`\u{1F3CB}\uFE0F Running Standard Stress Test [Threads: ${config.threads} | Duration: ${config.durationSec}s | RampUp: ${config.rampUpSec}s | RampDown: ${config.rampDownSec}s]`);
|
|
496
516
|
const { metrics, rawErrors, rawRequests } = await runBlazeCoreEngine(config);
|
|
497
517
|
printMatrixDashboard(metrics, config.threads);
|
|
498
518
|
const healthScore = computeHealthScoreValue(metrics.apdexScore, metrics.errorRate, metrics.p95LatencyMs, config.maxAllowedLatencyMs);
|
|
@@ -559,15 +579,23 @@ function getFallbackClusterLogs() {
|
|
|
559
579
|
add("HTTP/1.1 504 Gateway Timeout on POST /api/v1/checkout - upstream socket drop after 30000ms", 19);
|
|
560
580
|
return logs;
|
|
561
581
|
}
|
|
562
|
-
function generateSimulationData(threads, durationSec, maxAllowedLatencyMs) {
|
|
582
|
+
function generateSimulationData(threads, durationSec, maxAllowedLatencyMs, rampUpSec = 0, rampDownSec = 0) {
|
|
563
583
|
const data = [];
|
|
564
584
|
const totalRequests = Math.max(15, threads * durationSec * 30);
|
|
565
585
|
const startTime = Date.now();
|
|
586
|
+
const rampUpMs = rampUpSec * 1e3;
|
|
587
|
+
const steadyMs = durationSec * 1e3;
|
|
588
|
+
const rampDownMs = rampDownSec * 1e3;
|
|
589
|
+
const totalTestMs = rampUpMs + steadyMs + rampDownMs;
|
|
566
590
|
const targetThresholdBreak = Math.max(5, Math.floor(maxAllowedLatencyMs * 0.05));
|
|
567
|
-
const isBreached = threads > targetThresholdBreak;
|
|
568
|
-
const stressFactor = isBreached ? Math.pow(threads / targetThresholdBreak, 1.5) : 1;
|
|
569
591
|
const errorPool = getFallbackClusterLogs();
|
|
570
592
|
for (let i = 0; i < totalRequests; i++) {
|
|
593
|
+
const offsetMs = Math.random() * totalTestMs;
|
|
594
|
+
const loadFactor = getLoadMultiplier(offsetMs, rampUpMs, steadyMs, rampDownMs);
|
|
595
|
+
if (loadFactor <= 0) continue;
|
|
596
|
+
const effectiveThreads = Math.max(1, threads * loadFactor);
|
|
597
|
+
const isBreached = effectiveThreads > targetThresholdBreak;
|
|
598
|
+
const stressFactor = isBreached ? Math.pow(effectiveThreads / targetThresholdBreak, 1.5) : 1;
|
|
571
599
|
const isError = Math.random() < (isBreached ? 0.05 : 1e-3);
|
|
572
600
|
const baseLatency = (25 + Math.random() * 35) * stressFactor;
|
|
573
601
|
let errorMessage;
|
|
@@ -579,7 +607,7 @@ function generateSimulationData(threads, durationSec, maxAllowedLatencyMs) {
|
|
|
579
607
|
}
|
|
580
608
|
data.push({
|
|
581
609
|
durationMs: isError ? baseLatency * 0.1 : baseLatency,
|
|
582
|
-
timestampMs: startTime +
|
|
610
|
+
timestampMs: startTime + offsetMs,
|
|
583
611
|
dnsTimeMs: 1 + Math.random() * 0.9,
|
|
584
612
|
tcpTimeMs: 4 + Math.random() * 1.5,
|
|
585
613
|
tlsTimeMs: 6 + Math.random() * 1.8,
|
|
@@ -903,7 +931,7 @@ function exportHtmlDashboard(history, config, verdictReason, semanticReport, res
|
|
|
903
931
|
<div class="container">
|
|
904
932
|
<div class="header">
|
|
905
933
|
<h1>\u{1F525} Blaze Core Performance Analysis</h1>
|
|
906
|
-
<div class="meta">Target Script: <code>${config.targetScript}</code
|
|
934
|
+
<div class="meta">Target Script: <code>${config.targetScript}</code> | Ramp-Up: ${config.rampUpSec}s | Ramp-Down: ${config.rampDownSec}s</div>
|
|
907
935
|
</div>
|
|
908
936
|
|
|
909
937
|
<div class="cards-wrapper">
|
|
@@ -1095,7 +1123,6 @@ function exportHtmlDashboard(history, config, verdictReason, semanticReport, res
|
|
|
1095
1123
|
});
|
|
1096
1124
|
}
|
|
1097
1125
|
|
|
1098
|
-
// Client-side NLP Parser Engine Execution Implementation
|
|
1099
1126
|
function executeNlpQuery(queryString) {
|
|
1100
1127
|
const q = queryString.toLowerCase().trim();
|
|
1101
1128
|
const rows = document.querySelectorAll('#telemetryTableBody tr');
|
|
@@ -1140,7 +1167,8 @@ function exportHtmlDashboard(history, config, verdictReason, semanticReport, res
|
|
|
1140
1167
|
}
|
|
1141
1168
|
});
|
|
1142
1169
|
|
|
1143
|
-
feedback.innerHTML = q === '' ? '' : '\u{1F50D} Match verification resolved <strong>' + matchCount + '</strong> parameters inside telemetry array.';
|
|
1170
|
+
feedback.innerHTML = q === '' ? '' : '\u{1F50D} Match verification resolved <strong>' + matchCount + '</strong> parameters inside telemetry array.';
|
|
1171
|
+
}
|
|
1144
1172
|
|
|
1145
1173
|
function setNlpQuery(str) {
|
|
1146
1174
|
const input = document.getElementById('nlpQueryInput');
|
|
@@ -1337,6 +1365,6 @@ feedback.innerHTML = q === '' ? '' : '\u{1F50D} Match verification resolved <str
|
|
|
1337
1365
|
function printUsage() {
|
|
1338
1366
|
console.log(`Blaze Core Performance Test CLI Engine
|
|
1339
1367
|
Options:
|
|
1340
|
-
--threads <count> | --duration <seconds> | --agentic | --cluster-logs | --correlate | --seo`);
|
|
1368
|
+
--threads <count> | --duration <seconds> | --ramp-up <seconds> | --ramp-down <seconds> | --agentic | --cluster-logs | --correlate | --seo`);
|
|
1341
1369
|
}
|
|
1342
1370
|
main().catch(console.error);
|
|
Binary file
|