title: Apache CXF slow to respond
body: <p>We are in trouble to use of apache cxf.</p>
  
  <p>We use 'Apache CXF 2.2.5' and 'Spring Framework 3.2.10'  for SOAP service in our system.</p>
  
  <p>This is a brief diagram of our system 
  ( see below)</p>
  
  <pre><code>+--------+        +--------------+          +---------------------+   +----------------
  | L4     |-- RB --| Apache Httpd |- mod_jk -| JBoss AS            |---| Spring Framework 3.2.10
  | Switch |        | 2.2.27 (2EA) |          | 7.1.1 (2EA x 4INST) |   | Apache CXF 2.2.5 / JDK 7
  +--------+        +--------------+          +---------------------+   +----------------
  </code></pre>
  
  <p>APM system tells us there is a response delay in our system because of one of the apache cxf method <code>ServletDestination.invoke()</code> when SOAP Messages are incoming about 100 TPS.</p>
  
  <p>It is also reports <code>ServletDestination.invoke()</code> spent over 70 seconds per one transaction.</p>
  
  <p>Our SIB(Service Implementation Bean) works fine (it spent below 1 seconds).</p>
  
  <p>All of our systems OS parameter settings are good.</p>
  
  <pre><code>- open files max : 32767
  - max processes : 300000
  </code></pre>
  
  <p>mod_jk settings are like below (per jboss instance)</p>
  
  <pre><code>- socket_keepalive=true
  - socket_timeout=300
  - connection_pool_size=500
  - connection_pool_minsize=300
  - connection_pool_timeout=60
  </code></pre>
  
  <p>● Source of <code>ServletDestination.invoke()</code> method, Apache CXF 2.2.5</p>
  
  <pre><code>public void invoke(final ServletConfig config,
                     final ServletContext context, 
                     final HttpServletRequest req, 
                     final HttpServletResponse resp) throws IOException {
  
      MessageImpl inMessage = new MessageImpl();
      setupMessage(inMessage,
                   config,
                   context,
                   req,
                   resp);
  
      ExchangeImpl exchange = new ExchangeImpl();
      exchange.setInMessage(inMessage);
      exchange.setSession(new HTTPSession(req));
      inMessage.setDestination(this);
  
      incomingObserver.onMessage(inMessage);
  
  }
  </code></pre>
  
  <p>● Source of <code>AbstractHTTPDestination.setupMessage()</code> method that is called in <code>ServletDestination.invoke()</code>, Apache CXF 2.2.5</p>
  
  <pre><code>protected void setupMessage(Message inMessage,
                              final ServletConfig config,
                              final ServletContext context, 
                              final HttpServletRequest req, 
                              final HttpServletResponse resp) throws IOException {
  
      inMessage.setContent(InputStream.class, req.getInputStream());
      inMessage.put(HTTP_REQUEST, req);
      inMessage.put(HTTP_RESPONSE, resp);
      inMessage.put(HTTP_CONTEXT, context);
      inMessage.put(HTTP_CONFIG, config);
  
      inMessage.put(Message.HTTP_REQUEST_METHOD, req.getMethod());
      inMessage.put(Message.REQUEST_URI, req.getRequestURI());
      String contextPath = req.getContextPath();
      if (contextPath == null) {
          contextPath = "";
      }
      inMessage.put(Message.PATH_INFO, contextPath + req.getPathInfo());
      ....
      ....
  }
  </code></pre>
  
  <p>What problem of our system and how can I do to resolve this problem ?<br>
  Is there any reported bugs on CXF's ServletDestination ?</p>
  
  <p>You can add a comment if you need any additional information.</p>
  
  <p>Best regards.</p>