@ooneex/cli 1.25.0 → 1.26.0
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/index.js +86 -1
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -33684,7 +33684,10 @@ function printResults(result) {
|
|
|
33684
33684
|
const dur = result.duration;
|
|
33685
33685
|
w(` ${dim("URL")} ${cyan(result.url)}
|
|
33686
33686
|
`);
|
|
33687
|
+
const successCount = result["2xx"] ?? 0;
|
|
33687
33688
|
w(` ${dim("Total Requests")} ${bold(green(formatNumber(totalRequests)))}
|
|
33689
|
+
`);
|
|
33690
|
+
w(` ${dim("Success (2xx)")} ${successCount > 0 ? green(formatNumber(successCount)) : red("0")}
|
|
33688
33691
|
`);
|
|
33689
33692
|
w(` ${dim("Total Data")} ${formatBytes(totalData)}
|
|
33690
33693
|
`);
|
|
@@ -33717,6 +33720,88 @@ function printResults(result) {
|
|
|
33717
33720
|
}
|
|
33718
33721
|
w(`
|
|
33719
33722
|
`);
|
|
33723
|
+
printPerformanceAnalysis(result);
|
|
33724
|
+
}
|
|
33725
|
+
function printPerformanceAnalysis(result) {
|
|
33726
|
+
const w = process.stdout.write.bind(process.stdout);
|
|
33727
|
+
const line = dim(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
|
|
33728
|
+
w(` ${bold(magenta("Performance Analysis"))}
|
|
33729
|
+
`);
|
|
33730
|
+
w(`${line}
|
|
33731
|
+
`);
|
|
33732
|
+
const avgReqPerSec = result.requests.average;
|
|
33733
|
+
const connections = result.connections;
|
|
33734
|
+
const avgLatencyMs = result.latency.average;
|
|
33735
|
+
const p99LatencyMs = result.latency.p99;
|
|
33736
|
+
const errorRate = result.requests.sent > 0 ? (result.errors + result.non2xx) / result.requests.sent * 100 : 0;
|
|
33737
|
+
const successRate = 100 - errorRate;
|
|
33738
|
+
const latencyHeadroom = p99LatencyMs < 50 ? 4 : p99LatencyMs < 100 ? 3 : p99LatencyMs < 500 ? 2 : 1;
|
|
33739
|
+
const errorFactor = errorRate < 1 ? 1 : errorRate < 5 ? 0.5 : 0.2;
|
|
33740
|
+
const estimatedMaxClients = Math.round(connections * latencyHeadroom * errorFactor);
|
|
33741
|
+
const estimatedMaxReqPerSec = Math.round(result.requests.max * errorFactor);
|
|
33742
|
+
const avgResponseTime = avgLatencyMs;
|
|
33743
|
+
const reqPerConnection = avgReqPerSec / connections;
|
|
33744
|
+
w(` ${dim("Success Rate")} ${successRate >= 99 ? green(`${successRate.toFixed(1)}%`) : successRate >= 95 ? yellow(`${successRate.toFixed(1)}%`) : red(`${successRate.toFixed(1)}%`)}
|
|
33745
|
+
`);
|
|
33746
|
+
w(` ${dim("Avg Resp Time")} ${avgResponseTime < 10 ? green(formatLatency(avgResponseTime)) : avgResponseTime < 100 ? yellow(formatLatency(avgResponseTime)) : red(formatLatency(avgResponseTime))}
|
|
33747
|
+
`);
|
|
33748
|
+
w(` ${dim("Req/Connection")} ${formatNumber(Math.round(reqPerConnection))} req/sec
|
|
33749
|
+
`);
|
|
33750
|
+
w(`
|
|
33751
|
+
`);
|
|
33752
|
+
w(` ${dim("Est. Max Clients")} ${bold(cyan(formatNumber(estimatedMaxClients)))} concurrent
|
|
33753
|
+
`);
|
|
33754
|
+
w(` ${dim("Est. Max Req/Sec")} ${bold(cyan(formatNumber(estimatedMaxReqPerSec)))}
|
|
33755
|
+
`);
|
|
33756
|
+
w(`
|
|
33757
|
+
`);
|
|
33758
|
+
const grade = getPerformanceGrade(avgLatencyMs, p99LatencyMs, errorRate, avgReqPerSec);
|
|
33759
|
+
w(` ${dim("Grade")} ${grade.color(bold(grade.label))}
|
|
33760
|
+
`);
|
|
33761
|
+
w(` ${grade.color(grade.message)}
|
|
33762
|
+
`);
|
|
33763
|
+
w(`
|
|
33764
|
+
`);
|
|
33765
|
+
}
|
|
33766
|
+
function getPerformanceGrade(avgLatency, p99Latency, errorRate, reqPerSec) {
|
|
33767
|
+
let score = 100;
|
|
33768
|
+
if (avgLatency > 500)
|
|
33769
|
+
score -= 40;
|
|
33770
|
+
else if (avgLatency > 100)
|
|
33771
|
+
score -= 25;
|
|
33772
|
+
else if (avgLatency > 50)
|
|
33773
|
+
score -= 15;
|
|
33774
|
+
else if (avgLatency > 10)
|
|
33775
|
+
score -= 5;
|
|
33776
|
+
if (p99Latency > 1000)
|
|
33777
|
+
score -= 25;
|
|
33778
|
+
else if (p99Latency > 500)
|
|
33779
|
+
score -= 15;
|
|
33780
|
+
else if (p99Latency > 100)
|
|
33781
|
+
score -= 8;
|
|
33782
|
+
if (errorRate > 10)
|
|
33783
|
+
score -= 30;
|
|
33784
|
+
else if (errorRate > 5)
|
|
33785
|
+
score -= 20;
|
|
33786
|
+
else if (errorRate > 1)
|
|
33787
|
+
score -= 10;
|
|
33788
|
+
else if (errorRate > 0)
|
|
33789
|
+
score -= 3;
|
|
33790
|
+
if (reqPerSec > 1e4)
|
|
33791
|
+
score = Math.min(100, score + 5);
|
|
33792
|
+
if (score >= 90) {
|
|
33793
|
+
return { label: "A Excellent", message: " Server handles load with low latency and high reliability", color: green };
|
|
33794
|
+
}
|
|
33795
|
+
if (score >= 75) {
|
|
33796
|
+
return { label: "B Good", message: " Server performs well under load with acceptable latency", color: green };
|
|
33797
|
+
}
|
|
33798
|
+
if (score >= 60) {
|
|
33799
|
+
return { label: "C Fair", message: " Server shows moderate latency or occasional errors under load", color: yellow };
|
|
33800
|
+
}
|
|
33801
|
+
if (score >= 40) {
|
|
33802
|
+
return { label: "D Poor", message: " Server struggles with high latency or significant errors", color: red };
|
|
33803
|
+
}
|
|
33804
|
+
return { label: "F Critical", message: " Server cannot handle the load \u2014 consider scaling or optimization", color: red };
|
|
33720
33805
|
}
|
|
33721
33806
|
|
|
33722
33807
|
class BenchmarkRunCommand {
|
|
@@ -50622,4 +50707,4 @@ SeedRunCommand = __legacyDecorateClassTS([
|
|
|
50622
50707
|
// src/index.ts
|
|
50623
50708
|
await run();
|
|
50624
50709
|
|
|
50625
|
-
//# debugId=
|
|
50710
|
+
//# debugId=09575D96B4766A7164756E2164756E21
|