You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Himakar Chennapragada <hi...@us.ibm.com> on 2011/07/15 08:43:07 UTC

Axis2 timeout issue

changing the subject to better describe the content/issue.

Best Regards,
-Himakar
----------------------------------------------------
Himakar Chennapragada
IMS e-Business, SOA Development
IBM Silicon Valley Lab, San Jose, CA
Phone: 408-463-4758, Tie Line: 543-4758
Email: himakar@us.ibm.com
----------------------------------------------------

----- Forwarded by Himakar Chennapragada/Silicon Valley/IBM on 07/14/2011 
11:41 PM -----

From:
Himakar Chennapragada/Silicon Valley/IBM
To:
java-user@axis.apache.org
Date:
07/14/2011 11:40 PM
Subject:
Axis2 question


Hi,
We have an Axis2 timeout issue that we are trying to resolve and need your 
urgent help.  Any input/comments are highly appreciated.  Thanks!

----------------------------------------------------------------------------------------------------------------------------------------
Here is some background information and questions:

We have multiple threads calling out to same or different web services. We 
use a new ServiceClient for each invocation to an external web service 
(same or different service) with the REUSE_HTTP_CLIENT option; each 
invocation has its own set of "Options" as well.  We do that partly 
because the threads doing the invocations can invoke many different web 
services (not just one) and I am sure there is room for improvement in 
that area (see my second question below).

We use Axis2 v1.4.1.

Here are my questions:
1.  We had a timeout issue where the timeout is not being honored properly 
and I put in a patch (see patch details below) and it still does not 
work/honored for larger workloads; for very small workloads it is fine 
tho.  I put in a patch to set timeout for each invocation but it still 
didn't help.  I could see that the new timeout values are being set 
properly (after I applied the patch) in the "options" but no luck.  Any 
idea why the timeouts are not still honored even after applying the patch? 
 (my guess is due to the way we use a new ServiceClient with the HTTP 
REUSE option but I could be wrong).

Patch details:
The patch is applied to 
org.apache.axis2.transport.http.AbstractHTTPSender.class
http://web.archiveorange.com/archive/v/R4VLPPfrNvyJ4cJFywD8
https://issues.apache.org/jira/browse/AXIS2-3160?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

2. Also wondering if it is a good idea to use only one ServiceClient for 
different services?

Best Regards,
-Himakar
----------------------------------------------------
Himakar Chennapragada
IMS e-Business, SOA Development
IBM Silicon Valley Lab, San Jose, CA
Phone: 408-463-4758, Tie Line: 543-4758
Email: himakar@us.ibm.com
----------------------------------------------------







Re: Axis2 timeout issue

Posted by Himakar Chennapragada <hi...@us.ibm.com>.
Hi Afkham,
I do understand those are HTTP client parameters.  I am looking for 
specific help as to why the patch is not working as expected (see patch 
details in the first email of this thread).  Here are more details on the 
problem and observations from different runs after applying the patch.

More details:
1) Did the patch apply properly against 1.4.1 codebase?
Yes, I have added debug/sysouts to the patch and they show the varying 
timeouts for each invocation correctly as expected.  FYI:  the patch is 
found on the Axis2 Jira site for Axis2 1.3 but in our case I have forward 
fitted it for Axis2 1.4.1 that we use.

2) What exactly happens with larger payloads?
With one or two independent invocations the timeouts seem to be honored 
ok.  But when we introduce slight parallelism/light stress with multiple 
invocations I do observe that the timeouts go out-of-whack.

See below the status of 3 different runs and their observations:  timeout1 
is 11secs and timeout2 is 20secs

A) there were many timeouts that are out of whack shown in red
thread 2 - 20 secs ok - timeout2
thread 0 - 20 secs ok - timeout2
thread 4 - 40 secs not ok - timeout2
thread 1 - 40 secs not ok - timeout2
thread 0 - 11 secs ok - timeout1
thread 3 - 60sec not ok - timeout2
thread 4 - 22secs not ok - timeout1
thread 1 - 30secs not ok - timeout1
thread 2 - 35secs not ok - timeout1
thread 0 - 30secs not ok - timeout1

B) another run showing bad timeouts in red

thread 14 - 20 secs ok - timeout2
thread 4 - 20 secs 23 sec not ok - timeout2
thread 1 - 20 secs 37 sec not ok - timeout2

C) This is a special run where I turned off the 'HTTP_REUSE_CLIENT' option 
and everything is fine in this case but as I said there are multiple 
CLOSE_WAITs and we cannot really use this version.  I did this run just to 
observe the behavior and prove a point to myself.

thread 17 - 11 secs ok - timeout1
thread 14 - 11 secs ok - timeout1
thread 16 - 11 secs ok - timeout1
thread 12 - 11 secs ok - timeout1
thread 19 - 11 secs ok - timeout1

thread  4 - 20 secs ok - timeout1
thread  6 - 20 secs ok - timeout1
thread  2 - 20 secs ok - timeout1
thread  8 - 20 secs ok - timeout1
thread 10 - 20 secs ok - timeout1

We don't explicitly use the multithreaded HTTP client today - do you think 
that would make any difference?  When I saw the getHttpClient() method in 
AbstractHTTPSender.java it seemed to be using a multithreaded client under 
the covers even tho it is not explicitly opted for.  Does that sound 
right?  Hope I am looking at the right place.  Btw, 
AbstractHTTPSender.java is the only class that I had to modify for the 
patch and the getHttpClient() method is part of that where they check the 
REUSE option in the ENTIRE IBM Axis2 code base.
Here is the patch class for your reference.  Search for the string "HK" to 
see my changes.  I just added a setTimeouts() method and called that 
method as indicated on the web for the patch.  You will also see my 
debug/sysouts in that method - when running all the timeouts are printed 
correctly for different timeout invocations.


Best Regards,
-Himakar
----------------------------------------------------
Himakar Chennapragada
IMS e-Business, SOA Development
IBM Silicon Valley Lab, San Jose, CA
Phone: 408-463-4758, Tie Line: 543-4758
Email: himakar@us.ibm.com
----------------------------------------------------




From:
Afkham Azeez <af...@gmail.com>
To:
java-dev@axis.apache.org
Date:
07/20/2011 06:46 AM
Subject:
Re: Axis2 timeout issue





On Mon, Jul 18, 2011 at 10:18 PM, Himakar Chennapragada <
himakar@us.ibm.com> wrote:

Hi Afkham, 
Thanks for your response. 

With your approach is it possible to use/set socket timeout to be 
different for different service invocations?  Can it be removed out of the 
getConfigurationContext and put/set it right before the actual call to the 
web service? 

This is a global setting, and is not actually related to the timeout. This 
 configuration changes the Apache commons HTTP client parameters for 
managing the outgoing connections managed in a connection pool.
 

Best Regards,
-Himakar
----------------------------------------------------
Himakar Chennapragada
IMS e-Business, SOA Development
IBM Silicon Valley Lab, San Jose, CA
Phone: 408-463-4758, Tie Line: 543-4758
Email: himakar@us.ibm.com
----------------------------------------------------



From: 
Afkham Azeez <af...@gmail.com> 
To: 
java-dev@axis.apache.org 
Date: 
07/17/2011 08:42 PM 
Subject: 
Re: Axis2 timeout issue




When creating the client configuration context. Create it as follows. 

private ConfigurationContext getClientConfigurationContext() throws 
AxisFault { 
        String clientRepositoryLocation = 
                serverConfig.getFirstProperty(CLIENT_REPOSITORY_LOCATION); 

        String clientAxis2XmlLocationn = 
serverConfig.getFirstProperty(CLIENT_AXIS2_XML_LOCATION); 
        ConfigurationContext clientConfigContext = 
                
ConfigurationContextFactory.createConfigurationContextFromFileSystem( 
                        clientRepositoryLocation, 
clientAxis2XmlLocationn); 
        MultiThreadedHttpConnectionManager httpConnectionManager = new 
MultiThreadedHttpConnectionManager(); 
        HttpConnectionManagerParams params = new 
HttpConnectionManagerParams(); 

        // Set the default max connections per host 
        int defaultMaxConnPerHost = 500; 
        Parameter defaultMaxConnPerHostParam = 
            
clientConfigContext.getAxisConfiguration().getParameter("defaultMaxConnPerHost"); 

        if(defaultMaxConnPerHostParam != null){ 
            defaultMaxConnPerHost = 
Integer.parseInt((String)defaultMaxConnPerHostParam.getValue()); 
        } 
        params.setDefaultMaxConnectionsPerHost(defaultMaxConnPerHost); 

        // Set the max total connections 
        int maxTotalConnections = 15000; 
        Parameter maxTotalConnectionsParam = 
            
clientConfigContext.getAxisConfiguration().getParameter("maxTotalConnections"); 

        if(maxTotalConnectionsParam != null){ 
            maxTotalConnections = 
Integer.parseInt((String)maxTotalConnectionsParam.getValue()); 
        } 
        params.setMaxTotalConnections(maxTotalConnections); 

        params.setSoTimeout(600000); 
        params.setConnectionTimeout(600000); 

        httpConnectionManager.setParams(params); 
        
clientConfigContext.setProperty(HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER, 

                                        httpConnectionManager); 
        registerHouseKeepingTask(clientConfigContext); 
        clientConfigContext.setProperty(ServerConstants.WORK_DIR, 
serverWorkDir); 
        return clientConfigContext; 
    } 

On Fri, Jul 15, 2011 at 12:13 PM, Himakar Chennapragada <
himakar@us.ibm.com> wrote: 

changing the subject to better describe the content/issue. 

Best Regards,
-Himakar
----------------------------------------------------
Himakar Chennapragada
IMS e-Business, SOA Development
IBM Silicon Valley Lab, San Jose, CA
Phone: 408-463-4758, Tie Line: 543-4758
Email: himakar@us.ibm.com
----------------------------------------------------

----- Forwarded by Himakar Chennapragada/Silicon Valley/IBM on 07/14/2011 
11:41 PM ----- 
From: 
Himakar Chennapragada/Silicon Valley/IBM 
To: 
java-user@axis.apache.org 
Date: 
07/14/2011 11:40 PM 
Subject: 
Axis2 question




Hi, 
We have an Axis2 timeout issue that we are trying to resolve and need your 
urgent help.  Any input/comments are highly appreciated.  Thanks! 

---------------------------------------------------------------------------------------------------------------------------------------- 

Here is some background information and questions: 

We have multiple threads calling out to same or different web services. 
 We use a new ServiceClient for each invocation to an external web service 
(same or different service) with the REUSE_HTTP_CLIENT option; each 
invocation has its own set of "Options" as well.  We do that partly 
because the threads doing the invocations can invoke many different web 
services (not just one) and I am sure there is room for improvement in 
that area (see my second question below). 

We use Axis2 v1.4.1. 

Here are my questions: 
1.  We had a timeout issue where the timeout is not being honored properly 
and I put in a patch (see patch details below) and it still does not 
work/honored for larger workloads; for very small workloads it is fine 
tho.  I put in a patch to set timeout for each invocation but it still 
didn't help.  I could see that the new timeout values are being set 
properly (after I applied the patch) in the "options" but no luck.  Any 
idea why the timeouts are not still honored even after applying the patch? 
 (my guess is due to the way we use a new ServiceClient with the HTTP 
REUSE option but I could be wrong). 

Patch details: 
The patch is applied to 
org.apache.axis2.transport.http.AbstractHTTPSender.class 
http://web.archiveorange.com/archive/v/R4VLPPfrNvyJ4cJFywD8 
https://issues.apache.org/jira/browse/AXIS2-3160?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel 


2. Also wondering if it is a good idea to use only one ServiceClient for 
different services? 

Best Regards,
-Himakar
----------------------------------------------------
Himakar Chennapragada
IMS e-Business, SOA Development
IBM Silicon Valley Lab, San Jose, CA
Phone: 408-463-4758, Tie Line: 543-4758
Email: himakar@us.ibm.com
----------------------------------------------------









-- 
Afkham Azeez
Director of Architecture; WSO2, Inc.; http://wso2.com, 
Member; Apache Software Foundation; http://www.apache.org/ 

email: azeez@wso2.com cell: +94 77 3320919
blog: http://blog.afkham.org
twitter: http://twitter.com/afkham_azeez
linked-in: http://lk.linkedin.com/in/afkhamazeez 

Lean . Enterprise . Middleware 






-- 
Afkham Azeez
Director of Architecture; WSO2, Inc.; http://wso2.com, 
Member; Apache Software Foundation; http://www.apache.org/

email: azeez@wso2.com cell: +94 77 3320919
blog: http://blog.afkham.org
twitter: http://twitter.com/afkham_azeez
linked-in: http://lk.linkedin.com/in/afkhamazeez

Lean . Enterprise . Middleware




Re: Axis2 timeout issue

Posted by Afkham Azeez <af...@gmail.com>.
On Mon, Jul 18, 2011 at 10:18 PM, Himakar Chennapragada
<hi...@us.ibm.com>wrote:

>
> Hi Afkham,
> Thanks for your response.
>
> With your approach is it possible to use/set socket timeout to be different
> for different service invocations?  Can it be removed out of the
> getConfigurationContext and put/set it right before the actual call to the
> web service?
>

This is a global setting, and is not actually related to the timeout. This
 configuration changes the Apache commons HTTP client parameters for
managing the outgoing connections managed in a connection pool.


>
> Best Regards,
> -Himakar
> ----------------------------------------------------
> Himakar Chennapragada
> IMS e-Business, SOA Development
> IBM Silicon Valley Lab, San Jose, CA
> Phone: 408-463-4758, Tie Line: 543-4758
> Email: himakar@us.ibm.com
> ----------------------------------------------------
>
>
>
>  From: Afkham Azeez <af...@gmail.com> To: java-dev@axis.apache.org Date: 07/17/2011
> 08:42 PM Subject: Re: Axis2 timeout issue
> ------------------------------
>
>
>
> When creating the client configuration context. Create it as follows.
>
> private ConfigurationContext getClientConfigurationContext() throws
> AxisFault {
>         String clientRepositoryLocation =
>                 serverConfig.getFirstProperty(CLIENT_REPOSITORY_LOCATION);
>         String clientAxis2XmlLocationn =
> serverConfig.getFirstProperty(CLIENT_AXIS2_XML_LOCATION);
>         ConfigurationContext clientConfigContext =
>
> ConfigurationContextFactory.createConfigurationContextFromFileSystem(
>                         clientRepositoryLocation, clientAxis2XmlLocationn);
>         MultiThreadedHttpConnectionManager httpConnectionManager = new
> MultiThreadedHttpConnectionManager();
>         HttpConnectionManagerParams params = new
> HttpConnectionManagerParams();
>
>         // Set the default max connections per host
>         int defaultMaxConnPerHost = 500;
>         Parameter defaultMaxConnPerHostParam =
>
> clientConfigContext.getAxisConfiguration().getParameter("defaultMaxConnPerHost");
>         if(defaultMaxConnPerHostParam != null){
>             defaultMaxConnPerHost =
> Integer.parseInt((String)defaultMaxConnPerHostParam.getValue());
>         }
>         params.setDefaultMaxConnectionsPerHost(defaultMaxConnPerHost);
>
>         // Set the max total connections
>         int maxTotalConnections = 15000;
>         Parameter maxTotalConnectionsParam =
>
> clientConfigContext.getAxisConfiguration().getParameter("maxTotalConnections");
>         if(maxTotalConnectionsParam != null){
>             maxTotalConnections =
> Integer.parseInt((String)maxTotalConnectionsParam.getValue());
>         }
>         params.setMaxTotalConnections(maxTotalConnections);
>
>         params.setSoTimeout(600000);
>         params.setConnectionTimeout(600000);
>
>         httpConnectionManager.setParams(params);
>
> clientConfigContext.setProperty(HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER,
>                                         httpConnectionManager);
>         registerHouseKeepingTask(clientConfigContext);
>         clientConfigContext.setProperty(ServerConstants.WORK_DIR,
> serverWorkDir);
>         return clientConfigContext;
>     }
>
> On Fri, Jul 15, 2011 at 12:13 PM, Himakar Chennapragada <*
> himakar@us.ibm.com* <hi...@us.ibm.com>> wrote:
>
> changing the subject to better describe the content/issue.
>
> Best Regards,
> -Himakar
> ----------------------------------------------------
> Himakar Chennapragada
> IMS e-Business, SOA Development
> IBM Silicon Valley Lab, San Jose, CA
> Phone: *408-463-4758* <408-463-4758>, Tie Line: 543-4758
> Email: *himakar@us.ibm.com* <hi...@us.ibm.com>
> ----------------------------------------------------
>
> ----- Forwarded by Himakar Chennapragada/Silicon Valley/IBM on 07/14/2011
> 11:41 PM -----  From: Himakar Chennapragada/Silicon Valley/IBM  To: *
> java-user@axis.apache.org* <ja...@axis.apache.org>  Date: 07/14/2011
> 11:40 PM  Subject: Axis2 question
>
>  ------------------------------
>
>
> Hi,
> We have an Axis2 timeout issue that we are trying to resolve and need your
> urgent help.  Any input/comments are highly appreciated.  Thanks!
>
>
> ----------------------------------------------------------------------------------------------------------------------------------------
> Here is some background information and questions:
>
> We have multiple threads calling out to *same or different *web services.
>  We use a new ServiceClient for *each invocation* to an external web
> service (same or different service) with the REUSE_HTTP_CLIENT option; each
> invocation has its own set of "Options" as well.  We do that partly because
> the threads doing the invocations can invoke many different web services
> (not just one) and I am sure there is room for improvement in that area (see
> my second question below).
>
> We use *Axis2 v1.4.1*.
>
> Here are my questions:
> 1.  We had a timeout issue where the timeout is not being honored properly
> and I put in a patch (see patch details below) and it still does not
> work/honored for larger workloads; for very small workloads it is fine tho.
>  I put in a patch to set timeout for each invocation but it still didn't
> help.  I could see that the new timeout values are being set properly (after
> I applied the patch) in the "options" but no luck.  Any idea why the
> timeouts are not still honored even after applying the patch?  (my guess is
> due to the way we use a new ServiceClient with the HTTP REUSE option but I
> could be wrong).
>
> Patch details:
> The patch is applied to
> org.apache.axis2.transport.http.AbstractHTTPSender.class *
> **http://web.archiveorange.com/archive/v/R4VLPPfrNvyJ4cJFywD8*<http://web.archiveorange.com/archive/v/R4VLPPfrNvyJ4cJFywD8>
> *
> **
> https://issues.apache.org/jira/browse/AXIS2-3160?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
> *<https://issues.apache.org/jira/browse/AXIS2-3160?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel>
>
> 2. Also wondering if it is a good idea to use only one ServiceClient for
> different services?
>
> Best Regards,
> -Himakar
> ----------------------------------------------------
> Himakar Chennapragada
> IMS e-Business, SOA Development
> IBM Silicon Valley Lab, San Jose, CA
> Phone: *408-463-4758* <408-463-4758>, Tie Line: 543-4758
> Email: *himakar@us.ibm.com* <hi...@us.ibm.com>
> ----------------------------------------------------
>
>
>
>
>
>
>
>
>
> -- *
> Afkham Azeez*
> Director of Architecture; WSO2, Inc.; *http://wso2.com* <http://wso2.com/>
> , *
> Member; Apache Software Foundation; **http://www.apache.org/*<http://www.apache.org/>
>
> *email: **azeez@wso2.com* <az...@wso2.com>* cell: +94 77 3320919
> blog: **http://blog.afkham.org* <http://blog.afkham.org/>*
> twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez>
> *
> linked-in: **http://lk.linkedin.com/in/afkhamazeez*<http://lk.linkedin.com/in/afkhamazeez>
>
> Lean . Enterprise . Middleware
>
>
>
>


-- 
*Afkham Azeez*
Director of Architecture; WSO2, Inc.; http://wso2.com,
*Member; Apache Software Foundation;
**http://www.apache.org/*<http://www.apache.org/>
*
*
*email: **azeez@wso2.com* <az...@wso2.com>* cell: +94 77 3320919
blog: **http://blog.afkham.org* <http://blog.afkham.org>*
twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez>
*
linked-in: **http://lk.linkedin.com/in/afkhamazeez*
*
*
*Lean . Enterprise . Middleware*
*
*

Re: Axis2 timeout issue

Posted by Himakar Chennapragada <hi...@us.ibm.com>.
Hi Afkham,
Thanks for your response.

With your approach is it possible to use/set socket timeout to be 
different for different service invocations?  Can it be removed out of the 
getConfigurationContext and put/set it right before the actual call to the 
web service?

Best Regards,
-Himakar
----------------------------------------------------
Himakar Chennapragada
IMS e-Business, SOA Development
IBM Silicon Valley Lab, San Jose, CA
Phone: 408-463-4758, Tie Line: 543-4758
Email: himakar@us.ibm.com
----------------------------------------------------




From:
Afkham Azeez <af...@gmail.com>
To:
java-dev@axis.apache.org
Date:
07/17/2011 08:42 PM
Subject:
Re: Axis2 timeout issue



When creating the client configuration context. Create it as follows.

private ConfigurationContext getClientConfigurationContext() throws 
AxisFault {
        String clientRepositoryLocation =
                serverConfig.getFirstProperty(CLIENT_REPOSITORY_LOCATION);
        String clientAxis2XmlLocationn = 
serverConfig.getFirstProperty(CLIENT_AXIS2_XML_LOCATION);
        ConfigurationContext clientConfigContext =
                
ConfigurationContextFactory.createConfigurationContextFromFileSystem(
                        clientRepositoryLocation, 
clientAxis2XmlLocationn);
        MultiThreadedHttpConnectionManager httpConnectionManager = new 
MultiThreadedHttpConnectionManager();
        HttpConnectionManagerParams params = new 
HttpConnectionManagerParams();

        // Set the default max connections per host
        int defaultMaxConnPerHost = 500;
        Parameter defaultMaxConnPerHostParam =
            
clientConfigContext.getAxisConfiguration().getParameter("defaultMaxConnPerHost");
        if(defaultMaxConnPerHostParam != null){
            defaultMaxConnPerHost = 
Integer.parseInt((String)defaultMaxConnPerHostParam.getValue());
        }
        params.setDefaultMaxConnectionsPerHost(defaultMaxConnPerHost);

        // Set the max total connections
        int maxTotalConnections = 15000;
        Parameter maxTotalConnectionsParam =
            
clientConfigContext.getAxisConfiguration().getParameter("maxTotalConnections");
        if(maxTotalConnectionsParam != null){
            maxTotalConnections = 
Integer.parseInt((String)maxTotalConnectionsParam.getValue());
        }
        params.setMaxTotalConnections(maxTotalConnections);

        params.setSoTimeout(600000);
        params.setConnectionTimeout(600000);

        httpConnectionManager.setParams(params);
        
clientConfigContext.setProperty(HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER,
                                        httpConnectionManager);
        registerHouseKeepingTask(clientConfigContext);
        clientConfigContext.setProperty(ServerConstants.WORK_DIR, 
serverWorkDir);
        return clientConfigContext;
    }

On Fri, Jul 15, 2011 at 12:13 PM, Himakar Chennapragada <
himakar@us.ibm.com> wrote:

changing the subject to better describe the content/issue. 

Best Regards,
-Himakar
----------------------------------------------------
Himakar Chennapragada
IMS e-Business, SOA Development
IBM Silicon Valley Lab, San Jose, CA
Phone: 408-463-4758, Tie Line: 543-4758
Email: himakar@us.ibm.com
----------------------------------------------------

----- Forwarded by Himakar Chennapragada/Silicon Valley/IBM on 07/14/2011 
11:41 PM ----- 
From: 
Himakar Chennapragada/Silicon Valley/IBM 
To: 
java-user@axis.apache.org 
Date: 
07/14/2011 11:40 PM 
Subject: 
Axis2 question



Hi, 
We have an Axis2 timeout issue that we are trying to resolve and need your 
urgent help.  Any input/comments are highly appreciated.  Thanks! 

---------------------------------------------------------------------------------------------------------------------------------------- 

Here is some background information and questions: 

We have multiple threads calling out to same or different web services. 
 We use a new ServiceClient for each invocation to an external web service 
(same or different service) with the REUSE_HTTP_CLIENT option; each 
invocation has its own set of "Options" as well.  We do that partly 
because the threads doing the invocations can invoke many different web 
services (not just one) and I am sure there is room for improvement in 
that area (see my second question below). 

We use Axis2 v1.4.1. 

Here are my questions: 
1.  We had a timeout issue where the timeout is not being honored properly 
and I put in a patch (see patch details below) and it still does not 
work/honored for larger workloads; for very small workloads it is fine 
tho.  I put in a patch to set timeout for each invocation but it still 
didn't help.  I could see that the new timeout values are being set 
properly (after I applied the patch) in the "options" but no luck.  Any 
idea why the timeouts are not still honored even after applying the patch? 
 (my guess is due to the way we use a new ServiceClient with the HTTP 
REUSE option but I could be wrong). 

Patch details: 
The patch is applied to 
org.apache.axis2.transport.http.AbstractHTTPSender.class 
http://web.archiveorange.com/archive/v/R4VLPPfrNvyJ4cJFywD8 
https://issues.apache.org/jira/browse/AXIS2-3160?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel 


2. Also wondering if it is a good idea to use only one ServiceClient for 
different services? 

Best Regards,
-Himakar
----------------------------------------------------
Himakar Chennapragada
IMS e-Business, SOA Development
IBM Silicon Valley Lab, San Jose, CA
Phone: 408-463-4758, Tie Line: 543-4758
Email: himakar@us.ibm.com
----------------------------------------------------









-- 
Afkham Azeez
Director of Architecture; WSO2, Inc.; http://wso2.com, 
Member; Apache Software Foundation; http://www.apache.org/

email: azeez@wso2.com cell: +94 77 3320919
blog: http://blog.afkham.org
twitter: http://twitter.com/afkham_azeez
linked-in: http://lk.linkedin.com/in/afkhamazeez

Lean . Enterprise . Middleware




Re: Axis2 timeout issue

Posted by Afkham Azeez <af...@gmail.com>.
When creating the client configuration context. Create it as follows.

private ConfigurationContext getClientConfigurationContext() throws
AxisFault {
        String clientRepositoryLocation =
                serverConfig.getFirstProperty(CLIENT_REPOSITORY_LOCATION);
        String clientAxis2XmlLocationn =
serverConfig.getFirstProperty(CLIENT_AXIS2_XML_LOCATION);
        ConfigurationContext clientConfigContext =

ConfigurationContextFactory.createConfigurationContextFromFileSystem(
                        clientRepositoryLocation, clientAxis2XmlLocationn);
        MultiThreadedHttpConnectionManager httpConnectionManager = new
MultiThreadedHttpConnectionManager();
        HttpConnectionManagerParams params = new
HttpConnectionManagerParams();

        // Set the default max connections per host
        int defaultMaxConnPerHost = 500;
        Parameter defaultMaxConnPerHostParam =

clientConfigContext.getAxisConfiguration().getParameter("defaultMaxConnPerHost");
        if(defaultMaxConnPerHostParam != null){
            defaultMaxConnPerHost =
Integer.parseInt((String)defaultMaxConnPerHostParam.getValue());
        }
        params.setDefaultMaxConnectionsPerHost(defaultMaxConnPerHost);

        // Set the max total connections
        int maxTotalConnections = 15000;
        Parameter maxTotalConnectionsParam =

clientConfigContext.getAxisConfiguration().getParameter("maxTotalConnections");
        if(maxTotalConnectionsParam != null){
            maxTotalConnections =
Integer.parseInt((String)maxTotalConnectionsParam.getValue());
        }
        params.setMaxTotalConnections(maxTotalConnections);

        params.setSoTimeout(600000);
        params.setConnectionTimeout(600000);

        httpConnectionManager.setParams(params);

clientConfigContext.setProperty(HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER,
                                        httpConnectionManager);
        registerHouseKeepingTask(clientConfigContext);
        clientConfigContext.setProperty(ServerConstants.WORK_DIR,
serverWorkDir);
        return clientConfigContext;
    }

On Fri, Jul 15, 2011 at 12:13 PM, Himakar Chennapragada
<hi...@us.ibm.com>wrote:

>
> changing the subject to better describe the content/issue.
>
> Best Regards,
> -Himakar
> ----------------------------------------------------
> Himakar Chennapragada
> IMS e-Business, SOA Development
> IBM Silicon Valley Lab, San Jose, CA
> Phone: 408-463-4758, Tie Line: 543-4758
> Email: himakar@us.ibm.com
> ----------------------------------------------------
>
> ----- Forwarded by Himakar Chennapragada/Silicon Valley/IBM on 07/14/2011
> 11:41 PM -----
>  From: Himakar Chennapragada/Silicon Valley/IBM To:
> java-user@axis.apache.org Date: 07/14/2011 11:40 PM Subject: Axis2
> question
> ------------------------------
>
>
> Hi,
> We have an Axis2 timeout issue that we are trying to resolve and need your
> urgent help.  Any input/comments are highly appreciated.  Thanks!
>
>
> ----------------------------------------------------------------------------------------------------------------------------------------
> Here is some background information and questions:
>
> We have multiple threads calling out to *same or different *web services.
>  We use a new ServiceClient for *each invocation* to an external web
> service (same or different service) with the REUSE_HTTP_CLIENT option; each
> invocation has its own set of "Options" as well.  We do that partly because
> the threads doing the invocations can invoke many different web services
> (not just one) and I am sure there is room for improvement in that area (see
> my second question below).
>
> We use *Axis2 v1.4.1*.
>
> Here are my questions:
> 1.  We had a timeout issue where the timeout is not being honored properly
> and I put in a patch (see patch details below) and it still does not
> work/honored for larger workloads; for very small workloads it is fine tho.
>  I put in a patch to set timeout for each invocation but it still didn't
> help.  I could see that the new timeout values are being set properly (after
> I applied the patch) in the "options" but no luck.  Any idea why the
> timeouts are not still honored even after applying the patch?  (my guess is
> due to the way we use a new ServiceClient with the HTTP REUSE option but I
> could be wrong).
>
> Patch details:
> The patch is applied to
> org.apache.axis2.transport.http.AbstractHTTPSender.class
> http://web.archiveorange.com/archive/v/R4VLPPfrNvyJ4cJFywD8
>
> https://issues.apache.org/jira/browse/AXIS2-3160?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
>
> 2. Also wondering if it is a good idea to use only one ServiceClient for
> different services?
>
> Best Regards,
> -Himakar
> ----------------------------------------------------
> Himakar Chennapragada
> IMS e-Business, SOA Development
> IBM Silicon Valley Lab, San Jose, CA
> Phone: 408-463-4758, Tie Line: 543-4758
> Email: himakar@us.ibm.com
> ----------------------------------------------------
>
>
>
>
>
>
>


-- 
*Afkham Azeez*
Director of Architecture; WSO2, Inc.; http://wso2.com,
*Member; Apache Software Foundation;
**http://www.apache.org/*<http://www.apache.org/>
*
*
*email: **azeez@wso2.com* <az...@wso2.com>* cell: +94 77 3320919
blog: **http://blog.afkham.org* <http://blog.afkham.org>*
twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez>
*
linked-in: **http://lk.linkedin.com/in/afkhamazeez*
*
*
*Lean . Enterprise . Middleware*
*
*