Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

out-of-process servlet  RSS feed

 
F. Slone
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using Tomcat 4.1.12 on a Win2K server to host a servlet which uses
JNI to call a DLL. I would like to run multiple instances of this
servlet calling separate instances of the DLL. That part is no problem
simply by giving each instance a unique name (both servlet class and
DLL). However, I'd like to run each instance in its own process space
because of the memory requirements of the DLL. The DLL gets initialized
to a certain data set and then subsequent queries use that data. The
initialization takes considerable time and memory, so we hold initialized
instances in memory for later queries instead of re-initializing on each
call. Because the memory required by an initialized DLL, we need to put
them in separate process spaces.
So far, the only way I've found to do this is to run multiple
instances of Tomcat. That's simple enough using the CATALINA_BASE
setting and launching multiple copies of the server. However, it would
be simpler if I could run one instance of Tomcat and designate certain
parts of it to run out of process, say at the context, host, or engine
level.
Is it possible to set a context within the Tomcat server to run in its
own process space?
It's been suggested that what we're doing isn't suitable for servlets
and we need another architecture. That may be the answer, and it would
certainly be possible to use a wrapper to initialize these DLLs as separate
applications which accepted remote calls. The only reason we've been using
servlets is to take advantage of the HTTP query processing already provided
by the server without rebuilding that part in a customer listener, but now
that we're hitting the wall in memory requirements, we may have to move
to a different architecture to separate our DLL processes. I'm open to
suggestion on what a new architecture should look like if the answer to the
servlet question is a simple "you can't".
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like nobody has come up with a way to create multiple independent process spaces in Tomcat so I think you have to move on to some sort of distributed Java. You can keep the servlet handling the receipt of queries and formatting of results, but the DLL processing would be handled by separate applications. This really sounds like a JINI/JavaSpaces application to me.
Possibly a moderator can move this to Distributed Java.
Bill
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My gut reaction is "not possible." But... another option for you is to ask on the tomcat-user mailing list. The Tomcat developers hang out there, as do many other super smart people.

As for "different architectures/ways", I'll move this to Distributed Java for you...
[ February 24, 2004: Message edited by: Mike Curwen ]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been experimenting with JavaSpaces with a simple lookup example. The additional time overhead involved in submitting a problem to a space and getting back an answer is about 70 millisec with the JavaSpace on one machine and the problem submission from another. The object involved are pretty small, just some Strings and a String[].
How large an object does it take to define a problem (and result) for one of your DLL instances?
Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!