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;
- The NoSQL database should be supported by a Session State provider which was already available. I don’t want to build one myself.
- 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.