Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Using gzip to compress large json responses

Options
  • 27-01-2017 3:21pm
    #1
    Registered Users Posts: 872 ✭✭✭


    Hi,

    We have an internal system that makes a number of calls to endpoints on a different server that is also internal. Some of the responses are really huge and i'm looking for ways to improve performance.

    I noticed in the response that there is no header for Content-Encoding:gzip.

    If i asked the devOps guys to add this in the server config for application/json would it make a difference to the response size in any way ?

    Thanks for any advice


Comments

  • Registered Users Posts: 6,150 ✭✭✭Talisman


    Because JSON is text it will compress quite well even at minimal compression settings. However the server will spend valuable CPU time doing the compression, it might not be noticeable in a single user environment but if the server is handling thousands of such requests people might begin to notice.

    If the DevOps people won't play ball with tweaking the server configuration then I would suggest you implement the compression in the application server and decompress the response on the client. Of course this assumes you have the necessary access to make the changes.

    LZ4 would be my recommendation for a compression library, it's widely used and has implementations in practically every language.


  • Registered Users Posts: 26,571 ✭✭✭✭Creamy Goodness


    What kind of data? is it suitable to be paginated and have the user choose when to select the next offset?


Advertisement