Apache Directory Project - [mina] SocketIoProcessor.Worker creation under heavy load

This is Interesting: Free IT Magazines  
Home > Archive > Apache Directory Project > October 2005 > [mina] SocketIoProcessor.Worker creation under heavy load





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author [mina] SocketIoProcessor.Worker creation under heavy load
Irving, Dave

2005-10-27, 7:45 am

Hi,

I've been doing some profiling on an application which sits on Mina -
and I came across something interesting.
My test application is creating "single-shot" connections using multiple
client threads at a high rate:

- open connection to MINA server
- send some data
- receive reply data
- close connection

The Mina server seems very stable, but Im noticing that theres a fairly
high creation / destruction rate of SocketIoProcessor.Worker threads.=20
After processing sessions from a select, the worker thread checks for
more work, and exits if there is none to do:

if( selector.keys().isEmpty() && newSessions.isEmpty() ) {
worker =3D null;
break;
}

In my case it seems that quite frequently a new session for a new
connection is registered just after this check - and consequently a new
worker thread is immediately created.

Do you think there would be any advantage in leaving the worker about
for a bit longer? E.g: Maybe if there's still nothing to do after a
further (max 1 second) select -- then -- kill the worker? Or is this
likely to not be of any gain?

Many thanks,

Dave


This e-mail and any attachment is for authorised use by the intended recipi=
ent(s) only. It may contain proprietary material, confidential information =
and/or be subject to legal privilege. It should not be copied, disclosed to=
, retained or used by, any other party. If you are not an intended recipien=
t then please promptly delete this e-mail and any attachment and all copies=
and inform the sender. Thank you.

Jose Alberto Fernandez

2005-10-27, 7:45 am

Interesting. Why not using a Thread Pool for this? It may easily solve
this issue as threads will stay for some time and being reused.

Jose Alberto

> -----Original Message-----
> From: Irving, Dave [mailto:dave.irving-iKsOTpgdUR76V6G2DxALlg@public.gmane.org]
> Sent: 27 October 2005 08:45
> To: Apache Directory Developers List
> Subject: [mina] SocketIoProcessor.Worker creation under heavy load
>=20
> Hi,
>=20
> I've been doing some profiling on an application which sits on Mina -
> and I came across something interesting.
> My test application is creating "single-shot" connections using

multiple
> client threads at a high rate:
>=20
> - open connection to MINA server
> - send some data
> - receive reply data
> - close connection
>=20
> The Mina server seems very stable, but Im noticing that theres a

fairly
> high creation / destruction rate of SocketIoProcessor.Worker threads.
> After processing sessions from a select, the worker thread checks for
> more work, and exits if there is none to do:
>=20
> if( selector.keys().isEmpty() && newSessions.isEmpty() ) {
> worker =3D null;
> break;
> }
>=20
> In my case it seems that quite frequently a new session for a new
> connection is registered just after this check - and consequently a

new
> worker thread is immediately created.
>=20
> Do you think there would be any advantage in leaving the worker about
> for a bit longer? E.g: Maybe if there's still nothing to do after a
> further (max 1 second) select -- then -- kill the worker? Or is this
> likely to not be of any gain?
>=20
> Many thanks,
>=20
> Dave
>=20
>=20
> This e-mail and any attachment is for authorised use by the intended
> recipient(s) only. It may contain proprietary material, confidential
> information and/or be subject to legal privilege. It should not be

copied,
> disclosed to, retained or used by, any other party. If you are not an
> intended recipient then please promptly delete this e-mail and any
> attachment and all copies and inform the sender. Thank you.


Irving, Dave

2005-10-27, 7:45 am


> Interesting. Why not using a Thread Pool for this?=20
> It may easily solve this issue as threads will stay for some time and

being reused.

If you did so, I think it would be a pool of 1: There's only ever one
worker in use at a time (AFAIK).=20
A "was there anything to do on my last select?" check would still
provide fairly timely worker-shut-down (if that's what the existing code
is aiming for), whilst not causing premature worker closure

> Jose Alberto=20


Dave

-----Original Message-----
From: Jose Alberto Fernandez [mailto:jalberto-FQMVDHFwfny6lNtOUNzE6A@public.gmane.org]=20
Sent: 27 October 2005 10:43
To: Apache Directory Developers List
Subject: RE: [mina] SocketIoProcessor.Worker creation under heavy load

Interesting. Why not using a Thread Pool for this? It may easily solve
this issue as threads will stay for some time and being reused.

Jose Alberto

> -----Original Message-----
> From: Irving, Dave [mailto:dave.irving-iKsOTpgdUR76V6G2DxALlg@public.gmane.org]
> Sent: 27 October 2005 08:45
> To: Apache Directory Developers List
> Subject: [mina] SocketIoProcessor.Worker creation under heavy load
>=20
> Hi,
>=20
> I've been doing some profiling on an application which sits on Mina -=20
> and I came across something interesting.
> My test application is creating "single-shot" connections using

multiple
> client threads at a high rate:
>=20
> - open connection to MINA server
> - send some data
> - receive reply data
> - close connection
>=20
> The Mina server seems very stable, but Im noticing that theres a

fairly
> high creation / destruction rate of SocketIoProcessor.Worker threads.
> After processing sessions from a select, the worker thread checks for=20
> more work, and exits if there is none to do:
>=20
> if( selector.keys().isEmpty() && newSessions.isEmpty() ) {
> worker =3D null;
> break;
> }
>=20
> In my case it seems that quite frequently a new session for a new=20
> connection is registered just after this check - and consequently a

new
> worker thread is immediately created.
>=20
> Do you think there would be any advantage in leaving the worker about=20
> for a bit longer? E.g: Maybe if there's still nothing to do after a=20
> further (max 1 second) select -- then -- kill the worker? Or is this=20
> likely to not be of any gain?
>=20
> Many thanks,
>=20
> Dave
>=20
>=20
> This e-mail and any attachment is for authorised use by the intended
> recipient(s) only. It may contain proprietary material, confidential=20
> information and/or be subject to legal privilege. It should not be

copied,
> disclosed to, retained or used by, any other party. If you are not an=20
> intended recipient then please promptly delete this e-mail and any=20
> attachment and all copies and inform the sender. Thank you.


Jose Alberto Fernandez

2005-10-27, 7:45 am

> From: Irving, Dave [mailto:dave.irving-iKsOTpgdUR76V6G2DxALlg@public.gmane.org]
>=20
and[vbcol=seagreen]
> being reused.
>=20
> If you did so, I think it would be a pool of 1: There's only ever one
> worker in use at a time (AFAIK).


But that is OK, Executors have such size 1 thread pools. This may be
much cheaper than creating and destroying threads.

Jose Alberto


Irving, Dave

2005-10-27, 7:45 am

> But that is OK, Executors have such size 1 thread pools. This may be
much cheaper than creating and destroying threads.

Indeed=20


This e-mail and any attachment is for authorised use by the intended recipi=
ent(s) only. It may contain proprietary material, confidential information =
and/or be subject to legal privilege. It should not be copied, disclosed to=
, retained or used by, any other party. If you are not an intended recipien=
t then please promptly delete this e-mail and any attachment and all copies=
and inform the sender. Thank you.

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com