Showing posts with label Blitz. Show all posts
Showing posts with label Blitz. Show all posts

Monday, December 10, 2007

Distributed state management for ASP.NET

The more I delve into distributed architectures, the more I'm feeling like Microsoft just isn't providing much of a path forward to scalable distributed systems. Case in point: state management.

By default, session state in ASP.NET is stored in the web server's memory. To share state across servers - which you would want to do in a server farm - you need to store it in SQL Server or in the .NET state service. This is fine for small solutions, but once you bump up against the need to partition state across many servers or multiple hosting locations, things start to get complex and expensive.

Now, it seems the Java folks have worked through these issues already. Here I'm thinking of Space-Based Architecture and more concretely JavaSpaces.

Perhaps I'm oversimplifying, but wouldn't JavaSpaces be a perfect place to store session state in a distributed system? Data in a JavaSpace is persistent, atomic, distributed, & fault tolerant.

There isn't a .NET equivalent of JavaSpaces. But, MS does provide SessionStateStoreProviderBase and the ability to choose a custom provider for session state.

So, here's the recipe as I see it:
  1. Set up a JavaSpaces instance on a Linux cluster (probably using Blitz to start out with)
  2. Write a custom state provider that inherits from SessionStateStoreProviderBase and implements the necessary JavaSpaces methods. (Working out the bridging between .NET & JavaSpaces, of course. There is a tantalizing page called Using JavaSpaces from .NET - but it relies on a commercial product to accomplish this.)
  3. Change your ASP.NET web.config to point at your new custom state provider.
These don't appear to be big hurdles to overcome, and it seems like a nice little open source project.

(In the interest of due diligence, I did run across 2 commercial software products that seem to be solving this kind of problem: ScaleOut and NCache. But for a server farm of 20 servers, you're looking at something in the neighborhood of $30K, not including the cost of the Windows Server licenses + ongoing annual maintenance fees. There is also GigaSpaces, which provides hosted JavaSpaces and has a .NET API, but is also expensive.)


Here are some links I found useful in my research: