Uncategorized

autoConfig=”false” effects

My post on autoConfig triggered and interesting discussion with my colleague Cenk about which is the real effect of this setting; one of his customers asked what to do if they needed to adjust only one or two values and not all the ones discussed in Contention, poor performance, and deadlocks when you make Web service requests from ASP.NET applications, they wanted to be sure they could change only what they needed to fine tune and forget about the rest. The short answer is: you can change only what you need to and leave he rest as is, since we have default values hardcoded to improve performance so you’re safe (provided the values you’re changing make sense in the context, of course).

If we have a look at System.Web.Configuration.ProcessModelSection with Windbg, we can see all the properties we have in <processModel> and _defaultValue corresponds to the defaults we have in machine.config.comments:

0:000> !do 06904868
Name: System.Web.Configuration.ProcessModelSection
MethodTable: 6638dcb0
EEClass: 663a0604
Size: 64(0x40) bytes
 (C:\Windows\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll)
Fields:
      MT    Field   Offset                 Type VT     Attr    Value Name
7910be50  400014d       30       System.Boolean  1 instance        0 _bDataToWrite
7910be50  400014e       31       System.Boolean  1 instance        0 _bModified
7910be50  400014f       32       System.Boolean  1 instance        1 _bReadOnly
7910be50  4000150       33       System.Boolean  1 instance        0 _bElementPresent
7910be50  4000151       34       System.Boolean  1 instance        1 _bInited
648eff64  4000152        4 ...ionLockCollection  0 instance 00000000 _lockedAttributesList
648eff64  4000153        8 ...ionLockCollection  0 instance 00000000 _lockedAllExceptAttributesList
648eff64  4000154        c ...ionLockCollection  0 instance 00000000 _lockedElementsList
648eff64  4000155       10 ...ionLockCollection  0 instance 00000000 _lockedAllExceptElementsList
648ea704  4000156       14 ...nfigurationValues  0 instance 069048a8 _values
790fd8c4  4000157       18        System.String  0 instance 00000000 _elementTagName
648f032c  4000158       1c ...lementInformation  0 instance 00000000 _evaluationElement
648eee30  4000159       20 ...onElementProperty  0 instance 068fce20 _elementProperty
648f53d0  400015a       2c         System.Int32  1 instance        0 _fItemLocked
648f0a48  400015b       24 ...ontextInformation  0 instance 00000000 _evalContext
648eda8c  400015c       28 ...nfigurationRecord  0 instance 028bea78 _configRecord
7912d8f8  4000148        8      System.Object[]  0   shared   static s_lockAttributeNames
    >> Domain:Value  023d04b0:NotInit  024169d0:068fcd1c <<
79101fe4  4000149        c ...ections.Hashtable  0   shared   static s_propertyBags
    >> Domain:Value  023d04b0:NotInit  024169d0:068fcd40 <<
00000000  400014a       10                       0   shared   static s_perTypeValidators
    >> Domain:Value  023d04b0:NotInit  024169d0:00000000 <<
790fd0f0  400014b       14        System.Object  0   shared   static s_nullPropertyValue
    >> Domain:Value  023d04b0:NotInit  024169d0:068fce08 <<
648eee30  400014c       18 ...onElementProperty  0   shared   static s_ElementProperty
    >> Domain:Value  023d04b0:NotInit  024169d0:068fce20 <<
648eee84  400015d       38 ...ectionInformation  0 instance 069049b8 _section
648eee30  4001928      74c ...onElementProperty  0   shared   static s_elemProperty
    >> Domain:Value  023d04b0:NotInit  024169d0:06903da8 <<
7911228c  4001929      748      System.TimeSpan  1   shared   static DefaultClientConnectedCheck
    >> Domain:Value  023d04b0:NotInit  024169d0:06903850 <<
648ef118  400192a      750 ...ropertyCollection  0   shared   static _properties
    >> Domain:Value  023d04b0:NotInit  024169d0:06904714 <<
648ef05c  400192b      754 ...igurationProperty  0   shared   static _propEnable
    >> Domain:Value  023d04b0:NotInit  024169d0:06903db4 <<
648ef05c  400192c      758 ...igurationProperty  0   shared   static _propTimeout
    >> Domain:Value  023d04b0:NotInit  024169d0:06903df4 <<
648ef05c  400192d      75c ...igurationProperty  0   shared   static _propIdleTimeout
    >> Domain:Value  023d04b0:NotInit  024169d0:06903e38 <<
648ef05c  400192e      760 ...igurationProperty  0   shared   static _propShutdownTimeout
    >> Domain:Value  023d04b0:NotInit  024169d0:06903e7c <<
648ef05c  400192f      764 ...igurationProperty  0   shared   static _propRequestLimit
    >> Domain:Value  023d04b0:NotInit  024169d0:06903ed8 <<
648ef05c  4001930      768 ...igurationProperty  0   shared   static _propRequestQueueLimit
    >> Domain:Value  023d04b0:NotInit  024169d0:06903f74 <<
648ef05c  4001931      76c ...igurationProperty  0   shared   static _propRestartQueueLimit
    >> Domain:Value  023d04b0:NotInit  024169d0:06903ff8 <<
648ef05c  4001932      770 ...igurationProperty  0   shared   static _propMemoryLimit
    >> Domain:Value  023d04b0:NotInit  024169d0:06904064 <<
648ef05c  4001933      774 ...igurationProperty  0   shared   static _propWebGarden
    >> Domain:Value  023d04b0:NotInit  024169d0:069040a4 <<
648ef05c  4001934      778 ...igurationProperty  0   shared   static _propCpuMask
    >> Domain:Value  023d04b0:NotInit  024169d0:069040e4 <<
648ef05c  4001935      77c ...igurationProperty  0   shared   static _propUserName
    >> Domain:Value  023d04b0:NotInit  024169d0:06904118 <<
648ef05c  4001936      780 ...igurationProperty  0   shared   static _propPassword
    >> Domain:Value  023d04b0:NotInit  024169d0:0690414c <<
648ef05c  4001937      784 ...igurationProperty  0   shared   static _propLogLevel
    >> Domain:Value  023d04b0:NotInit  024169d0:06904180 <<
648ef05c  4001938      788 ...igurationProperty  0   shared   static _propClientConnectedCheck
    >> Domain:Value  023d04b0:NotInit  024169d0:069041d4 <<
648ef05c  4001939      78c ...igurationProperty  0   shared   static _propComAuthenticationLevel
    >> Domain:Value  023d04b0:NotInit  024169d0:06904218 <<
648ef05c  400193a      790 ...igurationProperty  0   shared   static _propComImpersonationLevel
    >> Domain:Value  023d04b0:NotInit  024169d0:0690426c <<
648ef05c  400193b      794 ...igurationProperty  0   shared   static _propResponseDeadlockInterval
    >> Domain:Value  023d04b0:NotInit  024169d0:069042c0 <<
648ef05c  400193c      798 ...igurationProperty  0   shared   static _propResponseRestartDeadlockInterval
    >> Domain:Value  023d04b0:NotInit  024169d0:06904304 <<
648ef05c  400193d      79c ...igurationProperty  0   shared   static _propAutoConfig
    >> Domain:Value  023d04b0:NotInit  024169d0:06904348 <<
648ef05c  400193e      7a0 ...igurationProperty  0   shared   static _propMaxWorkerThreads
    >> Domain:Value  023d04b0:NotInit  024169d0:069043ac <<
648ef05c  400193f      7a4 ...igurationProperty  0   shared   static _propMaxIOThreads
    >> Domain:Value  023d04b0:NotInit  024169d0:0690443c <<
648ef05c  4001940      7a8 ...igurationProperty  0   shared   static _propMinWorkerThreads
    >> Domain:Value  023d04b0:NotInit  024169d0:069044cc <<
648ef05c  4001941      7ac ...igurationProperty  0   shared   static _propMinIOThreads
    >> Domain:Value  023d04b0:NotInit  024169d0:0690455c <<
648ef05c  4001942      7b0 ...igurationProperty  0   shared   static _propServerErrorMessageFile
    >> Domain:Value  023d04b0:NotInit  024169d0:069045c8 <<
648ef05c  4001943      7b4 ...igurationProperty  0   shared   static _propPingFrequency
    >> Domain:Value  023d04b0:NotInit  024169d0:069045fc <<
648ef05c  4001944      7b8 ...igurationProperty  0   shared   static _propPingTimeout
    >> Domain:Value  023d04b0:NotInit  024169d0:06904640 <<
648ef05c  4001945      7bc ...igurationProperty  0   shared   static _propMaxAppDomains
    >> Domain:Value  023d04b0:NotInit  024169d0:069046a8 <<
79102290  4001946      938         System.Int32  1   shared   static cpuCount
    >> Domain:Value  023d04b0:NotInit  024169d0:2 <<

0:000> !do 0690443c
Name: System.Configuration.ConfigurationProperty
MethodTable: 648ef05c
EEClass: 648eefec
Size: 52(0x34) bytes
(C:\Windows\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll)
Fields:
MT Field Offset Type VT Attr Value Name
790fd8c4 4000277 4 System.String 0 instance 06903c08 _name
790fd8c4 4000278 8 System.String 0 instance 06903c08 _providedName
790fd8c4 4000279 c System.String 0 instance 00000000 _description
79106894 400027a 10 System.Type 0 instance 068b7554 _type
790fd0f0 400027b 14 System.Object 0 instance 06904430 _defaultValue
7a7588dc 400027c 18 …del.TypeConverter 0 instance 00000000 _converter
648ef1a0 400027d 2c System.Int32 1 instance 0 _options
648f022c 400027e 1c …tionValidatorBase 0 instance 06904418 _validator
790fd8c4 400027f 20 System.String 0 instance 00000000 _addElementName
790fd8c4 4000280 24 System.String 0 instance 00000000 _removeElementName
790fd8c4 4000281 28 System.String 0 instance 00000000 _clearElementName
648f022c 4000274 68 …tionValidatorBase 0 shared static NonEmptyStringValidator
>> Domain:Value 023d04b0:NotInit 024169d0:068fcc00 <<
648f022c 4000275 6c …tionValidatorBase 0 shared static DefaultValidatorInstance
>> Domain:Value 023d04b0:NotInit 024169d0:068fcc14 <<
790fd8c4 4000276 70 System.String 0 shared static DefaultCollectionPropertyName
>> Domain:Value 023d04b0:NotInit 024169d0:068fcbec <<

0:000> !do 06904430
Name: System.Int32
MethodTable: 79102290
EEClass: 79102218
Size: 12(0xc) bytes
(C:\Windows\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll)
Fields:
MT Field Offset Type VT Attr Value Name
79102290 40003e9 4 System.Int32 1 instance 20 m_value

<processModel
    enable = "true" [true|false]
    timeout = "10675199.02:48:05.4775807" [HH:MM:SS]
    idleTimeout = "10675199.02:48:05.4775807" [HH:MM:SS]
    shutdownTimeout = "00:00:05" [HH:MM:SS]
    requestLimit = "2147483647" [number]
    requestQueueLimit = "5000" [number]
    restartQueueLimit = "10" [number]
    memoryLimit = "60" [number]
    webGarden = "false" [true|false]
    cpuMask = "0xffffffff" [number]
    userName = "machine" [String]
    password = "AutoGenerate" [String]
    logLevel = "Errors" [None | All | Errors]
    clientConnectedCheck = "00:00:05" [HH:MM:SS]
    comAuthenticationLevel = "Connect" [None | Call | Connect | Default | Pkt | PktIntegrity | PktPrivacy]
    comImpersonationLevel = "Impersonate" [Default | Anonymous | Delegate | Identify | Impersonate]
    responseDeadlockInterval = "00:03:00" [HH:MM:SS]
    responseRestartDeadlockInterval = "00:03:00" [HH:MM:SS]
    autoConfig = "false" [true|false]
    maxWorkerThreads = "20" [number]
    maxIoThreads = "20" [number]
    minWorkerThreads = "1" [number]
    minIoThreads = "1" [number]
    serverErrorMessageFile = "" [String]
    pingFrequency = "10675199.02:48:05.4775807" [HH:MM:SS]
    pingTimeout = "10675199.02:48:05.4775807" [HH:MM:SS]
    maxAppDomains = "2000" [number]
/>

Internally to debug managed code we use a Windbg extension which works well with private symbols and has some additional commands the public sos.dll does not have and one of those shows the ThreadPool configuration, very useful to have a quick report of those configuration values.

After the discussion I found myself thinking how to extract those values from a dump using only public symbols and the public sos extension everyone has access to; two of them are quite easy to find out (you can get a full list of members of ThreadpoolMgr class running mscorwks!ThreadpoolMgr*):

0:000> ?poi(mscorwks!ThreadpoolMgr::NumberOfProcessors)
Evaluate expression: 2 = 00000002

0:000> ?poi(mscorwks!ThreadpoolMgr::MaxLimitTotalWorkerThreads)
Evaluate expression: 200 = 000000c8

From System.Web.RequestQueue we can get _minLocalFreeThreads, _minExternFreeThreads and _queueLimit (RequestQueueLimit):

Name: System.Web.RequestQueue
MethodTable: 663aebf0
EEClass: 663aeb80
Size: 64(0x40) bytes
 (C:\Windows\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll)
Fields:
      MT    Field   Offset                 Type VT     Attr    Value Name
79102290  4001203       14         System.Int32  1 instance      176 _minExternFreeThreads
79102290  4001204       18         System.Int32  1 instance      152 _minLocalFreeThreads
79102290  4001205       1c         System.Int32  1 instance     5000 _queueLimit
7911228c  4001206       2c      System.TimeSpan  1 instance 0691da2c _clientConnectedTime
7910be50  4001207       28       System.Boolean  1 instance        1 _iis6
791087cc  4001208        4 ...Collections.Queue  0 instance 0691da40 _localQueue
791087cc  4001209        8 ...Collections.Queue  0 instance 0691daf4 _externQueue
79102290  400120a       20         System.Int32  1 instance        0 _count
791186fc  400120b        c ...ding.WaitCallback  0 instance 0691dba8 _workItemCallback
79102290  400120c       24         System.Int32  1 instance        0 _workItemCount
7910be50  400120d       29       System.Boolean  1 instance        0 _draining
7911228c  400120e       34      System.TimeSpan  1 instance 0691da34 _timerPeriod
791127fc  400120f       10 ...m.Threading.Timer  0 instance 0691dbe8 _timer

I was trying to find a convenient way to get the remaining three values (autoConfig, maxConnection and Number of timers) when I found this post from Tom, and now my quest is over: !DumpThreadConfig is the same command we have in the internal Windbg extension I mentioned and also the output is the same… so apparently you just have to be patient and wait for the next Debugging Tools release ?

Carlo

Quote of the day:
There is nothing new under the sun but there are lots of old things we don’t know. – Ambrose Bierce

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.