简体   繁体   English

调优WebService

[英]Tuning a WebService

I have a webservice created with CXF. 我有一个用CXF创建的Web服务。 In my service I run an application witch is very time consuming. 在我的服务中,我运行一个应用程序非常耗时。

My application takes about 30 minutes to be executed but inside the webservice it takes about 1 1/2 hours. 我的应用程序大约需要30分钟才能执行,但在Web服务内部大约需要1 1/2个小时。

Is there something I can do that my service gets faster? 我可以做些什么使我的服务变得更快吗?

There isn't any good reason for such a difference (assuming your doing the same work). 这样的差异没有充分的理由(假设您做同样的工作)。 You are going to have to work out what is different about enviroment or the input parameters you are using. 您将必须弄清环境或所使用输入参数的不同之处。

Try turning on -Xverbose:gc it may be that you have just about maxed out the heap on the servlet container and the JVM is speading it's whole life running the garabage collector over and over again. 尝试打开-Xverbose:gc这可能是因为您已使servlet容器上的堆快满了,而JVM却一遍又一遍地运行垃圾收集器。

Note you can also see using jvisualvm which comes with the JDK for free. 注意,您还可以免费使用JDK附带的jvisualvm

I would have a look at the application with jvisualvm in the Sun JDK. 我将在Sun JDK中使用jvisualvm查看该应用程序。

My guess is that you have too little memory in your web service container, and that all the time is spent garbage collecting. 我的猜测是您的Web服务容器中的内存太少,并且所有时间都花在了垃圾收集上。

There really isn't enough information here to solve the issue, you need to figure out what is going on use some sort of tracing/profiling mechanism. 这里真的没有足够的信息来解决问题,您需要弄清楚使用某种跟踪/性能分析机制正在发生什么。 It could be a memory issue. 这可能是内存问题。 I don't know how you're actually launching the app, but it could be that its getting assigned a very low priority thread, vs a more user (high) priority thread when being launched by JUnit. 我不知道您实际上是如何启动该应用程序的,但是可能是因为它被分配了一个非常低优先级的线程,而被JUnit启动时却分配了一个更多用户(高)优先级的线程。 The webservice itself would long time out before half an hour passed, let alone 1.5 hours, so are you using an ASync service or launching your own thread and/or process from the service? Web服务本身会在半小时过去之前很长一段时间,更不用说1.5个小时了,那么您是在使用ASync服务还是从服务中启动自己的线程和/或进程? If its a separate process, how much memory is being allocated to that? 如果它是一个单独的过程,那么将为其分配多少内存?

Once you've gathered this information, you're probably well on your way to really getting your answer. 一旦收集了这些信息,您就可以很好地真正获得答案。

YMMV 青年汽车

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM