We're working on a server using spring 4, embedded jetty 9 and jersey. Recently, we moved to jersey 2.13 and we noticed a degradation in performance. I performed some investigations using YourKit. I saw that there is a massive CPU usage in reflection done by jersey. Also, there are many NoSuchMethodExceptions
and ClassNotFoundExceptions
in Yourkit snapshot.

Are there any jersey configuration or a best practice to avoid this issue, or to optimize jersey? Or maybe it is a known issue in jersey 2?
Here are two screenshots from YourKit, showing the hot-spots, after excluding the socket read (java.net.SocketInputStream.socketRead0
). The first one is with Merged Callees:

And the second one is with Back Trace:

Thanks.
By looking at your question I can not pin point the exact issue. But I can suggest you to check the following things:
- Check if there are any duplicate libraries/jars with different versions in your final build
- Check whether you have recommended Spring/jersey transitive dependency/jar versions in your final build
If you are using maven to build your project, then I suggest using the maven dependency tree plugin to check the above mentioned points.
- Chiru
来源:https://stackoverflow.com/questions/27396097/performance-degradation-after-moving-to-jersey-2