Simulation.log file

Hi folks,

Is it possible to get the total number of bytes downloaded when a request is executed in simulation.log file in Gatling.


Rajat Singh

No, it’s not.
FrontLine has bits/s sent and received by remote hosts though.


Quick example - to get response status code and body length in simulation.log (you’ll need to perform any required analysis yourself as it won’t be included in the Gatling generated reports):

.extraInfoExtractor(extraInfo => List(extraInfo.response.statusCode.get, extraInfo.response.bodyLength))


This can be correct in some cases, typically internal, intra private network API calls.
But it’s definitively wrong from most internet cases: what you have with response.bodyLength is not the number of bytes over the wire but the number of decoded bytes.
What about compression and https encryption?

Thanks for the reply

we need the data for the trend analysis after every build as in simulation.log file starting time of request and ending time of the request is given so from that we can get the response time but for the throughput we need to get download bytes
information from it .


Thanks Barry

I tried in my script i am getting HTTP status code but in place of response body length it is showing value 0
(I am hitting the site and downloading all the resources in it)


Probably related to the site using Chunked encoding - check the Gatling docs on that.

Please also take note of the good point Stéphane makes above: using this method is OK if you’re testing internal services (API calls etc) but not for internet type tests where compression and https is used.