Skip to content

Commit cb4579e

Browse files
committed
✨ Rename Index.razor for better clarity
- Renamed the Index.razor file to enhance clarity. - This change aims to improve the organization of the project structure. - Ensures easier navigation and understanding of the file's purpose. Generated by Copilot
1 parent 21ff043 commit cb4579e

File tree

1 file changed

+98
-6
lines changed
  • TestArena/Blog/PerformanceTesting/basic-setup

1 file changed

+98
-6
lines changed

TestArena/Blog/PerformanceTesting/basic-setup/Index.razor

Lines changed: 98 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,18 +180,110 @@ npx k6-reporter results.json
180180
</Section>
181181
</Section>
182182

183-
183+
<Section Heading="Demo Repository" Level="5">
184+
<p>
185+
The full demo code for this article is available at:
186+
<a href="https://github.com/ajaysskumar/API-Performance-Testing" target="_blank">ajaysskumar/API-Performance-Testing</a>
187+
</p>
188+
<p>
189+
This repository contains:
190+
<ul>
191+
<li><strong>MostBorrowedBookApi</strong>: ASP.NET Core Web API with an in-memory database, seeded with thousands of books and borrows at startup. The endpoint <code>/mostborrowedbook</code> returns the book with the highest borrow count.</li>
192+
<li><strong>k6-mostborrowedbook.js</strong>: K6 test script for load testing the API.</li>
193+
<li><strong>run-perf-test.sh</strong>: Bash script to run the API and K6 test in one shot.</li>
194+
</ul>
195+
</p>
196+
<Section Heading="One-Shot Bash Script" Level="5">
197+
<p>
198+
To run the API and the K6 test together, use the <code>run-perf-test.sh</code> script in the repository root. This script:
199+
</p>
200+
<ul>
201+
<li>Checks if K6 is installed (installs via Homebrew on macOS if needed).</li>
202+
<li>Starts the API in the background.</li>
203+
<li>Waits for the API to start.</li>
204+
<li>Runs the K6 test script.</li>
205+
<li>Stops the API process after the test.</li>
206+
</ul>
207+
<p>
208+
This makes it easy to run the full demo and performance test with a single command.
209+
</p>
210+
</Section>
211+
</Section>
184212
<Section Heading="Understanding K6 Metrics" Level="4">
185213
<p>
186214
After running the test, K6 outputs a summary like this:
187215
</p>
188216
<CodeSnippet Language="text">
189-
checks................: 100.00% ✓ 1000 ✗ 0
190-
http_req_duration....: avg=50ms min=30ms med=45ms max=120ms p(90)=80ms p(95)=100ms
191-
http_reqs............: 1000 100.000000/s
192-
vus..................: 10 min=10 max=10
217+
Running K6 test...
218+
219+
/\ |‾‾| /‾‾/ /‾‾/
220+
/\ / \ | |/ / / /
221+
/ \/ \ | ( / ‾‾\
222+
/ \ | |\ \ | (‾) |
223+
/ __________ \ |__| \__\ \_____/ .io
224+
225+
execution: local
226+
script: k6-mostborrowedbook.js
227+
output: -
228+
229+
scenarios: (100.00%) 1 scenario, 10 max VUs, 40s max duration (incl. graceful stop):
230+
* default: 10 looping VUs for 10s (gracefulStop: 30s)
231+
232+
233+
✓ status is 200
234+
235+
checks.........................: 100.00% ✓ 60 ✗ 0
236+
data_received..................: 14 kB 1.2 kB/s
237+
data_sent......................: 5.8 kB 509 B/s
238+
http_req_blocked...............: avg=1.63ms min=1µs med=6µs max=11.72ms p(90)=11.09ms p(95)=11.33ms
239+
http_req_connecting............: avg=589.03µs min=0s med=0s max=7.52ms p(90)=2.06ms p(95)=4.84ms
240+
http_req_duration..............: avg=874.47ms min=758.66ms med=823.23ms max=1.18s p(90)=1.15s p(95)=1.17s
241+
{ expected_response:true }...: avg=874.47ms min=758.66ms med=823.23ms max=1.18s p(90)=1.15s p(95)=1.17s
242+
http_req_failed................: 0.00% ✓ 0 ✗ 60
243+
http_req_receiving.............: avg=1.09ms min=13µs med=48µs max=11.35ms p(90)=1.23ms p(95)=10.06ms
244+
http_req_sending...............: avg=1.43ms min=5µs med=27.5µs max=9.13ms p(90)=8.22ms p(95)=8.46ms
245+
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
246+
http_req_waiting...............: avg=871.94ms min=758.58ms med=823.17ms max=1.17s p(90)=1.13s p(95)=1.16s
247+
http_reqs......................: 60 5.302087/s
248+
iteration_duration.............: avg=1.87s min=1.75s med=1.82s max=2.2s p(90)=2.18s p(95)=2.19s
249+
iterations.....................: 60 5.302087/s
250+
vus............................: 10 min=10 max=10
251+
vus_max........................: 10 min=10 max=10
252+
253+
254+
running (11.3s), 00/10 VUs, 60 complete and 0 interrupted iterations
255+
default ✓ [======================================] 10 VUs 10s
193256
</CodeSnippet>
194-
<List Heading="Key Metrics" HeadingLevel="4" ChildContents="@k6Metrics" />
257+
<p>
258+
Here’s a breakdown of the key metrics:
259+
</p>
260+
<table class="table table-bordered table-striped" style="margin-top:1rem;">
261+
<thead>
262+
<tr>
263+
<th>Metric</th>
264+
<th>Explanation</th>
265+
</tr>
266+
</thead>
267+
<tbody>
268+
<tr><td><code>checks</code></td><td>Percentage and count of successful checks (assertions), e.g., status 200.</td></tr>
269+
<tr><td><code>data_received</code></td><td>Total and average amount of data received from the server.</td></tr>
270+
<tr><td><code>data_sent</code></td><td>Total and average amount of data sent to the server.</td></tr>
271+
<tr><td><code>http_req_blocked</code></td><td>Time spent waiting for a free TCP connection slot (blocked by OS or client limits).</td></tr>
272+
<tr><td><code>http_req_connecting</code></td><td>Time spent establishing TCP connections to the server.</td></tr>
273+
<tr><td><code>http_req_duration</code></td><td>Total time for request (from start to end, including waiting, sending, receiving).</td></tr>
274+
<tr><td><code>{ expected_response:true }</code></td><td>Duration for requests that received expected responses (usually status 200).</td></tr>
275+
<tr><td><code>http_req_failed</code></td><td>Percentage and count of failed HTTP requests.</td></tr>
276+
<tr><td><code>http_req_receiving</code></td><td>Time spent receiving response data from the server.</td></tr>
277+
<tr><td><code>http_req_sending</code></td><td>Time spent sending request data to the server.</td></tr>
278+
<tr><td><code>http_req_tls_handshaking</code></td><td>Time spent on TLS/SSL handshake (if using HTTPS).</td></tr>
279+
<tr><td><code>http_req_waiting</code></td><td>Time spent waiting for server to respond after sending request (server processing time).</td></tr>
280+
<tr><td><code>http_reqs</code></td><td>Total number of HTTP requests made and average per second.</td></tr>
281+
<tr><td><code>iteration_duration</code></td><td>Total time taken for each test iteration (one virtual user run).</td></tr>
282+
<tr><td><code>iterations</code></td><td>Total number of test iterations and average per second.</td></tr>
283+
<tr><td><code>vus</code></td><td>Number of active virtual users during the test.</td></tr>
284+
<tr><td><code>vus_max</code></td><td>Maximum number of virtual users reached during the test.</td></tr>
285+
</tbody>
286+
</table>
195287
<p>
196288
If you use k6-reporter, you’ll get an HTML file with charts and detailed breakdowns.
197289
</p>

0 commit comments

Comments
 (0)