Load Testing · Junior · Question 53 of 75
Why add sleep(1) at the end of a k6 iteration?
export default function () {
http.get('https://test.k6.io');
sleep(1);
}- 1To give k6 time to save the response to disk
- 2To add think time so each VU doesn't fire requests nonstop
- 3To wait until the server confirms the previous request
Show the answer
Correct answer: To add think time so each VU doesn't fire requests nonstop
Explanation
Without pauses, each VU hammers the server as fast as responses come back. That's fine for some tests but doesn't model real users.