3

JSON which I am passing between my services is very large, so I decided to compress body using gzip. My first idea was to compress the body and then send compressed body as a byte array as below but It unfortunately doesn't work.

@RequestMapping(value = "/save", method = RequestMethod.POST)
public void save(@RequestBody byte[] bytesToDecode) {
   ...
}

Could you give me any tips, how to compress and decompress json while sending It from the one service to another? I'm using Spring Boot and SDR, I will also appreciate any other advices about json sending optimization.

Jo Dung
  • 162
  • 2
  • 18
  • You sending this between two Spring boot aps? How do you send this bytes? It should be possible - images are sent with byte arrays, you can look at examples with images. Also you could have custom serializes/deserializes wich be more efficient than standard serialization - https://mechanical-sympathy.blogspot.gr/2012/07/native-cc-like-performance-for-java.html – Mr Jedi Jun 26 '17 at 10:34
  • Yes between two Spring Boot Apps, i just send compressed bytes as a body. Do you think is this way productive? – Jo Dung Jun 26 '17 at 10:38
  • 1
    maybe you can give a look here http://web-resource-optimization.blogspot.it/2011/06/json-compression-algorithms.html in order to see the best JSON compression – Angelo Immediata Jun 26 '17 at 11:06

0 Answers0