J
Jonck van der Kogel
Hi,
I am having a problem with a slow servlet and I'm hoping some of you
will give me some advice as to how I can improve performance.
The situation is as follows:
Users can contact my servlet upon which an object A (I'll just call it
A for easy reference) needs to be created. The creation of this object
takes a long time (a few seconds) but once created the object can be
interacted with very quickly.
What's happening now is that each time a user contacts my servlet a
response lag of a few seconds occurrs before the response is returned
due to the fact that a new A is created for each user. It is however
not at all necessary for a new A to be created for each user, A can be
reused by different users.
What I would like to do, is keep A in memory and reuse it every time a
new user contacts my servlet. But as far as I know this is not
possible with servlets, the page just gets run each and every time the
page is called.
If I run a seperate application on the server that keeps object A in
memory I suppose my problems are solved, but then how do I contact
this application from my servlet?
I was thinking of using RMI (running both the client and the server on
the same machine), but I had understood that RMI is rather slow and
speed is of the essence.
My question therefore is, do any of you know of a speedy solution with
which I can keep a Java object in memory and call this from a servlet
each time a user contacts me?
Thanks in advance for any help, Jonck
I am having a problem with a slow servlet and I'm hoping some of you
will give me some advice as to how I can improve performance.
The situation is as follows:
Users can contact my servlet upon which an object A (I'll just call it
A for easy reference) needs to be created. The creation of this object
takes a long time (a few seconds) but once created the object can be
interacted with very quickly.
What's happening now is that each time a user contacts my servlet a
response lag of a few seconds occurrs before the response is returned
due to the fact that a new A is created for each user. It is however
not at all necessary for a new A to be created for each user, A can be
reused by different users.
What I would like to do, is keep A in memory and reuse it every time a
new user contacts my servlet. But as far as I know this is not
possible with servlets, the page just gets run each and every time the
page is called.
If I run a seperate application on the server that keeps object A in
memory I suppose my problems are solved, but then how do I contact
this application from my servlet?
I was thinking of using RMI (running both the client and the server on
the same machine), but I had understood that RMI is rather slow and
speed is of the essence.
My question therefore is, do any of you know of a speedy solution with
which I can keep a Java object in memory and call this from a servlet
each time a user contacts me?
Thanks in advance for any help, Jonck