简体   繁体   English

使用JAX-WS Web服务客户端的初始呼叫-成本及其增强方式

[英]Initial call with a JAX-WS web service client - cost and how it can be enhanced

I have a SOAP Hello World web service built using Metro 2.2. 我有一个使用Metro 2.2构建的SOAP Hello World Web服务。 I have a matching WS client. 我有一个匹配的WS客户端。 I have a local copy of the WSDL clientside. 我有WSDL客户端的本地副本。

My first call is always systematically much more expensive (up to 10x) than the subsequent calls. 我的第一个电话总是系统地比后续的电话贵(最多10倍)。 What causes that? 是什么原因造成的? How can I get around it? 我该如何解决? How can I measure the source of the latency? 如何衡量延迟的来源?

Pointers appreciated. 指针表示赞赏。

(I don't know exactly what's wrong but in some projects I experienced the same behaviour and did some tests and I could gain a lot) (我不知道到底是什么问题,但是在某些项目中,我经历了相同的行为并做了一些测试,因此我可以收获很多)

First I thought that the WSDL or the generated classes (usually caused by the bad WSDL) are the problem. 首先,我认为WSDL或生成的类(通常由不良的WSDL引起)是问题所在。 But if you are just the client, then you can't change this anyway. 但是,如果您只是客户,那么您无论如何都无法更改。

The biggest differences in start up (1-2 min down to 1-2 s for big WSDLs, and also more performance in general) I experienced when I didn't create a jar file for the client, I just created a .bat and .sh to still be able to start the client comfortably (I tried all different jar options, package libraries into the jar is obviously the worst). 在启动过程中最大的不同(对于大型WSDL,从1-2分钟降低到1-2秒,并且总体上还具有更高的性能),当我没有为客户端创建jar文件时,我只是创建了一个.bat和.sh仍然能够舒适地启动客户端(我尝试了所有不同的jar选项,将库打包到jar中显然是最糟糕的)。 Some web service clients with huge WSDL files couldn't be executed at all otherwise (and generating the classes also only worked with CXF and not with Axis). 否则,根本无法执行带有巨大WSDL文件的某些Web服务客户端(并且生成类也仅适用于CXF而不适用于Axis)。

You might also gain something by extracting the libraries. 您还可以通过提取库来获得一些好处。 I guess those huge differences have something to do with unpacking the required classes from the numerous required libraries, but to be honest: I don't know, but it helped in my cases. 我猜这些巨大的差异与从众多必需的库中解压缩所需的类有关,但是老实说:我不知道,但这在我的案例中有所帮助。

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

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