You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Vishy Kasar <vk...@borland.com> on 2001/09/04 19:42:21 UTC

Unnecessary creation of session data...

Hi,

Here is an improvement suggestion.

Assume a TomCat instance is serving a session which is
being backed up in a Database. That TomCat instance dies
and another comes up. When browser sends another request
pertaining to the session it has already established with
previous instance of tomcat, the current tomcat instance
rightly goes to Database, gets back the session data and
continues to serve the session. However there are some
inefficiencies in how it does that.

First of all, ManagerBase.createSession is going to create
a full fledged session with all the data including the
generation of a new session ID. Almost immediately, all
these data gets overwritten with the real data that we read
from the database. This full fledged creation is
unnecessary.

Secondly, StandardSession.setId which is attempting to set
the new session ID to the one that is read from DB,
realizes that session already has another ID and it tries
to remove it from DB. This results in another distributed
call. This again is totally unnecessary as there  is
nothing to remove from DB.

IMO, both of the above problems can be corrected by
allowing to create an empty session. We can add a new API
createEmptySession() to catalina.Manager interface and
implementation will return a new uninitialized session with
the understanding that it will be immedietly filled with
real data.

Another way could be to add
createSession(ObjectInputStream) to catalina.Manager which
allows it to create a full fledged session from the data in
input stream.

Comments?


--
Cheers!