Scott Hanselman

Load Balancing and ASP.NET

March 23, '04 Comments [2] Posted in ASP.NET | ViewState
Sponsored By

Deployed a site this weekend with much success.  A few things that one always needs to remember when putting out a "site" that's on more than one server ("box").

  • In-process Session State + More than One Web Server: If you're using in-proc Session on ASP.NET, remember that the session has "affinity" with the server.  That means that if www2.hanselman.com is the first server the user ever hits, the user will get an ASPSESSIONID cookie that is an index into the Cache object (the In-Proc Session is really just a key to a Hashtable-type structure inside the Cache/Application) that only exists in the memory of THAT ONE SERVER.  So, since you're using Load Balancing (you have more than one server) it's important to ensure you're using "sticky connections" or node-affinity to guarantee the user gets back to his/her session on the next HTTP Request. 
    Note that it's often tricky to get a user back to the same box when dealing with "mega-proxies" of large corporations, ISPs, and AOL.  That means that if your load-balancer (hardware or otherwise) is looking at various combinations of IP+VPORT+Whatever that these values MAY CHANGE if the ISP changes their source port or IP address.  If you're using SSL, you can use the SSL ID to route traffic, but this can slow you down a smidge.  You can also let the hardware loadbalancer add in a cookie of its own.  Check your loadbalancer's FAQ for details.  But, it's worth being aware of the things
  • Out-of-Proc (State Server) + More than One Web Server: If you are using the State Service, you might think about putting it behind your second firewall, in a different DMZ than both the Web Servers or the Database. 
  • Out-of-Proc State Server + ONLY ONE Web ServerSome folks use the Session State Service even if they have only one Web Server so the session state isn't lost when the ASPNET_WP.EXE process recycles.  If you do this, make sure to lock down the state service to serve local requests only.

    HKLM\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnections

    You can also change the port that the state service listens on with the following key:

    HKLM\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\Port

    If you're using the state server in a web farm, it's important that you put it behind a firewall or otherwise prevent anything but the web servers from talking to it. [Early and AdopterEarly and Adopter]

  • WebFarm Gotchas: When you're using either the State Service or SQL Server Session State, you're indicating that you don't want "session affinity" and you'll probably set your Load Balancer to Round-Robin dispatching of traffic. (It won't using any smarts or algorithms to get traffic, it will just go 1, 2, 3, etc.)  When you do this AND you're using Forms Authentication OR you have EnableViewStateMAC set to protect your ViewState, remember to synchronize your <machinekey> between all machines in the farm.  As users move around your site, each page could put served up from a different machine, meaning that not only are your encrypted forms-auth cookies passed around, but your ViewState (protected by the machinekey) may be sourced from one machine, and posted to another.

  • Security: Remember to secure the crap out of everything you do. 

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

The Visual History of the Graphical User Interface

March 22, '04 Comments [1] Posted in
Sponsored By

A great find from Tim Tabor, it's Marcin Wichary's Guidebook: Graphical User Interface Gallery, featuring some great historical timelines illustrating the history of the icon.  The site is truly a treasure.  One of my favorite sections is a collection of "First Run" Screenshots - all the different GUIs as they look just after setup.

 

 


 

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

"Geeks and the Women/Men Who Love Them" or "Normal People are from Earth, Coders are from Sedna"

March 19, '04 Comments [2] Posted in ASP.NET | Movies
Sponsored By

This is a great post folks are talking about on Matt Warren's blog (a C# design engineer at MSFT, and one of the guys designing Xen, a language whose name is clearly stolen from me, as I have patented and trademarked all things Zen.  Send me a check next time you meditate. :) )

At my company, we all are deep, deep in the development of the 2nd revision of our .NET eFinance SDK (which I had the pleasure of demoing via WebCast today) and I think it's fair to say we're consumed.  We're refactoring and generating code and improving and building and abstracting and dancing and generally killing ourselves.  (Apparently Patrick is feeling the pressure and went to McDonalds.  If I remember correctly, he was a vegetarian once, so this is a concerning turn of events.

I'm trying to work out more, watch movies, read/listen (Audible.com+iPod...use it, live it) but I'm still up late running through designs in my mind.  It's the kind of consumption you've only read about.  And it's usually in the context of tortured artists that cut their ears off experience.  My wife, however, is an MBA.  The operative letters being "Master" and "Business" while I am a "Master of None."  I came home today and told her about our new plan to introduce a new interface - blah blah - .NET solution - blah blah - reduce compile time dependencies - blah blah - revolutionize the company - blah blah - TLBs and Interop assemblies.  I painted a picture for her complete with charts and graphs and jazz hands.  All it elicited was "that's nice dear."  Talk about an artist not being appreciated for his work!  :) Now it's 12:34am, she's asleep on the couch and I'm coding away!  Must...create...must...dance...jazz hands!

Perhaps it's time for me to get my Master's.  But not in CS.  I think someone as tortured as I should be a starving artist and get an MFA in Software.




Some highlights of Matt's post:

Like an artist I must channel this energy through my being and out my fingers, onto a digital canvas, because that is what the expression of my ideas become to me, my art.  I paint with the keyboard, patterns in symbols, lines and logical structure.  It's more than the simple words, the names and statements, the loops and threads. 

It speaks of motion, a liquid flow, a living breathing thing, and you can feel it when you read it, drinking it in. 

Real coders know this.  They know their programs are alive, somewhere there in the machine, even if only caught in time. 

The best comment on the post was this:

Oh yes, I knew this already! I pray for the day my husband comes up from the cold, dark, stinky basement and asks for a beer and plops down in front of the TV to watch the Packers play. Heck I'd settle for a white wine spritzer and figure skating at this point! I sit with a smile on my face nodding as I listen to him excitedly rant about .Net and how he got a (whatever you call it) down to .003 seconds from its previous 3.8! I hug him and tell him I'm proud of him and he can do anything because I know that one day, that idea that's clawing and chewing its way out of his brain will make it out!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

A tale of three Scotts worth listening to...

March 18, '04 Comments [3] Posted in DevDays
Sponsored By

Carl Franklin forwarded this along which contained a few fun things.

First, this DevDays attendee was really digging the DevDays DVD.  Word on the street is that it's worth the price of admission. :)  Kudos to Vertigo Software!

Secondly, he thought I was Scott Stanfield when he started reading my blog.  That's a compliment no matter which direction you look at it.  Scott's a friend and great speaker.  And it's always fun to see him and do the whole 'Scott!' 'Scott!' 'Scott?' 'Scott.' 'Scott...' back and forth. 

As it turns out, there are actually 3 distinct people named Scott that are really worth listening to if you get the chance.  As luck would have it, they've all been guests on .NET Rocks, so you DO have a chance. [Joshua Flanagan]

A nice bunch of Scott's to be associated with.  I'm sure there are others! :)  Who's your favorite Scott?  One day I vow to get off page 12!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.