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

J

js

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 ?
 
A

Andrea Desole

js said:
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.
 
J

Jesus M. Salvo Jr.

Andrea said:
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.

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.
 
A

Andrea Desole

Jesus said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top