[zeromq-dev] Servlets and 0MQ
Martin Lucina
mato at kotelna.sk
Mon Mar 15 14:41:37 CET 2010
Hi Gonzalo,
gdiethelm at dcv.cl said:
> I think it is up to the web container to spawn new threads or pool them.
Correct. Some webservers/containers using worker thread pools have a fixed
size worker pool, on others it's dynamic.
> Well, I have refreshed my rusty knowledge of servlets, and there is a
> place to initialize 0MQ just once: the servlet's init() method (and the
> corresponding destroy() method at the end):
> http://en.wikipedia.org/wiki/Java_Servlet
That seems like the right place.
/me has little experience with Java servlets but most application
containers work similarly, so the other place to do it would be in some
kind of singleton object that gets initialised at "application
initialisation time".
> > It returns EMTHREAD error when you try to create a socket.
>
> Would it be conceivable to handle this in a more dynamic way? For
> instance, a function to ask 0MQ how many user threads it can currently
> handle, and another to increase (and maybe decrease) that number of
> threads.
Turning this question around, can't you ask the servlet container about
what it's maximum thread pool size is and pass that to 0MQ? AFAIK most
webservers/containers using a worker thread pool model have this limit
fairly low.
-mato
More information about the zeromq-dev
mailing list