0

I'm working on a Spring Boot REST API which uses Jersey.

Data generated by an instrumentation tool indicates that about 100 ms. are being spent on "stuff" which happens after the invoked resource method returns. The instrumentation tool doesn't (out of the box) say what this "stuff" is.

enter image description here

I'm wondering : for a request that takes 437 ms., should I accept that about 100 ms. (or ~25% of the total request time) goes into overhead happening either before and after the actual resource method?

sbrattla
  • 5,274
  • 3
  • 39
  • 63
  • I would say you should accept it if 437 ms meets your requirement and you like the lift that Spring Boot gives you. I'm suspicious of your measurements. – duffymo Sep 05 '18 at 11:57
  • @duffymo I'm doing the measurements as 437 ms. is too long. Apart from optimizing what I'm in control of, it struck me that there was a rather large chunk of "time spent" at the end of the request which I'm a bit puzzled about. – sbrattla Sep 05 '18 at 12:00
  • 1
    Why are you using JAX-RS and not Spring RestController? Just asking.. – Simon Martinelli Sep 05 '18 at 12:22
  • I agree with @SimonMartinelli. I'd use Spring RestController and ditch Jersey. It'll mean one less dependency and I'm guessing better performance. Are you sure that 100 ms is only due to REST? Is there network latency built in, too? – duffymo Sep 05 '18 at 13:17
  • @SimonMartinelli I'm not 100% sure why I ended up with Jersey. Is Spring RestController 100% compatibel with Jersey Rest controllers? – sbrattla Sep 05 '18 at 14:08
  • What do you mean by Jersey Rest controllers? Jersey is JAX-RS and Spring uses it's own API. Have a look at https://spring.io/guides/gs/rest-service/ – Simon Martinelli Sep 05 '18 at 14:10
  • I meant if all annotatipns and the way you create rest resources with e.g. jersey is 1:1 with how spring deals with it. But i guess i'll find out when i read that link. Thanks. – sbrattla Sep 05 '18 at 14:12

0 Answers0