You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to get req/sec value from json report, I try to run script for 10 seconds and check difference between first time and last time in json report, I get 7847 ms, and I got very different result then terminal output
http_reqs..................: 38 3.799899/s
From my script
Total requests: 38
exec time: 7847 ms
req/sec: 4.842615012106537
Then I try to save start time and end time in my benchmark:
import{Gauge}from"k6/metrics";varstartCounter=newGauge("start_counter");varendCounter=newGauge("end_counter");exportdefaultfunction(){startCounter.add(Date.now());// my bench codeendCounter.add(Date.now());};
And I got better results:
exec time: 9890
req/sec: 3.8422649140546006 <-- almost good
Is there a better way to do it?
The text was updated successfully, but these errors were encountered:
@Paxa, I'm not completely sure what you're trying to do, can you explain in some more detail?
Regarding the metric timestamps when you output them to a JSON file, they represent the times when the response was received and processed. So, even if you make an HTTP request at t=0, if it takes 2 seconds to receive its response, you're going to see t=2s as the JSON metric timestamp. So, to calculate the req/s, you probably just need to divide the number of request metrics in that JSON file by the duration you specified for the test run.
If you just need the requests per second in a machine readable format, you might want to follow #1168. This PR would allow the exporting of all of the metrics you see in the end-of-test summary as a JSON file, so you don't need to process each individual metric to get the summary.
I would like to get req/sec value from json report, I try to run script for 10 seconds and check difference between first time and last time in json report, I get 7847 ms, and I got very different result then terminal output
From my script
Then I try to save start time and end time in my benchmark:
And I got better results:
Is there a better way to do it?
The text was updated successfully, but these errors were encountered: