HiapShang Lim
HiapShang Lim

Reputation: 29

an image response contains http status code 200 means it fetched to client browser?

I am conducting a load testing using Jmeter to ensure massive of concurrent users able to request the image file from the server.

I have few question on the response code of the image(.png).

  1. If the http status code is 200, does it mean the image fully fetched to the client from the server?

  2. The response code is 200, image will still loading on the browser? or fully loaded?

Upvotes: 1

Views: 2000

Answers (2)

Naveen Kumar R B
Naveen Kumar R B

Reputation: 6398

Following are the answers to your questions:

If the HTTP status code is 200, does it mean the image fully fetched to the client from the server?

Yes. Once you receive the HTTP Response Code, it does mean that complete transfer of the response from Server to Client is done. Please go through TCP/IP model. Data is divided into small TCP packets by Server and Client will combine all of them to form the data (responsibility of Transport Layer). Add screenshot of Wireshark tool to highlight this behaviour.

The response code is 200, image will still loading on the browser? or fully loaded?

Image is fully received by the client (JMeter). But JMeter does not render the output on GUI, not just images any HTTP response. So, the response times of any HTTP requests doesn't include page rendering time, which is a major factor we should consider. if JMeter tells the HTTP response time is x seconds, then from actual end-user perspective, it is x+browser rendering time.

Wireshark image:

enter image description here

Upvotes: 0

Dmitri T
Dmitri T

Reputation: 168082

HTTP is stateful protocol, therefore JMeter sends requests and has to wait for a response. If you getting http status code 200 it normally means that the request is completed successfully, so given your request is well-formed it should mean that the image is fully transferred.

However in some cases you may receive HTTP status code 200 which means that request has completed successfully on transport level, but in the response body you will get an error instead of the image. That's why I would recommend using MD5Hex Assertion which will automatically fail your HTTP Request sampler if image will be different from the expected one.

  1. In the "Advanced" tab of your HTTP Request sampler tick "Save response as MD5 hash" box
  2. Add ND5 Assertion as a child of the HTTP Request and put your image's MD5 checksum into the input field
  3. That's it, HTTP Request sampler will be failed if downloaded image MD5 checksum is different from the provided one

    JMeter MD5

See How to Use JMeter Assertions in Three Easy Steps article for more information on conditionally setting pass/fail criteria on JMeter tests

Upvotes: 1

Related Questions