Apache CXF-首次调用时性能很慢

时间:2018-12-26 16:12:00

标签: performance soap cxf

我在SOAP Web服务客户端的Web应用程序上使用Apache CXF 3.2.7。 我通过wsdl2java生成了客户端,并且将端口重新用于调用。 奇怪的行为是,在客户端的第一次调用(并且仅在第一次调用)上,它请求大量时间来发送SOAP请求。这需要20到30秒!!!

  private void init() {

    if (port != null)
        return;
    // initialize the client

   }

   public void call() {
     init();

     long start = System.currentTimeMillis();
     ResponseObject wsResponse = port.getSomething(...);
     long elapsed = System.currentTimeMillis()- start;

   }

分析一些日志,我注意到在发送SOAP请求之前,port.getSomething()需要很多时间。 以下通话非常快。

谷歌搜索,我阅读了一些有关此问题的文章,似乎是CXF的“功能”,但我不知道是否有解决方法

PS:在我看来,这是一种“错误”,因为20到30秒对于现代硬件而言是“荒谬”的时间...

谢谢, 安德里亚

0 个答案:

没有答案