Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2005

Tip: Looking for answers? Try searching our database.

Http Session, size, varbinary / blob, and Jdbc as persistent sessions

Thread view: 
js - 14 Oct 2005 09:37 GMT
Hi,

I am using SunOne WebServer 6.1. I would like to use JDBC as the persistent
mechanism for storing sessions, and this is possible with SunOne 6.1 via
the JdbcStore:

       http://docs.sun.com/source/817-1833-10/pwasessn.html

I have tried it and it works, using the following as an example on ASE
12.5.x on Solaris SPARC with JConnect 5.x JDBC:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Sun ONE Web
Server 6.1 Servlet 2.3//EN'
'http://www.sun.com/software/sunone/appserver/dtds/sun-web-app_2_3-1.dtd'>
<sun-web-app>
 <session-config>
   <session-manager persistence-type="s1ws60">
   <manager-properties>
     <property name="classname"
value="com.iplanet.server.http.session.IWSSessionManager"/>
     <property name="session-data-store"
value="com.iplanet.server.http.session.JdbcStore"/>
     <property name="session-failover-enabled" value="true"/>
     <property name="provider" value="com.sybase.jdbc2.jdbc.SybDriver"/>
     <property name="url"
value="jdbc:sybase:Tds:192.168.0.80:4100?BE_AS_JDBC_COMPLIANT_AS_POSSIBLE=true&amp;DYNAMIC_PREPARE=true&amp;SELECT_OPENS_CURSOR=false&amp;JCONNECT_VERSION=6&amp;PACKETSIZE=4096"/>
     <property name="username" value="xxxxx"/>
     <property name="password" value="yyyyy"/>
   </manager-properties>
   <store-properties>
   </store-properties>
   </session-manager>  
 </session-config>
</sun-web-app>

Now my problem is, when I initially created the session table:

create table sessions
(
SessionID varchar(100),
AccessTime numeric(9),
TimeOut numeric(9),
Value varbinary(4096)
)
go

create unique index sessions_udx on sessions( SessionID )
go

... I get:

Warning: Row size (4230 bytes) could exceed row size limit, which is 4010
bytes.

Fair enough, my database pagesize is 4K, so I dropped the table and changed
Value so that it is varbinary(3876) ... this time, no warning.

Now what I am worried is ... [ even if I have varbinary(4096) ], is the size
large enough ?

I can't find any limit anywhere on spec on what should be the max size for
an HttpSession .. .so maybe there isn't one.

I am tempted to extend the JdbcStore class so that session data is stored on
a SQL BLOB, which will address the size issue, at the cost of some I/O
performance, which I can fine tune ( I am also the DBA ) ... but it will
never be as fast as varbinary because of the extra I/O accessing blobs
( called images in Sybase ASE ) on separate data pages from the actual row.

In that event, what have you guys done using JDBC for storing HttpSessions ?

What about other commercial implementations that use JDBC for storing
HttpSessions ? What do they do ?
Andrea Desole - 14 Oct 2005 12:13 GMT
> I can't find any limit anywhere on spec on what should be the max size for
> an HttpSession .. .so maybe there isn't one.

probably not. The most important information for a session are probably
the session scoped variables, and they are stored in a map. I don't
think there is a limit for that

> I am tempted to extend the JdbcStore class so that session data is stored on
> a SQL BLOB, which will address the size issue, at the cost of some I/O
> performance, which I can fine tune ( I am also the DBA ) ... but it will
> never be as fast as varbinary because of the extra I/O accessing blobs
> ( called images in Sybase ASE ) on separate data pages from the actual row.

I don't know why you need it, but I can see the necessity to store a
session only in some special cases, like when a session expires and you
don't want want to lose information. In any case, mostly a session is
not saved very often. I wouldn't mind some (and how much?) performance
less in those rare cases.
Jesus M. Salvo Jr. - 15 Oct 2005 06:41 GMT
>> I am tempted to extend the JdbcStore class so that session data is stored
>> on a SQL BLOB, which will address the size issue, at the cost of some I/O
[quoted text clipped - 8 lines]
> not saved very often. I wouldn't mind some (and how much?) performance
> less in those rare cases.

I have more than more than 1 webserver behind a hardware load-balancer.
Requests to any of these webservers from the same client should have the
session available ( if not expired ) ... particularly if we stop / restart
one of the webservers.
Andrea Desole - 17 Oct 2005 09:29 GMT
> I have more than more than 1 webserver behind a hardware load-balancer.
> Requests to any of these webservers from the same client should have the
> session available ( if not expired ) ... particularly if we stop / restart
> one of the webservers.

I assume you looked at what possibilities your application server gives
to cluster your machines.
If it's not possible to do that automatically I would personally not use
the database, since you don't have to keep the session for a long time.
The database is probably not speeding things up. I would rather consider
a messaging system.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.