Performance degradation after moving to jersey 2

♀尐吖头ヾ 提交于 2019-12-06 18:54:03

问题


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.


回答1:


By looking at your question I can not pin point the exact issue. But I can suggest you to check the following things:

  1. Check if there are any duplicate libraries/jars with different versions in your final build
  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!