Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Do servlet servers sill have trouble with sessions?

 
paul wheaton
Trailboss
Pie
Posts: 21188
Firefox Browser IntelliJ IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many moons ago I worked on a servlet intensive project using JRun. After a lot of frustration we discovered that the JRun servlet session stuff had some serious problems and we had to handle sessions manually.
Later, I found out that the new JRun stuff had not fixed the problem. Then, talking to some engineers using other J2EE servers, discovered that this is a very common problem.
Now I'm about to get hip deep in a new project that will require sessions. Should I roll my own or should I trust the built in stuff?
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't say that I've had any problems with sessions in the last couple of years to be honest. Perhaps with the early Tomcat and WebLogic releases but nothing recently.
Simon
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13048
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We run JRun 3.1 with no noticable problem with sessions. You do have to be sure all of the objects in the session are serializable.
Bill
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No other Server that I know of has any problems with sessions, even when clustered. There's just two rules to live by:
(1) Make everything in them serializable (and use transient fields for things that aren't).
(2) If you're using clustering, keep the sessions relatively small in total size (<16K each) for performance reasons.
Kyle
 
k Oyedeji
Ranch Hand
Posts: 96
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul
Can you remember any specifics at to what the issues were?
Thanks
 
paul wheaton
Trailboss
Pie
Posts: 21188
Firefox Browser IntelliJ IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I remember that we had an applet that needed access to the session. Since the applet was treated by the server as a seperate session, we would get the browser session ID and pass it to the applet. The applet would pass that to the server when it needed information and the session would be pulled up by ID. Sometimes passing in the right ID gave you back somebody else's session.
It seems there were some other problems that I cannot remember.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13048
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you describe might have been caused by sloppy coding using servlet instance variables or otherwise mixing up objects outside the session mechanism.
Bill
 
paul wheaton
Trailboss
Pie
Posts: 21188
Firefox Browser IntelliJ IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know that in the end it turned out to be bugs within JRun. When bringing the issue up with other engineers over the year or two afterward, I came to the conclusion that it was a common problem and many folks had ended up rolling their own session management (not always a light task).
 
DC Dalton
Ranch Hand
Posts: 287
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I run 5 different sites that rely heavily on sessions & have NEVER had a problem with them. I use Linux, Cobal & Webppliance servers, Tomcat & Resin servlet engines.... I even have one that dumps hundreds of rows from a db into an object, then session so the cust so go thru one record at a time approving them.....never even blinks!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic