RE: [Simpleweb-Support] Modifying server behavior
Brought to you by:
niallg
|
From: Niall G. <ni...@em...> - 2004-12-13 05:20:18
|
Hi,
Just a comment on this topic. If you use the ProcessQueue.resize method to =
reduce the number of threads this will only reduce the number of threads us=
ed to process requests. I thought that it would make no sense to use a thre=
ad from a thread pool for a daemon like process. For instance the cache and=
session manager require threads to perform background tasks, so it is not =
a good idea to occupy a thread from the thread pool permenantly for such ta=
sks. I think you will find that there are about 4 daemon threads, also ther=
e are about 10 poller threads and ProcessQueue.size processor threads. If y=
ouy wish to reduce the number of poller threads you will need to create a P=
ipelineProcessor from the PipelineProcessorFactory.getInstance. Have a look=
at the JavaDoc documentation.
Niall
----- Original Message -----
From: "Kevin A. Smith" <ke...@el...>
To: sim...@li...
Subject: RE: [Simpleweb-Support] Modifying server behavior
Date: Tue, 30 Nov 2004 22:38:30 -0500
>=20
> 1) How did you make changes for limiting the number of thread?
> Here's a code snippet with some initialization and error handling code
> removed:
>=20
> LoaderEngine engine =3D new LoaderEngine();
>=20
> // Limit thread pool size to 16?
> ProcessQueue.getInstance().resize(16);
>=20
> Map objects =3D new HashMap();
> // Populate map with service initialization objects
> engine.load("ProxyService", ProxyService.class.getName(), objects);
> engine.link("*", "ProxyService");
> ProtocolHandler handler =3D HandlerFactory.getInstance(engine);
> _server =3D ConnectionFactory.getConnection(handler);
> _socket =3D new ServerSocket(_port);
> _server.connect(_socket);
>=20
> // Also have tried it here
> // ProcessQueue.getInstance().resize(16);
>=20
> 2) What do you mean by "it doesn't appear to have any effect"?
> I'm running my code on Gentoo Linux w/Sun's 1.5 JDK. I'm using the
> command 'ps | grep java | wc -l' to count the number of threads spawned
> by simpleweb. My project has two simpleweb instances listening on two
> separate ports. The number returned by that command does not change
> despite making the ProcessQueue call. I've tried making the call after
> _server.connect() but that seems to have no effect either.
>=20
> I'm pretty much convinced that I'm doing something wrong, but I'm at a
> loss figuring out what it might be.
>=20
> --Kevin
>=20
> On Tue, 2004-11-30 at 09:30 +0700, bagas wrote:
> > > 1) I'd like to be able to limit the number of threads simpleweb
> > creates
> > > for request processing. I've tried using the advice given here:
> >
> > >
> > http://sourceforge.net/mailarchive/forum.php?thread_id=3D5231917&forum_=
id=3D
> > 38791
> >
> > > but it doesn't appear to have any effect although its entirely
> > possible
> > > that I'm doing something wrong :)
> >
> > Works perfect for me (the sender of question from the URL). Thank you
> > Niall.
> >
> > Can you elaborate on your problem :
> > 1. How did you make changes for limiting the number of thread?
> > 2. What do you mean by "it doesn't appear to have any effect"? Have you
> > test it? How do you test it?
> >
> >
> >
> >
> > -------------------------------------------------------
> > SF email is sponsored by - The IT Product Guide
> > Read honest & candid reviews on hundreds of IT Products from real users.
> > Discover which products truly live up to the hype. Start reading=20
> > now. http://productguide.itmanagersjournal.com/
> > _______________________________________________
> > Simpleweb-Support mailing list
> > Sim...@li...
> > https://lists.sourceforge.net/lists/listinfo/simpleweb-support
> >
>=20
>=20
>=20
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://productguide.itmanagersjournal.com/
> _______________________________________________
> Simpleweb-Support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simpleweb-support
--=20
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm
|