Search code examples
spring-bootjacksonspring-webjackson-modules

Trying to speed up spring-web endpoint json serialization (afterburner)


I am using Spring Boot 1.5.8 and spring-web 4.3.12. I have noticed that, when I make a request for data from one of our REST endpoints, more time is spent on data serialization than the rest of the operation. I have been looking into strategies to speed things up, and I learned about the Jackson Afterburner module. The spring documentation claims that I only need to create a @Bean in a @Configuration class and the ObjectMapper that is created will have that module registered. Unfortunately, after adding the Spring bean, the serialization performance remains unchanged. What am I doing wrong?

Also, if anyone has any other ideas about how to increase the json serialization performance in a Spring REST controller, I would be very interested in hearing about them.

Thanks in advance.


Solution

  • I have tried the Afterburner module, and I did not notice much (or really any) improvement in performance. Maybe Spring is already using it, or other, optimizations. After looking around a bit, I learned about Kryo, and that seems to help.

    If nobody else posts a suggestion, I will have to accept my own answer, but I will wait for a bit.