How much does an HTTP request cost?

Asked

Viewed 205 times

5

Client

sends a post bodiless to any API

post('api.dominio.com')

Server

returns only 204 status code

return res.status(204)

Assuming the above situation happens, the client makes a request without sending anything (practically a GET), and the server knowing that when that endpoit is requested, must do something and in the end only answer 204, without returning anything else. In this request, the user spent data?

I don’t know if I’m being clear, but my question is more about the HTTP protocol, what is the minimum cost of it? a Status Code consumes data?

  • 1

    Consume yes, even if very little. However there was no lack of communication with the server, pass through the routers to it, request processing, sending the response... There is always consumption. Now, if it was something that affects application performance, then only if the server’s bandwidth and processing is low and the requests are made in thousands at the same time. Same time, I mean, in, say, 10 thousandths of a second, for example... I would like to see a test that can capture how many bytes it consumes in communication, out of curiosity too...

  • 2

    @Rodrigotognin Will depend on the amount of headers from the request/response.

  • @Rodrigotognin answered the question with an example and an approximate measure of the request

1 answer

6


Yes user spent data, you can simulate this behavior by doing your own experiment as shown below:

For that I used the Postman and the Webhook.:

By performing a POST for the generated Webhook URL, you can follow your request by arriving at the site and returning the result to Postman:

inserir a descrição da imagem aqui

You can see in the image that even without passing any body in the request, I sent approximately 307 bytes in headers to the Webhook.site, and in his reply he returned me approximately 380 bytes also in headers, without any content in the body.

Below you can see all information sent and received on the headers of this request:

inserir a descrição da imagem aqui

Even without a body, there is a variation in headers. Everything depends on the amount of information passed and returned, each server/application returns an X amount of data. The best way would be to actually measure by making a request to the API.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.