The Artima Developer Community
Sponsored Link

Java Buzz Forum
Sessions on the Client

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Brian McCallister

Posts: 1282
Nickname: frums
Registered: Sep, 2003

Brian McCallister is JustaProgrammer who thinks too much.
Sessions on the Client Posted: Oct 18, 2003 12:13 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Brian McCallister.
Original Post: Sessions on the Client
Feed Title: Waste of Time
Feed URL: http://kasparov.skife.org/blog/index.rss
Feed Description: A simple waste of time and weblog experiment
Latest Java Buzz Posts
Latest Java Buzz Posts by Brian McCallister
Latest Posts From Waste of Time

Advertisement

Bill de hOra posted an article on scalability on the web and how the current mode of storing session infomration on the server is broken. I have joked before about writing a session manager that serializes the whole HttpSession and plugs it into a hidden form field, or in an array of cookies so that it can be done independently of content.

This absurd idea is becoming more promising as time passes. As Bill points out, web applications will never scale (concurrent user limit increase linearly against amount of hardware) really high unless state is moved off of the the server. So, I have decided to think about how to do this.

The first problem is security. Not being able to trust the session content is a pain in the butt. This is solvable via cryptography. You take a hit serializing, encrypting, decrypting, and deserializing the session state on every request but this is small potatoes compared to session replication on the eBay/Yahoo!/Google scale webapps.

The second problem is size - it is *really* nice to keep a reference to the logged in user, the shopping cart, the history, whatever in the session. This is typically a convenience to avoid re-materializing it from the database, but it is a major convenience as database hits are expensive (or rather, massively scalable clustered databases are expensive) so we want to avoid making that hit if we can. No way around this, we need to minimize the volume of data stored in the session until everyone has T3 sized broadband.

Bandwidth is a big problem here. You pay for bandwidth. The thing is that the bandwidth available can scale up linearly - it is just expensive. You need a revenue model where you make enough on the traffic you build for to pay for the increased bandwidth. No way around that. You can help some by compressing the serialized session information before encrypting it. This puts even more load on the servers, but servers are cheap and session is fully replicated much easier now.

That's it. Those are the drawbacks. Serialize all session data, encrypt it, chunk it into cookie sized pieces, send/retrieve the cookies, decrypt it again. The major drawback comes from accessing the data that is *not* session oriented -- prices, products, etc. You still need fancy database clustering techniques (reads from an array of slaved databases, writes to a smaller cluster of write-enabled master databases) etc. Still, it is a step up in some situations. Hmm, oh yeah, guess you need cookies enabled. Maybe I'll take a stab at making this at the ApacheCon hackathon.

Read: Sessions on the Client

Topic: Oh Emacs, I tried Previous Topic   Next Topic Topic: Microsoft Does O/R Mapping... Finally (and a big digression)

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use