I
I
IvanN7772021-10-04 10:46:28
HTTP headers
IvanN777, 2021-10-04 10:46:28

How to optimize http traffic besides gzip headers?

I pull mercilessly api.
I'm afraid to overload the channel, I use gzip compression.
I can't use websockets because the api is not mine.
Are there any headers other than archiving that can help optimize the query.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rPman, 2021-10-04
@IvanN777

Not universally.
With someone else's server - especially in any way.
Switch to binary versions of the protocol (protobuf is popular), of course the server must be yours.
It often happens that the content of the request (and the response, it is more efficient to compress them) to a greater extent consists of service information (for example, attribute names) and also very often neighboring requests are almost identical, and differ only in some fields, then instead of transferring the entire object, you can transfer only the parts that have changed. It is better to do this at the level where you form a request from an object, or take an already formed data array and calculate diff with the previous one (of the same type, for example, then the data will look like - the identifier of the saved data and diff them with the current ones, for implementation you need to store on both sides the same requests/responses in the cache and replenish/remove them synchronously) - this is easier to implement but not as efficient.
A long time ago, I implemented a very clumsy proxy for transmitting a web page over a slow channel, simply pulling the bdiff console utility, comparing the current output with the previous one and sending only the difference, classic web pages were under a hundred kilobytes of html, but after bdiff only the text difference came, i.e. . content, in a few kilobytes (the page was loaded completely only the first time).
There are packers, libraries (for example, for zstd) that work with an external dictionary, which themselves supplement, do the same in automatic mode and are much more efficient ... I did not use it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question