0
0
Rest APIprogramming~10 mins

Load testing in Rest API - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Load testing
Start Load Test
Send Multiple Requests
Measure Response Times
Check Server Behavior
Analyze Results
Report Performance
Load testing sends many requests to a server to check how it handles traffic and measures response times.
Execution Sample
Rest API
for i in range(5):
    response = send_request()
    print(f"Request {i+1}: {response.status_code}")
This code sends 5 requests to a server and prints each response status code.
Execution Table
Request NumberActionResponse StatusResponse Time (ms)Server Load
1Send request 1200120Low
2Send request 2200130Low
3Send request 3200125Medium
4Send request 4200140Medium
5Send request 5200150High
-All requests sent--Server stable
💡 All 5 requests completed with status 200; server handled load without errors.
Variable Tracker
VariableStartAfter 1After 2After 3After 4After 5Final
i (request count)0123455
response.status_code-200200200200200200
response_time_ms-120130125140150150
server_loadLowLowLowMediumMediumHighHigh
Key Moments - 2 Insights
Why does the server load increase even though the response status stays 200?
The server load reflects how busy the server is handling requests, but a status 200 means it successfully processed each request regardless of load, as shown in the execution_table rows 3 to 6.
Why do response times increase with more requests?
As more requests are sent, the server works harder, causing response times to rise, visible in the response_time_ms values increasing from 120 to 150 ms in the variable_tracker.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the response time for the 3rd request?
A140 ms
B130 ms
C125 ms
D150 ms
💡 Hint
Check the 'Response Time (ms)' column for Request Number 3 in the execution_table.
At which request number does the server load first become 'Medium'?
ARequest 3
BRequest 2
CRequest 4
DRequest 5
💡 Hint
Look at the 'Server Load' column in the execution_table to find when it changes from 'Low' to 'Medium'.
If the response time for request 5 was 200 ms instead of 150 ms, how would the variable_tracker change?
AThe 'response.status_code' would change to 500
BThe 'response_time_ms' after 5 would be 200 instead of 150
CThe 'server_load' would change to 'Low'
DThe variable 'i' would be 6
💡 Hint
Check the 'response_time_ms' row in variable_tracker for the value after 5 requests.
Concept Snapshot
Load testing sends many requests to a server to check performance.
It measures response times and server load.
Status 200 means success even under load.
Response times usually increase as load grows.
Helps find how many users a server can handle.
Full Transcript
Load testing is a way to check how a server behaves when many users send requests at once. The process starts by sending multiple requests, measuring how long each takes, and watching how busy the server becomes. In the example, five requests are sent one after another. Each request gets a status code 200, meaning success. The response times grow from 120 ms to 150 ms, showing the server is working harder. The server load changes from low to high as more requests come in. This helps understand the server's limits and performance under stress.