DevOpsGroup has joined Sourced, an Amdocs company. Read more about this partnership and what this means for the future in our blog.

DevOpsGroup Blog Best performing ASP.NET Session State Providers - 2013

Best performing ASP.NET Session State Providers – 2013

Applications use session state. Whether session state should be used or not is a hot topic of debate, but lots of applications use session state – fact.

Recently, I was involved in troubleshooting a performance issue for a customer. As it turns out, their application was hammering session state into a Microsoft SQL Server Database. The web application was taking some fairly meaty load – 100,000’s page requests per hour spread across 15 or so web servers.  When I dug into the detail with the development team it became clear that they’d used SQL Server as a session state provider because – and I quote; “We had nowhere else to put it”.

In Microsoft ASP.NET applications this is something I’ve seen quite often, but this time it got me thinking……storing session state in SQL server seems like using a sledge hammer to crack a nut, so I decided to take a look at some alternatives.

I wanted to look beyond the typical Session State Server solution and NoSQL databases seemed the obvious route. Some are perfectly designed for Session State (some are not) and it was logical that they’d make a great alternative. But which would be the best fit?

To start off I set some rules, I wanted the following;

  1. The NoSQL database should be supported by a Session State provider which was already available. I don’t want to build one myself.
  2. Performance is paramount. I want to pick the best performing provider.

After some quick searches on NuGet and Google I discovered a couple of Session State Providers for Couchbase, Redis, MemCached and RavenDb. That was easy; four options found pretty quickly. However, when I started to try and understand the best performing provider, I just couldn’t get a clear answer.

So which is the best performing session state provider for ASP.NET?
To answer this, I needed some hard evidence, but there’s not much out there apart from conjecture, so I decided to load test each provider and find out.

In this series of blog posts I thought it would be useful to share more than just the results of my test.  So I’ll walk you through setting up each of the Session State Providers and their pre-requisites. However, since some of you won’t care about that, in the first post we’ll cut straight to the chase and look at the results.

Best performing session state providersDev Mgr

DevOpsGuys have wide-ranging experience in using marketing leading Application Performance Management Tools, such as AppDynamics, New Relic and CloudMeter Insight. Our team would love to help you realise these same great benefits, so contact us today for more information on how we can help.

32 thoughts on “Best performing ASP.NET Session State Providers – 2013

    1. After reviewing a number of factors including recency of provider updates, community support for the providers, popularity of nuget packages we felt that memcached was not a provider that should be included in our initial testing. Do you feel that this is a provider that is widely adopted or that more people are now choosing to use CouchBase or Redis?

  1. Thanks for the great article. I’ve been thinking of using Redis for session state in an mvc app and it seems from your blog that would be a good choice. Did you end up posting on how to set up any of the providers?

    1. Thanks for the feedback and comment, glad you liked the article. We’ve dropped behind on our schedule, but based on your feedback we’ll get the Redis deployment guidelines out sharpish. I’ll be happy to send you the abridged instructions by email if you want them?

      1. I would also love a copy, I’ve been looking at solutions to replace the MS SQL sessions state db and this just saved me a ton of time.
        Thanks, it’s a great concise analysis.

  2. Thanks for the insightful analysis. Did you investigate whether or not the Redis provider supports automatic failover of Redis instances (via Sentinel) or will we need to wait for Redis clustering or roll our own provider? I would appreciate receiving the Redis setup instructions via email.

    1. I’m not sure of the exact sizes but my guess would be that the session state for the simple test was a few kB. The session state was the complex test was would have been between 10kb and 100Kb in size.

  3. Hi, did you get real world benefits from moving the session state from SQL Server to Redis?, I’m on a very similar situation like yours, could you comment on the benefits you got from moving out from SQL Server?
    Thanks in advance!

    1. We definitely saw real world benefits of running a Redis Configuration in production. In one example for a large eCommerce customer this approach took significant pressure off the main SQL Server leaving it to manage the important data requests, as all requests for session state data were pushed to the Redis Servers, from this we saw a decent performance gain under heavy load.

  4. Great article, thank you! Did you consider using Microsoft appFabric at all in your tests? Also did you install Redis on a Linux box or did you use the windows port? If you used the port could you also send a copy of the install/config guide to me that you mentioned in a previous comment response? Thanks in advance!

    1. Thanks for the feedback. We haven’t considered using AppFabric but it’s a great suggestion and we might think about a new round of tests in early 2014 with this included. Redis was install on Ubuntu 12.04. We found that was the best option and given that it’s only dedicated to session state management was easy enough to managed in a mixed environment. If you try a windows port, then please let us know. If you’d like the installation instructions for Redis, then also let us know, we will be blogging them soon. Thanks.

  5. I just released my company’s Redis Session Provider for ,NET, and it’s been running very well for the past year handling 25 million web requests a day. it’s located at , please give it a look. Sorry for the shameless plug, first time open-sourcing anything.

    1. Looks like you are using the Booksleeve .net redis library. Did you evaluate any of the others? I’m trying to use Redis for session as well as a generic distributed cache. I’m trying to figure out which client library to use. I started out with service stack, but the license is non-commercial. Would appreciate any insight.

  6. This was done several years ago, have you had a chance to run this test again using the latest versions of Redis and SQL Server 2016 In-Memory ASPState database?

    1. Hi Jeff – no we haven’t re-run it unfortunately. We’ve been flat out doing other DevOps stuff!

Leave a Reply

Your email address will not be published.