Bill Clementson and Avi Bryant have been discussing the problem of sharing a web application session across servers in a continuation based server.
The problem is basically that all state is stored inside the continuation object. A session is composed of multiple HTTP requests. To be nicely load balanced these requests may be served by seperate machines. How does the continuation get marshalled from machine to machine. This is especially a problem if the continuation is based on a language construct like Scheme's call/cc.
The common solution seems to be to limit the entire session to one machine. This solves the problem completely at the expense of less flexibility in load balancing. There's also the problem if the machine fails - a language based non persistable continuation cannot be restored. In practice this may not actually be a problem as Avi mentions.
Another solution is to have persistable continuations. Continuation objects in Sisc scheme are serializable. This means you can save then to a database after each request. You can reload it in another machine and all state is restored. You can shut the server down, restart it and the session can be resumed. The servlet example that is part of the 'contrib' module of Sisc can demonstrate this. You do have to make sure that the continuation doesn't reference any global state otherwise you risk persisting the entire world.
6:45:31 PM
|