Tuesday, October 25, 2005

I ran into a nasty performance problem recently.  It involved some AJAXy type dynamic requests.  The problem was that two requests always seemed to be occuring serially rather than taking advantage of the wonders of a multithreaded server and running in parallel.  After much spelunking and debugging, it suddenly occurred to me that the handlers were marked with IRequiresSessionsState to pull a trivial piece of information out of the session.

You may not be aware, but accessing the session usually results in an exclusive lock.  Normally, this isn't a problem since users very seldomly open multiple windows or send simulataneous requests, and sessions usually represent unique users.  But fire off two simultaneous requests, and they will be processed serially.

But, if you mark your page as being "ReadOnly" (or disabled) via the EnableSessionState attribute of the @Page directive (or IReadOnlySessionState for IHttpHandlers), you'll help yourself out.  ReadOnly will get a reader lock on the state, allowing multiple readers access, while disabled (via "false") will not lock at all.  In addition, if you're running your session state out-of-process, disabled will keep you from incuring a hit from the db or other store access.

Just an interesting bit of information that thought would be useful.

posted on Tuesday, October 25, 2005 12:28:11 PM (Pacific Standard Time, UTC-08:00)  #    Comments [0]
Related posts:
9-year Anniversary (yesterday)
LinqToStdf now on CodePlex
Image Slicer for Deep Zoom in Silverlight 2
Silverlight limitations and Constrained Callvirt in IL
Happy Birthday Peter
What are the generic Delegates in the framework for?
Tracked by:
"astoria city travel inn melbourne" (astoria city travel inn melbourne) [Trackback]
"maps australia" (maps australia) [Trackback]
"Careers in Psychology" (Careers in Psychology) [Trackback]
"cursos formacion barcelona" (cursos formacion barcelona) [Trackback]
"used car under 5000" (used car under 5000) [Trackback]
"blood presure monitor" (blood presure monitor) [Trackback]
"piu carino asiatiche strip" (piu carino asiatiche strip) [Trackback]
"Residential Garage Doors" (Residential Garage Doors) [Trackback]
"caroline county public library" (caroline county public library) [Trackback]
"motorola australia" (motorola australia) [Trackback]
"colleges escorts state college pa" (colleges escorts state college pa) [Trackback]
"brain teasers ice breakers" (brain teasers ice breakers) [Trackback]
"creatine facts" (creatine facts) [Trackback]
"win xp pro key" (win xp pro key) [Trackback]
"special window envelopes" (special window envelopes) [Trackback]
"girls sleeping hardcore" (girls sleeping hardcore) [Trackback]
"bridal lingerie and headpieces" (bridal lingerie and headpieces) [Trackback]
"Hilton embassy row" (Hilton embassy row) [Trackback]
"student loan consolidation center" (student loan consolidation center) [Trackback]
"closet organization hawaii" (closet organization hawaii) [Trackback]
"dukes of hazzard movie" (dukes of hazzard movie) [Trackback]
"ohio homeland security" (ohio homeland security) [Trackback]
"Free Desktop Icons" (Free Desktop Icons) [Trackback]
"mail order brides" (mail order brides) [Trackback]
"milf in car" (milf in car) [Trackback]
"diabetes treatment" (diabetes treatment) [Trackback]
"Boston Marathon Winners" (Boston Marathon Winners) [Trackback]
"residence inn%2C silver spring%2C maryland" (residence inn%2C silver spring%2C ... [Trackback]
"dorm dude" (dorm dude) [Trackback]
"to kill a mockingbird" (to kill a mockingbird) [Trackback]
"CD data disk duplication program" (CD data disk duplication program) [Trackback]
"festival of lights" (festival of lights) [Trackback]
"used cars under %245%2cooo%2fnorthern ca or or" (used cars under %245%2cooo%2fn... [Trackback]