You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Theazyfa Jak <th...@hotmail.com> on 2011/06/01 10:48:43 UTC

client slow after sometime.

Hello,
First of all, sorry for my english.
I have a strange issue in my apps and I really don't know how to fix it.
I have a app that called a Webservice (Websphere 6.2).The client code is generated by Axis 1.4.1 (Java SE 6).
when I start the apps, I have a response time under 50 ms and all is fine.
After sometime ( generally 2/3hours ) the response time increase to 350/400 ms and the only workaround I found is to stop/start the client app.
the first version of my code was basically : 
xxxStub ws = new xxxStub("EPR");ws.getMethod();
So I recreate everything each time and I have a response time between 30 to 100ms.And after 2/3 hours I got 250/300.
So I try to use a MultiThreadedHttpConnectionManager. I Create a singleton to call the Webservice and in my constructor I put this : 
	private static final int connectionPerHost = 10;	private static final int DEFAULT_MAX_TOTAL_CONNECTIONS = 50;	private static final int timeoutIdleconnection = 20000;
	....	Constructor(){			....			conf = new PropertiesConfiguration(Constante.CONFIG_NAME);			epr = conf.getString(Constante.EPR_ADDRESS_EMISSION);			ws = new xxxStub(epr);			ws._getServiceClient().getOptions().setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Constants.VALUE_TRUE);			MultiThreadedHttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();			connectionManager.getParams().setMaxTotalConnections(DEFAULT_MAX_TOTAL_CONNECTIONS);			connectionManager.getParams().setDefaultMaxConnectionsPerHost(connectionPerHost);			connectionManager.closeIdleConnections(timeoutIdleconnection);			HttpClient httpClient = new HttpClient(connectionManager);			ws._getServiceClient().getOptions().setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);
and after each call, I made a ws._getServiceClient().cleanupTransport().I have better response time (15-40 ms) but I always have after 2/3hours a inscrease to 300 ms....

So, I have 3 questions : 1- Is my implementation of MultiThreadedHttpConnectionManager correct?2- Is my problem due to client or Server settings?3- Any ideas of how to fix this?
Regards,

 		 	   		  

AW: AW: client slow after sometime.

Posted by Stadelmann Josef <jo...@axa-winterthur.ch>.
Good, that you have figured out that it is the client taking more time. 

 

Now we need a bit more insight into what you intend to do to understand
in example why you choose a particular approach7design! 

Can you explain please?

 

Are you running  a synchronous or asynchronous protocol? 

that is to say your client may have several requestors placing a request
on a thread.

Are your requestors waiting on their  thread unless the response for a
particular requestor on a thread is back? (Synchronous Protocol)

OR

Are your requestors doing something busy on this thread and get
called-back on a call-back-point/routine?

 

Basically: why do you intend to have a
MultiThreadedHttpConnectionManager?

What do you expect from this MultiThreadedHttpConnectionManager?

 

Asynchronous: are you placing several requests at once without waiting
for a response?

Asynchronous: is your client talking to multiple service-objects
(instances) each request placed on a separate thread and delivered at a
particular instance?

Asynchronous: is your application-server, your axis2-engine, your
service-object or any stuff below really thread safe?

 

Could you run the same test without the
MultiThreadedHttpConnectionManager engaged?

What are your observations?

 

But you should consider one thing: configuring something absolute
correct but misusing it may also lead to problems!

 

The issue might be on which level do we expect/have the problem:
Transport TCPIP/HTTP OR above XML-SOAP and handlingby AXIS routines.

the latency is between the receive of data on client and the acknowledge
from client to server

As you observer that, it means your client code is just not involved,
because it is your TCPIP layer which as to ACK, isn't it.

And the question is, why is TCPIP not ACKing the Response to the server
just after a big delay?

 

 

Do you observe any REST (Transport Resets) in Wireshark? Then it is a
TCPIP Problem from Microsoft.

 

What is your architecture? In my mind, you are using a bit too many
exotic features at once!

While this is certainly not prohibited, in case of troubles - keep it
short and simple! KISS

What is the observed behavior if you engage only one feature at a time
to get control back?

 

Maybe some axis2/j developers implementing the
MultiThreadedHttpConnectionManager can tell you about the configuration
details.

 

 

Josef

 

 

Von: Theazyfa Jak [mailto:theazyfa@hotmail.com] 
Gesendet: Montag, 6. Juni 2011 16:43
An: java-user@axis.apache.org
Betreff: RE: AW: client slow after sometime.

 

Hello, 

so I just finish some test with Wireshark.

It seems that it's the client part ( so Axis 2 ) that's slow.

 

the latency is between the receive of data on client and the acknowledge
from client to server.

I don't see any bottleneck on cpu or Memory.

 

Is there some config to have log from Axis 2 client layer?

Is my config ( first mail ) of Axis 2 client is correct?

 

Regards,

________________________________

From: theazyfa@hotmail.com
To: java-user@axis.apache.org
Subject: RE: AW: client slow after sometime.
Date: Thu, 2 Jun 2011 08:37:32 +0200

Thanks for your answer Josef!

I already take the 2 time ( and I forgot to talk about ^^ sorry)

So, I always have the same time for the Server Process.
But this time is only about the 'created' code. So, I can't really know
if it's the server 'wrapped' part ( connection pool,....) is slowing or
if it's the client.

Wireshark is a very good ( and fast ) idea to found the guilty !
I do the test and I come to you with result.

Thanks to give me a new approach!

Regards,

________________________________

Subject: AW: client slow after sometime.
Date: Wed, 1 Jun 2011 18:55:39 +0200
From: josef.stadelmann@axa-winterthur.ch
To: java-user@axis.apache.org

It would be nice if you can find out the following:

Is the delay cause by the network or the server processing your request?

 

For that you can get the system time in as small a fraction as possible,
i.e. nano seconds 

1.       At the server take the system time up on entering the service
and just before you return the response.

2.       add this two entries to the response.

3.       At the client calculate the delta 

4.       This is the servers true processing time

 

1.       At the client side you get the system time just before you send
the message and 

2.       you catch the time when the response is back.

3.       Then you calculate the client-side-delta. 

4.       This is the total turn-around-time.

 

 

Now then you shall report to use what you observer in the beginning and
after 2/3 hours.

 

Basically which time increases a lot?

a)      Just the server time

b)      Just  the turnaround time at the client

c)       Both?

 

Maybe you can observer that after 2/3 hours the server uses much more
time to process your request? 
Then you know where you have to investigate more closer.

 

Maybe after 2/3 hours you will find that the servers process time is
still the same 

but that  the time the request/response is on the way to/from the server
takes much more time.

In this case it could be good to use a network analyzer such as
Wireshark to find the cause. 

Is it the send or the receive time when you look from the client side.

 

And then you can also calibrate and profile your server and your client
using NetBeans IDE and use all about  PROFILING what help of NetBeans
tells you to do..

This would be the most professional approach.

 

You will end up either with a network latency time increase for sending
or receiving or both

 

Or you will find either a CPU or MEMORY or IO Bottleneck at the Client
or the Server side.

 

Hope this helps to start with your not so easy task

 

And only if you have found the location/the cause you can think about a
configuration change!

Josef

 

 

 

 

Von: Theazyfa Jak [mailto:theazyfa@hotmail.com] 
Gesendet: Mittwoch, 1. Juni 2011 10:49
An: java-user@axis.apache.org
Betreff: client slow after sometime.

 

Hello,

 

First of all, sorry for my english.

 

I have a strange issue in my apps and I really don't know how to fix it.

 

I have a app that called a Webservice (Websphere 6.2).

The client code is generated by Axis 1.4.1 (Java SE 6).

 

when I start the apps, I have a response time under 50 ms and all is
fine.

 

After sometime ( generally 2/3hours ) the response time increase to
350/400 ms and the only workaround I found is to stop/start the client
app.

 

the first version of my code was basically : 

 

xxxStub ws = new xxxStub("EPR");

ws.getMethod();

 

So I recreate everything each time and I have a response time between 30
to 100ms.

And after 2/3 hours I got 250/300.

 

So I try to use a MultiThreadedHttpConnectionManager. I Create a
singleton to call the Webservice and in my constructor I put this : 

 

            private static final int connectionPerHost = 10;

            private static final int DEFAULT_MAX_TOTAL_CONNECTIONS = 50;

            private static final int timeoutIdleconnection = 20000;

 

            ....

            Constructor(){

                                   ....

                                   conf = new
PropertiesConfiguration(Constante.CONFIG_NAME);

                                   epr =
conf.getString(Constante.EPR_ADDRESS_EMISSION);

                                   ws = new xxxStub(epr);

 
ws._getServiceClient().getOptions().setProperty(HTTPConstants.REUSE_HTTP
_CLIENT, Constants.VALUE_TRUE);

                                   MultiThreadedHttpConnectionManager
connectionManager = new MultiThreadedHttpConnectionManager();

 
connectionManager.getParams().setMaxTotalConnections(DEFAULT_MAX_TOTAL_C
ONNECTIONS);

 
connectionManager.getParams().setDefaultMaxConnectionsPerHost(connection
PerHost);

 
connectionManager.closeIdleConnections(timeoutIdleconnection);

                                   HttpClient httpClient = new
HttpClient(connectionManager);

 
ws._getServiceClient().getOptions().setProperty(HTTPConstants.CACHED_HTT
P_CLIENT, httpClient);

 

and after each call, I made a ws._getServiceClient().cleanupTransport().

I have better response time (15-40 ms) but I always have after 2/3hours
a inscrease to 300 ms....

 

 

So, I have 3 questions : 

1- Is my implementation of MultiThreadedHttpConnectionManager correct?

2- Is my problem due to client or Server settings?

3- Any ideas of how to fix this?

 

Regards,

 

 


RE: AW: client slow after sometime.

Posted by Theazyfa Jak <th...@hotmail.com>.
Hello, so I just finish some test with Wireshark.It seems that it's the client part ( so Axis 2 ) that's slow.
the latency is between the receive of data on client and the acknowledge from client to server.I don't see any bottleneck on cpu or Memory.
Is there some config to have log from Axis 2 client layer?Is my config ( first mail ) of Axis 2 client is correct?
Regards,

From: theazyfa@hotmail.com
To: java-user@axis.apache.org
Subject: RE: AW: client slow after sometime.
Date: Thu, 2 Jun 2011 08:37:32 +0200








Thanks for your answer Josef!

I already take the 2 time ( and I forgot to talk about ^^ sorry)

So, I always have the same time for the Server Process.
But this time is only about the 'created' code. So, I can't really know if it's the server 'wrapped' part ( connection pool,....) is slowing or if it's the client.

Wireshark is a very good ( and fast ) idea to found the guilty !
I do the test and I come to you with result.

Thanks to give me a new approach!

Regards,
Subject: AW: client slow after sometime.
Date: Wed, 1 Jun 2011 18:55:39 +0200
From: josef.stadelmann@axa-winterthur.ch
To: java-user@axis.apache.org



It would be nice if you can find out the following:Is the delay cause by the network or the server processing your request? For that you can get the system time in as small a fraction as possible, i.e. nano seconds 1.       At the server take the system time up on entering the service and just before you return the response.2.       add this two entries to the response.3.       At the client calculate the delta 4.       This is the servers true processing time 1.       At the client side you get the system time just before you send the message and 2.       you catch the time when the response is back.3.       Then you calculate the client-side-delta. 4.       This is the total turn-around-time.  Now then you shall report to use what you observer in the beginning and after 2/3 hours. Basically which time increases a lot?a)      Just the server timeb)      Just  the turnaround time at the clientc)       Both? Maybe you can observer that after 2/3 hours the server uses much more time to process your request? 
Then you know where you have to investigate more closer. Maybe after 2/3 hours you will find that the servers process time is still the same but that  the time the request/response is on the way to/from the server takes much more time.In this case it could be good to use a network analyzer such as Wireshark to find the cause. Is it the send or the receive time when you look from the client side. And then you can also calibrate and profile your server and your client using NetBeans IDE and use all about  PROFILING what help of NetBeans tells you to do..This would be the most professional approach. You will end up either with a network latency time increase for sending or receiving or both Or you will find either a CPU or MEMORY or IO Bottleneck at the Client or the Server side. Hope this helps to start with your not so easy task And only if you have found the location/the cause you can think about a configuration change!Josef    Von: Theazyfa Jak [mailto:theazyfa@hotmail.com] 
Gesendet: Mittwoch, 1. Juni 2011 10:49
An: java-user@axis.apache.org
Betreff: client slow after sometime. Hello, First of all, sorry for my english. I have a strange issue in my apps and I really don't know how to fix it. I have a app that called a Webservice (Websphere 6.2).The client code is generated by Axis 1.4.1 (Java SE 6). when I start the apps, I have a response time under 50 ms and all is fine. After sometime ( generally 2/3hours ) the response time increase to 350/400 ms and the only workaround I found is to stop/start the client app. the first version of my code was basically :  xxxStub ws = new xxxStub("EPR");ws.getMethod(); So I recreate everything each time and I have a response time between 30 to 100ms.And after 2/3 hours I got 250/300. So I try to use a MultiThreadedHttpConnectionManager. I Create a singleton to call the Webservice and in my constructor I put this :              private static final int connectionPerHost = 10;            private static final int DEFAULT_MAX_TOTAL_CONNECTIONS = 50;            private static final int timeoutIdleconnection = 20000;             ....            Constructor(){                                   ....                                   conf = new PropertiesConfiguration(Constante.CONFIG_NAME);                                   epr = conf.getString(Constante.EPR_ADDRESS_EMISSION);                                   ws = new xxxStub(epr);                                   ws._getServiceClient().getOptions().setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Constants.VALUE_TRUE);                                   MultiThreadedHttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();                                    connectionManager.getParams().setMaxTotalConnections(DEFAULT_MAX_TOTAL_CONNECTIONS);                                   connectionManager.getParams().setDefaultMaxConnectionsPerHost(connectionPerHost);                                   connectionManager.closeIdleConnections(timeoutIdleconnection);                                   HttpClient httpClient = new HttpClient(connectionManager);                                   ws._getServiceClient().getOptions().setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient); and after each call, I made a ws._getServiceClient().cleanupTransport().I have better response time (15-40 ms) but I always have after 2/3hours a inscrease to 300 ms....  So, I have 3 questions : 1- Is my implementation of MultiThreadedHttpConnectionManager correct?2- Is my problem due to client or Server settings?3- Any ideas of how to fix this? Regards,   		 	   		  

RE: AW: client slow after sometime.

Posted by Theazyfa Jak <th...@hotmail.com>.
Thanks for your answer Josef!

I already take the 2 time ( and I forgot to talk about ^^ sorry)

So, I always have the same time for the Server Process.
But this time is only about the 'created' code. So, I can't really know if it's the server 'wrapped' part ( connection pool,....) is slowing or if it's the client.

Wireshark is a very good ( and fast ) idea to found the guilty !
I do the test and I come to you with result.

Thanks to give me a new approach!

Regards,
Subject: AW: client slow after sometime.
Date: Wed, 1 Jun 2011 18:55:39 +0200
From: josef.stadelmann@axa-winterthur.ch
To: java-user@axis.apache.org



It would be nice if you can find out the following:Is the delay cause by the network or the server processing your request? For that you can get the system time in as small a fraction as possible, i.e. nano seconds 1.       At the server take the system time up on entering the service and just before you return the response.2.       add this two entries to the response.3.       At the client calculate the delta 4.       This is the servers true processing time 1.       At the client side you get the system time just before you send the message and 2.       you catch the time when the response is back.3.       Then you calculate the client-side-delta. 4.       This is the total turn-around-time.  Now then you shall report to use what you observer in the beginning and after 2/3 hours. Basically which time increases a lot?a)      Just the server timeb)      Just  the turnaround time at the clientc)       Both? Maybe you can observer that after 2/3 hours the server uses much more time to process your request? 
Then you know where you have to investigate more closer. Maybe after 2/3 hours you will find that the servers process time is still the same but that  the time the request/response is on the way to/from the server takes much more time.In this case it could be good to use a network analyzer such as Wireshark to find the cause. Is it the send or the receive time when you look from the client side. And then you can also calibrate and profile your server and your client using NetBeans IDE and use all about  PROFILING what help of NetBeans tells you to do..This would be the most professional approach. You will end up either with a network latency time increase for sending or receiving or both Or you will find either a CPU or MEMORY or IO Bottleneck at the Client or the Server side. Hope this helps to start with your not so easy task And only if you have found the location/the cause you can think about a configuration change!Josef    Von: Theazyfa Jak [mailto:theazyfa@hotmail.com] 
Gesendet: Mittwoch, 1. Juni 2011 10:49
An: java-user@axis.apache.org
Betreff: client slow after sometime. Hello, First of all, sorry for my english. I have a strange issue in my apps and I really don't know how to fix it. I have a app that called a Webservice (Websphere 6.2).The client code is generated by Axis 1.4.1 (Java SE 6). when I start the apps, I have a response time under 50 ms and all is fine. After sometime ( generally 2/3hours ) the response time increase to 350/400 ms and the only workaround I found is to stop/start the client app. the first version of my code was basically :  xxxStub ws = new xxxStub("EPR");ws.getMethod(); So I recreate everything each time and I have a response time between 30 to 100ms.And after 2/3 hours I got 250/300. So I try to use a MultiThreadedHttpConnectionManager. I Create a singleton to call the Webservice and in my constructor I put this :              private static final int connectionPerHost = 10;            private static final int DEFAULT_MAX_TOTAL_CONNECTIONS = 50;            private static final int timeoutIdleconnection = 20000;             ....            Constructor(){                                   ....                                   conf = new PropertiesConfiguration(Constante.CONFIG_NAME);                                   epr = conf.getString(Constante.EPR_ADDRESS_EMISSION);                                   ws = new xxxStub(epr);                                   ws._getServiceClient().getOptions().setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Constants.VALUE_TRUE);                                   MultiThreadedHttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();                                    connectionManager.getParams().setMaxTotalConnections(DEFAULT_MAX_TOTAL_CONNECTIONS);                                   connectionManager.getParams().setDefaultMaxConnectionsPerHost(connectionPerHost);                                   connectionManager.closeIdleConnections(timeoutIdleconnection);                                   HttpClient httpClient = new HttpClient(connectionManager);                                   ws._getServiceClient().getOptions().setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient); and after each call, I made a ws._getServiceClient().cleanupTransport().I have better response time (15-40 ms) but I always have after 2/3hours a inscrease to 300 ms....  So, I have 3 questions : 1- Is my implementation of MultiThreadedHttpConnectionManager correct?2- Is my problem due to client or Server settings?3- Any ideas of how to fix this? Regards,   		 	   		  

AW: client slow after sometime.

Posted by Stadelmann Josef <jo...@axa-winterthur.ch>.
It would be nice if you can find out the following:

Is the delay cause by the network or the server processing your request?

 

For that you can get the system time in as small a fraction as possible,
i.e. nano seconds 

1.       At the server take the system time up on entering the service
and just before you return the response.

2.       add this two entries to the response.

3.       At the client calculate the delta 

4.       This is the servers true processing time

 

1.       At the client side you get the system time just before you send
the message and 

2.       you catch the time when the response is back.

3.       Then you calculate the client-side-delta. 

4.       This is the total turn-around-time.

 

 

Now then you shall report to use what you observer in the beginning and
after 2/3 hours.

 

Basically which time increases a lot?

a)      Just the server time

b)      Just  the turnaround time at the client

c)       Both?

 

Maybe you can observer that after 2/3 hours the server uses much more
time to process your request? 
Then you know where you have to investigate more closer.

 

Maybe after 2/3 hours you will find that the servers process time is
still the same 

but that  the time the request/response is on the way to/from the server
takes much more time.

In this case it could be good to use a network analyzer such as
Wireshark to find the cause. 

Is it the send or the receive time when you look from the client side.

 

And then you can also calibrate and profile your server and your client
using NetBeans IDE and use all about  PROFILING what help of NetBeans
tells you to do..

This would be the most professional approach.

 

You will end up either with a network latency time increase for sending
or receiving or both

 

Or you will find either a CPU or MEMORY or IO Bottleneck at the Client
or the Server side.

 

Hope this helps to start with your not so easy task

 

And only if you have found the location/the cause you can think about a
configuration change!

Josef

 

 

 

 

Von: Theazyfa Jak [mailto:theazyfa@hotmail.com] 
Gesendet: Mittwoch, 1. Juni 2011 10:49
An: java-user@axis.apache.org
Betreff: client slow after sometime.

 

Hello,

 

First of all, sorry for my english.

 

I have a strange issue in my apps and I really don't know how to fix it.

 

I have a app that called a Webservice (Websphere 6.2).

The client code is generated by Axis 1.4.1 (Java SE 6).

 

when I start the apps, I have a response time under 50 ms and all is
fine.

 

After sometime ( generally 2/3hours ) the response time increase to
350/400 ms and the only workaround I found is to stop/start the client
app.

 

the first version of my code was basically : 

 

xxxStub ws = new xxxStub("EPR");

ws.getMethod();

 

So I recreate everything each time and I have a response time between 30
to 100ms.

And after 2/3 hours I got 250/300.

 

So I try to use a MultiThreadedHttpConnectionManager. I Create a
singleton to call the Webservice and in my constructor I put this : 

 

            private static final int connectionPerHost = 10;

            private static final int DEFAULT_MAX_TOTAL_CONNECTIONS = 50;

            private static final int timeoutIdleconnection = 20000;

 

            ....

            Constructor(){

                                   ....

                                   conf = new
PropertiesConfiguration(Constante.CONFIG_NAME);

                                   epr =
conf.getString(Constante.EPR_ADDRESS_EMISSION);

                                   ws = new xxxStub(epr);

 
ws._getServiceClient().getOptions().setProperty(HTTPConstants.REUSE_HTTP
_CLIENT, Constants.VALUE_TRUE);

                                   MultiThreadedHttpConnectionManager
connectionManager = new MultiThreadedHttpConnectionManager();

 
connectionManager.getParams().setMaxTotalConnections(DEFAULT_MAX_TOTAL_C
ONNECTIONS);

 
connectionManager.getParams().setDefaultMaxConnectionsPerHost(connection
PerHost);

 
connectionManager.closeIdleConnections(timeoutIdleconnection);

                                   HttpClient httpClient = new
HttpClient(connectionManager);

 
ws._getServiceClient().getOptions().setProperty(HTTPConstants.CACHED_HTT
P_CLIENT, httpClient);

 

and after each call, I made a ws._getServiceClient().cleanupTransport().

I have better response time (15-40 ms) but I always have after 2/3hours
a inscrease to 300 ms....

 

 

So, I have 3 questions : 

1- Is my implementation of MultiThreadedHttpConnectionManager correct?

2- Is my problem due to client or Server settings?

3- Any ideas of how to fix this?

 

Regards,