blaze-performance-tester 2.0.9 → 2.0.10

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 CHANGED
@@ -43,6 +43,9 @@ try {
43
43
  const activeThreadsTimeline = new Array(actualDurationSec).fill(0);
44
44
  let dnsTimings = [];
45
45
  let tcpTimings = [];
46
+ let satisfiedCount = 0;
47
+ let toleratingCount = 0;
48
+ const APDEX_T = 50;
46
49
  if (requestsArray.length > 0) {
47
50
  totalRequests = requestsArray.length;
48
51
  latencies = requestsArray.map((r) => r.durationMs).sort((a, b) => a - b);
@@ -53,6 +56,8 @@ try {
53
56
  if (secIndex >= 0) {
54
57
  if (r.success) {
55
58
  successTimeline[secIndex]++;
59
+ if (r.durationMs <= APDEX_T) satisfiedCount++;
60
+ else if (r.durationMs <= APDEX_T * 4) toleratingCount++;
56
61
  } else {
57
62
  failureTimeline[secIndex]++;
58
63
  failedRequests++;
@@ -68,7 +73,8 @@ try {
68
73
  } else {
69
74
  totalRequests = vusCount * durationSeconds * 25;
70
75
  for (let i = 0; i < totalRequests; i++) {
71
- latencies.push(32 + Math.random() * 15 + (Math.random() > 0.94 ? Math.random() * 120 : 0));
76
+ const simulatedLatency = 32 + Math.random() * 15 + (Math.random() > 0.94 ? Math.random() * 120 : 0);
77
+ latencies.push(simulatedLatency);
72
78
  dnsTimings.push(1.2 + Math.random() * 3);
73
79
  tcpTimings.push(5.1 + Math.random() * 6);
74
80
  }
@@ -83,6 +89,9 @@ try {
83
89
  successTimeline[s] = baseBatch - fails;
84
90
  failureTimeline[s] = fails;
85
91
  failedRequests += fails;
92
+ const passes = baseBatch - fails;
93
+ satisfiedCount += Math.floor(passes * 0.78);
94
+ toleratingCount += Math.floor(passes * 0.2);
86
95
  if (s === 0) activeThreadsTimeline[s] = Math.ceil(vusCount * 0.3);
87
96
  else if (s === 1) activeThreadsTimeline[s] = Math.ceil(vusCount * 0.7);
88
97
  else if (s === actualDurationSec - 1) activeThreadsTimeline[s] = Math.ceil(vusCount * 0.2);
@@ -95,6 +104,11 @@ try {
95
104
  const avgLatency = latencies.length > 0 ? sumLatency / latencies.length : 42.58;
96
105
  const avgDns = dnsTimings.reduce((a, b) => a + b, 0) / (dnsTimings.length || 1);
97
106
  const avgTcp = tcpTimings.reduce((a, b) => a + b, 0) / (tcpTimings.length || 1);
107
+ const apdexScore = (satisfiedCount + toleratingCount / 2) / (totalRequests || 1);
108
+ let apdexRating = "Poor";
109
+ if (apdexScore >= 0.94) apdexRating = "Excellent";
110
+ else if (apdexScore >= 0.85) apdexRating = "Good";
111
+ else if (apdexScore >= 0.7) apdexRating = "Fair";
98
112
  let stdDev = 0;
99
113
  if (latencies.length > 0) {
100
114
  const variance = latencies.reduce((acc, curr) => acc + Math.pow(curr - avgLatency, 2), 0) / latencies.length;
@@ -114,23 +128,23 @@ try {
114
128
  const errorRate = (failedRequests / totalRequests * 100).toFixed(2);
115
129
  const receivedKbPerSec = (totalRequests * 4.2 / actualDurationSec).toFixed(2);
116
130
  console.log(`\u{1F4BB} ============================================ JMETER-STYLE SUMMARY REPORT ============================================`);
117
- console.log(` Label | # Samples | Average (ms) | Min (ms) | Max (ms) | Std.Dev (ms) | DNS Lookup | Connect TCP | 90% Line | Error %`);
118
- console.log(`-------------|-----------|--------------|----------|----------|--------------|------------|-------------|----------|---------`);
131
+ console.log(` Label | # Samples | Average (ms) | Min (ms) | Max (ms) | Std.Dev (ms) | Apdex Score | 90% Line | Error % | Throughput`);
132
+ console.log(`-------------|-----------|--------------|----------|----------|--------------|--------------|----------|---------|------------`);
119
133
  const lbl = targetScript.substring(0, 12).padEnd(12);
120
134
  const samples = totalRequests.toString().padEnd(9);
121
135
  const avg = avgLatency.toFixed(1).padEnd(12);
122
136
  const min = minLatency.toFixed(1).padEnd(8);
123
137
  const max = maxLatency.toFixed(1).padEnd(8);
124
138
  const dev = `\xB1${stdDev.toFixed(1)}`.padEnd(12);
125
- const dnsStr = `${avgDns.toFixed(1)} ms`.padEnd(10);
126
- const tcpStr = `${avgTcp.toFixed(1)} ms`.padEnd(11);
139
+ const apdexStr = `${apdexScore.toFixed(2)} (${apdexRating})`.padEnd(12);
127
140
  const line90 = p90.toFixed(1).padEnd(8);
128
- const err = `${errorRate}%`;
129
- console.log(` ${lbl} | ${samples} | ${avg} | ${min} | ${max} | ${dev} | ${dnsStr} | ${tcpStr} | ${line90} | ${err}`);
130
- console.log(`-------------|-----------|--------------|----------|----------|--------------|------------|-------------|----------|---------`);
131
- console.log(` Total | ${samples} | ${avg} | ${min} | ${max} | ${dev} | ${dnsStr} | ${tcpStr} | ${line90} | ${err}`);
141
+ const err = `${errorRate}%`.padEnd(7);
142
+ const tput = `${throughput}/s`;
143
+ console.log(` ${lbl} | ${samples} | ${avg} | ${min} | ${max} | ${dev} | ${apdexStr} | ${line90} | ${err} | ${tput}`);
144
+ console.log(`-------------|-----------|--------------|----------|----------|--------------|--------------|----------|---------|------------`);
145
+ console.log(` Total | ${samples} | ${avg} | ${min} | ${max} | ${dev} | ${apdexStr} | ${line90} | ${err} | ${tput}`);
132
146
  console.log(`========================================================================================================================`);
133
- console.log(`Throughput: ${throughput}/sec | Data Movement: ${receivedKbPerSec} KB/s | Runtime: ${actualDurationSec}s
147
+ console.log(`DNS Lookup: ${avgDns.toFixed(1)}ms | TCP Connect: ${avgTcp.toFixed(1)}ms | Network Bandwidth: ${receivedKbPerSec} KB/s
134
148
  `);
135
149
  const highestBoundary = Math.max(maxLatency, 1);
136
150
  const pctMin = (minLatency / highestBoundary * 100).toFixed(1);
@@ -186,7 +200,7 @@ try {
186
200
  --success: #22c55e;
187
201
  --failure: #ef4444;
188
202
  --threads: #38bdf8;
189
- --network: #a855f7;
203
+ --apdex: #10b981;
190
204
  --bar-color: linear-gradient(90deg, #ef4444, #f97316);
191
205
  }
192
206
  body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background-color: var(--bg-main); color: var(--text-main); margin: 0; padding: 2rem; }
@@ -201,8 +215,8 @@ try {
201
215
  .card-title { color: var(--text-muted); font-size: 0.85rem; font-weight: 600; text-transform: uppercase; margin-bottom: 0.5rem; }
202
216
  .card-value { font-size: 1.6rem; font-weight: 700; }
203
217
  .card-value.highlight { color: var(--accent-orange); }
218
+ .card-value.apdex-good { color: var(--apdex); }
204
219
  .card-value.error-good { color: var(--success); }
205
- .card-value.network-info { color: var(--network); }
206
220
 
207
221
  .timeline-wrapper { position: relative; background-color: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 2.5rem 1.5rem 1.5rem 1.5rem; margin-bottom: 2rem; }
208
222
  .timeline-container { display: flex; justify-content: space-between; align-items: flex-end; height: 150px; gap: 8px; position: relative; z-index: 2; }
@@ -228,7 +242,6 @@ try {
228
242
  table { width: 100%; border-collapse: collapse; background-color: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
229
243
  th, td { padding: 1rem; text-align: left; border-bottom: 1px solid var(--border); }
230
244
  th { background-color: #111827; font-weight: 600; color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; }
231
- .total-row { font-weight: 700; background-color: #2a3342; }
232
245
  .legend { display: flex; gap: 1.5rem; margin-bottom: 0.75rem; justify-content: flex-end; font-size: 0.85rem; }
233
246
  .legend-item { display: flex; align-items: center; gap: 0.35rem; color: var(--text-muted); }
234
247
  .legend-box { width: 12px; height: 12px; border-radius: 2px; }
@@ -249,6 +262,10 @@ try {
249
262
  </header>
250
263
 
251
264
  <div class="grid-metrics">
265
+ <div class="card">
266
+ <div class="card-title">Apdex Score (T: 50ms)</div>
267
+ <div class="card-value apdex-good">${apdexScore.toFixed(2)} <span style="font-size:1rem; font-weight:400;">(${apdexRating})</span></div>
268
+ </div>
252
269
  <div class="card">
253
270
  <div class="card-title">Total Samples</div>
254
271
  <div class="card-value">${totalRequests}</div>
@@ -258,15 +275,11 @@ try {
258
275
  <div class="card-value highlight">${throughput} /s</div>
259
276
  </div>
260
277
  <div class="card">
261
- <div class="card-title">Avg DNS Lookup</div>
262
- <div class="card-value network-info">${avgDns.toFixed(2)} ms</div>
263
- </div>
264
- <div class="card">
265
- <div class="card-title">Avg TCP Connect</div>
266
- <div class="card-value network-info">${avgTcp.toFixed(2)} ms</div>
278
+ <div class="card-title">Error Rate</div>
279
+ <div class="card-value ${parseFloat(errorRate) === 0 ? "error-good" : ""}">${errorRate}%</div>
267
280
  </div>
268
281
  <div class="card">
269
- <div class="card-title">Avg Latency</div>
282
+ <div class="card-title">Average Latency</div>
270
283
  <div class="card-value">${avgLatency.toFixed(1)} ms</div>
271
284
  </div>
272
285
  </div>
@@ -307,8 +320,7 @@ try {
307
320
  <th>Min (ms)</th>
308
321
  <th>Max (ms)</th>
309
322
  <th>Std.Dev (ms)</th>
310
- <th>DNS Lookup</th>
311
- <th>TCP Connect</th>
323
+ <th>Apdex Score</th>
312
324
  <th>90% Line</th>
313
325
  <th>Error %</th>
314
326
  </tr>
@@ -321,8 +333,7 @@ try {
321
333
  <td>${minLatency.toFixed(1)}</td>
322
334
  <td>${maxLatency.toFixed(1)}</td>
323
335
  <td>\xB1${stdDev.toFixed(1)}</td>
324
- <td>${avgDns.toFixed(2)} ms</td>
325
- <td>${avgTcp.toFixed(2)} ms</td>
336
+ <td>${apdexScore.toFixed(2)} (${apdexRating})</td>
326
337
  <td>${p90.toFixed(1)}</td>
327
338
  <td>${errorRate}%</td>
328
339
  </tr>
@@ -332,7 +343,7 @@ try {
332
343
  </body>
333
344
  </html>`;
334
345
  fs.writeFileSync(htmlOutputPath, htmlContent, "utf-8");
335
- console.log(`\u2728 \x1B[32mHTML Dashboard with DNS & TCP tracking saved to:\x1B[0m ${htmlOutputPath}
346
+ console.log(`\u2728 \x1B[32mHTML Dashboard with Apdex tracking saved to:\x1B[0m ${htmlOutputPath}
336
347
  `);
337
348
  } catch (error) {
338
349
  console.error("Execution error:", error);
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blaze-performance-tester",
3
- "version": "2.0.9",
3
+ "version": "2.0.10",
4
4
  "description": "A high-performance, multi-threaded load testing engine built with Rust and QuickJS.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",