.net – Is Memcached interchangeable with ASP.NET State Server

asp.netmemcachednet

I use ASP.NET and WCF services in a load balanced web server environment, using Memcached in the service layer.

I also wanted to replace the use of ASP.NET State Server (for Session State) with Memcached.
Now I am afraid it is not a good thing, because from what i understand,
Memcached is a cache server rather than a state server, is that true?

If I understand correctly, Memcached is not distributing data to other nodes in the Memcached farm.
Instead, a special hashing algorithm is used to determine which one of the nodes in the farm contains the data of a requested key,
whereas ASP.NET State Server distributes data ASAP when it has been added, to prevent a Single Point of Failure.

In other words, Memcached should be used only for performance reasons, the data stored in it should always be re-creatable,
in case the item has been removed to make room for new objects, or in case the single machine actually storing the data went down.

So can I not rely on Memcached only for storing session state data?
If i can't, then i don't understand how Memcached is often compared to and seen as
an alternative to using ScaleOut StateServer and ASP.NET State Server,
since these are really state servers, which is another thing, right?

I am now a bit unsure as to what is the best approach for high performance distributed session state in a web server farm.

Thanks

Best Answer

http://www.codeplex.com/memcachedproviders has a session state provider for asp.net that stores values in memcached. It provides the ability to backup the session data in ' SQL Server. As yogman said the session data is stored as one value. If an eviction happends, whole session for that user is lost and user will be directed to the login screen. Memcached doesn't evict any data before expiration unless it is running out of space to hold new data.