Beware Web Gardens and InProc Session State

by kevin 6/13/2008 12:01:00 AM
Stack o Books

It says it right there in the documentation. But somehow I had never picked up on it.

If you enable Web-garden mode by setting the webGarden attribute to true in the processModel element of the application's Web.config file, do not use InProc session state mode. If you do, data loss can occur if different requests for the same session are served by different worker processes.

We've been using ScaleOut StateServer for some time now. Aside from annoyances like not being able to see performance statistics for the in-memory cache, ScaleOut StateServer is a good product for managing state data in a large web server farm. (Read about my solution to the missing performance counters problem.) We followed most of the best practices for setting up StateServer. But as we approach the 11 million user mark at SnagAJob.com, we have been seeing more and more issues that point to ScaleOut being the root cause of some serious performance issues on our site during peak load.

We were using ten virtual machines running IIS6 with five IIS worker process instances per server. That's fifty worker processes. Not a huge web server farm but not puny, either. In any case, after speaking with ScaleOut support and learning that many of their customers report networking problems while using vmware ESX to host Windows Server and IIS, we decided to go back to InProc session state management for a while. To do this, we had to enable one of the session persistence modes on our load balancers which is far from ideal. Doing that makes things quite a bit less fault tolerant and slows down the deployment process considerably. But we had to do something and this seemed fairly low risk.

When we switched back to InProc session state management mode, we started noticing strange behavior for logged in users. Tests confirmed that the multi-instance web gardens were the culprit. We downgraded to one IIS worker process instance per server and everything is beautiful.

It's completely counter-intuitive to me (and to everyone else I've spoken) that multiple IIS worker process instances operating as a single web garden don't share InProc session state. Logically, it's one server, right? And Microsoft has had support for memory-mapped files in Win32 for more than a decade. Well, as I said, it's right there in the documentation. But an event log warning on application startup would have been nice in this case.

By the way, even though I like ScaleOut StateServer, our fifty IIS worker process instances have been reduced to three (yes, 3) and we are handling our normal volume nicely. We know that our networking environment isn't ideal. Any company that has to be meet the PCI Security Standards is going to jump through some intricate networking hoops. But there's little reason to deploy fifty server instances to solve a scaling problem when three will do.

Currently rated 1.0 by 1 people

  • Currently 1/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , , ,

Architecture | IIS

Related posts

Comments

6/13/2008 8:28:29 AM

Justin Etheredge

So, right now you are running three IIS worker processes on three boxes with inProc session state and your load balancer setup to use sticky sessions? Interesting. Is there a reason that you couldn't run a web garden and then use the state service on each IIS machine (since you already have sticky sessions on)?

I guess though that if your three worker processes are handling your load fine, then why bother? The drop from 50 to 3 though is pretty amazing, I'd love to hear what you guys find out about where the bottleneck is. That just seems like an unreal drop.

One other thing I wasn't super clear on, are you guys using VMWare ESX to run your IIS boxes?

Justin Etheredge us

6/13/2008 8:32:15 AM

Justin Etheredge

Ooops, I didn't read closely enough. I see where you said "we use 10 virtual machines", but my question is, what do you guys see as the biggest advantage of this setup over just running IIS right on the box. What kind of overhead do you guys see from the VMs?

Justin Etheredge us

6/13/2008 8:54:03 AM

W. Kevin Hazzard

The benefits of virtualization in the web tier have more to do with operational efficiency than anything else. I can move IIS servers between vmware hosts in a matter of seconds. Creating snapshots and backups of virtual machines is also very quick and easy. We haven't seen any overhead, per se. However, we do have some networking glitches that are hard to explain. We virtualize the Ethernet NICs across all of the VMs running on an ESX host. And we team those NICs as Etherchannel to multiple switching hardware. This allows for fault tolerance and potentially for more performance. However, I don't know that the ESX Etherchannel implementation is rock solid.

W. Kevin Hazzard us

6/13/2008 12:07:24 PM

Justin Etheredge

I figured it was for efficiencies at the management level, does VMWare ESX run as a hypervisor or does it run at the OS level?

Justin Etheredge us

6/13/2008 2:05:03 PM

kevin

vmware ESX is an operating system designed from the ground up for virtualization.

kevin us

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

8/28/2008 1:57:43 AM

Powered by BlogEngine.NET 1.3.1.0
Theme by Mads Kristensen


Kevin's on Twitter / FriendFeed

W. Kevin Hazzard Welcome to Kevin Hazzard's Blog. Kevin is a Software Architect, Professor and Microsoft MVP specializing in C#, WCF, Silverlight and IronPython.

View Kevin Hazzard's profile on LinkedIn
Microsoft MVP Award When a problem comes along, you must flip it!

Calendar

<<  August 2008  >>
MoTuWeThFrSaSu
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567

View posts in large calendar

Recent comments

Authors

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008

Sign in