问题
According to this documentation in MSDN for ProcessModel, the autoConfig=true sets the following attributes in accordance with this KB article:
maxWorkerThreads, maxIoThreads, minFreeThreads, minLocalRequestFreeThreads, maxConnection
To verify this setting, I have a sample web application in ASP .NET 3.5 having the following code in the page_load event:
int w, c;
ThreadPool.GetMinThreads(out w, out c);
// Write the numbers of minimum threads
Response.Write("Min: " + string.Format("{0}, {1}", w, c));
w=0;
c = 0;
ThreadPool.GetMaxThreads(out w, out c);
Response.Write(" Max: " + string.Format("{0}, {1}", w, c));
Response.Write(" Maxconnections: " + ServicePointManager.DefaultConnectionLimit);
Configuration conf = ConfigurationManager.OpenMachineConfiguration();
ConfigurationSectionGroup secGrp = conf.SectionGroups["system.web"];
ConfigurationSection sec = secGrp.Sections["httpRuntime"];
Response.Write(" httpruntime settings: " + sec.ElementInformation.Properties["minFreeThreads"].Value + ", " +
sec.ElementInformation.Properties["minLocalRequestFreeThreads"].Value);
Response.Flush();
I get the following output when I run the page with autoConfig set to false first and then set to true:
autoConfig=false: Min: 2, 2 Max: 40, 40 Maxconnections: 10 httpruntime settings: 8, 4
autoConfig=true: Min: 2, 2 Max: 200, 200 Maxconnections: 24 httpruntime settings: 8, 4
autoConfig=false works as expected and the default values can be seen in the output, however the output when set to true suprised me a bit:
- It does set the maxWorkerThreads and maxIoThreads attributes correctly and hence the output of 200 (100x2 on a dual core CPU).
- However, it doesn't seem to set the minWorkerThreads attribute which as per the KB should be: minWorkerThreads = maxWorkerThreads/2
- Also, according to the MSDN documentation setting autoConfig=true does set the minFreeThreads and minLocalRequestFreeThreads attribute to values recommended in the KB, but that doesn't seem to be the case either. I get the default values of 8 and 4.
I am a bit confused, any ideas as to what's happening here? Have i got the sample wrong or something?
回答1:
My guess is you are dealing with the same kind of logic below:
WCF 4: Higher Default Throttling Settings for WCF Services
In WCF 4, we have revised the default values of these settings so that people don’t have to change the defaults in most cases. Here are the main changes:
· MaxConcurrentSessions: default is 100 * ProcessorCount
· MaxConcurrentCalls: default is 16 * ProcessorCount
· MaxConcurrentInstances: default is the total of the above two, which follows the same pattern as before.
来源:https://stackoverflow.com/questions/4310719/asp-net-processmodel-configuration