1

We have a RESTful API built using ASP.NET Web API, and it is hosted as a Azure cloud service. Recently we had to fix the performance (response time) of an endpoint owing to which we made a few changes. The API request-response needed to remain unchanged. Thus to test that the changes we made didn't alter the response, we benchmarked the responses by capturing it for different users. We captured the following -

  1. Response times (Postman display)
  2. Response size (Postman display)
  3. Response body

enter image description here

Now that we are testing, oddly we see that although the response body is an exact match (done using file compare) the response sizes are order of magnitude different. For instance what was 562.37KB before is now 52.33KB. In fact we had benchmarked 30 users and all the response sizes reduced by one order. But for all the response body is exactly the same.

What could be the possible reason? Is there anything we are missing?

  • 1
    Compression enabled? Look at the headers e.g. For gzip – StuartLC Dec 31 '19 at 05:42
  • I do not think we have enabled the compression just now, because the before and after have been a matter of the last week and now. I will still check it with the devops team though. Thanks for the tip! –  Dec 31 '19 at 05:45
  • What I meant is the compression is there. The response header does contain content-encoding (gzip) but I will check if it was just enabled now. Which would be very surprising. Again thank you! –  Dec 31 '19 at 05:47
  • Postman stores response into cache, to get the freshest response every time from the server, enable `Send no-cache header` from the settings: https://i.stack.imgur.com/SczTp.png – Divyang Desai Dec 31 '19 at 07:51

1 Answers1

0

Size is just the response size when it will be saved inside the memory. This response size is the size of complete response and headers and cookies and everything that has been sent along with the response.

NOTE: The response size that is shown in the Postman is approximate response size and not the exact size.

For details you may refer to

https://www.toolsqa.com/postman/response-in-postman/

https://github.com/postmanlabs/postman-app-support/issues/156

Secondly, it is important to know the difference as detailed in link size and content : Chrome Dev Tools - "Size" vs "Content"

For easy access, a snapshot of the answer is below:

"Size" is the number of bytes on the wire, and "content" is the actual size of the resource. A number of things can make them different, including:

  1. Being served from cache (small or 0 "size")
  2. Response headers, including cookies (larger "size" than "content")
  3. Redirects or authentication requests
  4. gzip compression (smaller "size" than "content", usually
Rv Arora
  • 13
  • 4