Hi Chris,
A little more digging in and I found out that only with SSL,tomcat is creating
a large number of sessions. I can see in the logs for HTTP:
INFO: SessionListener: sessionDestroyed('2E8DE01EE3F0D166FEFC8A45353CD9ED')
Now,in case of HTTPS I see a large number of such logs. So I believe for HTTPS
requests it is creating a session for every request as compared to HTTP?
This is my SSL setting in client:
public HttpTLSProtocolSocketFactory()
{
try
{
this.sslcontext = SSLContext.getInstance("TLS");
TrustManager[] arrayOfTrustManager = { new DummyX509TrustManager() };
this.sslcontext.init(null, arrayOfTrustManager, null);
}
catch (Exception localException)
{
this.logger.log(Level.SEVERE, "Failed to created SSLContext: " +
localException.getMessage());
}
}
public Socket createSocket(String paramString, int paramInt1, InetAddress
paramInetAddress, int paramInt2, HttpConnectionParams paramHttpConnectionParams)
throws IOException, UnknownHostException, ConnectTimeoutException
{
if (paramHttpConnectionParams == null)
throw new IllegalArgumentException("Parameters may not be null");
int i = paramHttpConnectionParams.getConnectionTimeout();
SSLSocketFactory localSSLSocketFactory = this.sslcontext.getSocketFactory();
if (i == 0)
return localSSLSocketFactory.createSocket(paramString, paramInt1,
paramInetAddress, paramInt2);
Socket localSocket = localSSLSocketFactory.createSocket();
InetSocketAddress localInetSocketAddress1 = new
InetSocketAddress(paramInetAddress, paramInt2);
InetSocketAddress localInetSocketAddress2 = new
InetSocketAddress(paramString, paramInt1);
localSocket.bind(localInetSocketAddress1);
localSocket.connect(localInetSocketAddress2, i);
return localSocket;
}
Can different sockets create different sessions?
So for HTTP I am not creating any new sessions,same should be the case for
HTTPS. Right?
The only thing which differs in my is the SSLSocketFactory Implementation,which
creates sockets.
Chirag.
________________________________
From: Christopher Schultz <[email protected]>
To: Tomcat Users List <[email protected]>
Sent: Wednesday, 12 June 2013 8:14 PM
Subject: Re: OOME issue in Tomcat 6.0.18(with SSL)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Chirag,
On 6/12/13 1:01 AM, Chirag Dewan wrote:
> I am facing an Out of Memory Issue with my application. I am using
> Embedded Tomcat 6.0.18. I have a simple servlet deployed which
> does nothing but set the HTTPResponse and return it.
Are you sure you don't trigger session creation?
> Now I have 2 testing clients
>
> Client 1:
>
> HTTPClient 3.1 with MultiThreadedHttpConnectionManager with SSL
> maxConnections = 200 maxConnectionsPerHost=200
>
> Client 2:
>
> HTTPClient 4.1 in which I configured multiple threads
>
> for (int i = 0; i < noofConnections; i++) { Thread t = new
> Thread(my); t.start(); }
What is noofConnections set to?
> With every thread executing HTTPGet on the servlet. This too with
> SSL.
>
>
> Now with client 1,my JVM crashes after just a few minutes. Running
> with 8gb heap space.
>
>
> I took a heap dump for 2gb heap space using Jmap and analyzed it
> with MAT. It seems that there were many instances of
> org.apache.catalina.session.StandardManager consuming almost 95% of
> heap space.
There should only be one StandardManager present per web application
deployed. You only have a single web application? Are you sure that
you have many StandardManager instances, or do you have a single
StandardManager with a huge number of sessions?
> CPU utilization is only 13 -14% and I can see only 65 threads
> active with netstat.
>
>
> With Client 2,everything looks fine. Though JVM crashes at 2gb,but
> at 8gb it works fine. Though CPU utilization is almost 90% and 100
> simultaneous threads created for 100 simultaneous threads.
>
> Both my server and clients are on Linux 64 bit machines.
>
> I believe that this is something related to the client 1 i.e.
> either the HTTPClient 3.1 or the MultiThreadedConnectionManager,but
> posting here if someone can assist me in what might be the root
> cause.
Try a single thread and a single connection. Take a packet-capture and
see what the response headers look like. I wouldn't be surprised if
you are generating a new session with each and every request.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBCAAGBQJRuIlpAAoJEBzwKT+lPKRYjo4P/2S+89ycBzPTnxonur/aTUxm
0ZIHWHsDbKlg7YRlMlvpcPGuyXniW9mDOw5wWajt4WSCmcWNDEfI3bIIAI139lkw
EeEFIVplkK/ZY2uLViJ0B4V9A/kBB7qkGDNPPubeNnhpi6gVGl+j3jB1S9aHOT9t
dmLGavG1j1pRtAUTItr1kVKAegyaYCSlwbDe8YQefRF8+N/DyAi3wutSdoOpGYMA
WytWWW4QvnFCZF3BcS13AhMgcPM/j81tQUtfnjLDIjV4KmAZwoF8i/4ZE21+Twl6
XfrFQve4DK+AhjGfqkobGKm1AlUycqI+8BGKbjEhtcOAmavfQDVtuV90Ahmb2gWd
9tNEf/EhQZuQcX5Gqg3WI7Ut7gz/9/f5i4P+1MN6AwwDTt7EJ0yl975+4eaziBaw
en53fE4mPIB71r5DrCIEJ2nNHWTz5bQTIuv58wMKRGtetxZbqjdOuaBY8Pnrw73b
kkPcQxgzA/CxWUxbKjnMuCHFz7eKAPaukytkSnIxWcqwftesNU2WvUgNsuhXpNnI
Bp4BxV+B669FTtlRZrlCj6U2+1SgJzgWy9ZH3IzANsgVs4nUmHROiD7ZM9HLU+8m
XnqOwcTcubG1eJq0vjYtpOs1hCsQwORTJS0CQhwH0WHVH3h+n9evnnkTAu0DB8++
yKwZFsmuD2oSjeLHOgWK
=FOAt
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]