Error 500.13 (Server too busy) 解决方案

Error 500.13 (Server too busy) with many sites on one machine

There are 4 main reasons in IIS 6 why the Server Too Busy error will be displayed
in response to an ASP request:

1) The application pool’s ASP queue is full (or in other words, the metabase value
ASPRequestQueueMax has been reached)

2) A new App Pool cannot be spawned due to OS process limits (or in other words, we
have reached the maximum number of concurrently running application pools.

3) An ASP request has been in the ASP queue longer than the value set for the
metabase key ASPQueueTimeout

4) We have run out of desktop heap.

I would take a Hang dump using DebugDiag tool and see what is happening and why the requests are taking long time to execute. Normally this would turn out to be code issue.

Important : Are you running these sites in Seperate app pools or 1 single app pool? If they are in single pool, then try seperating them in different app pool.

Another thing is system resources, are you running many products like SQL/Exchange on the same box as IIS and also are they any third party apps, many processes running on this box? If there are many processes running it might cause desktop heap issue. you could use Dheapmonitor and see if there is enough desktop heap available to spwan a new process.

***********************************************************

I wanted to post the solution to this problem as it cost me a $300 call to MS tech support to find the answer. The fix is very simple and is applicable to MANY other situations on nearly every recent windows OS. Basically I was running out of non-interactive desktop heap even though I had a vast surplus of memory. The reason for this is that every single version of windows is CRIPPLED by default with very restrictive heap limits which make absolutely no sense even for hardware from 5 or 10 years ago. There are 2 things you can do to fix this. First, you can increase the maximum total heap size using the following steps:

1.  Start Registry Editor.

2.  Locate and then click the following registry subkey:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management

3.  Configure the following entries:

  1. Name: SessionViewSize
  2. Data Type: REG_DWORD
  3. Value data: 120 (decimal)

4.  Configure the following entries:

  1. Name: SessionPoolSize
  2. Data Type: REG_DWORD
  3. Value data: 60 (decimal)

That alone will not fix the problem because now you need to increase the limits on the specific sections of the desktop heap, namely the Interactive and Non-Interactive parts:

1.  Start Registry Editor.

2.  Locate and then click the following registry subkey:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Subsytems

3.  Find the value in this key called Windows, it will be a long string of name-value pairs that looks something like this:

  1. %SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,3072,512 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=winsrv:ConServerDllInitialization,2 ProfileControl=Off MaxRequestThreads=16

The portion of this section that we’re interested in is the “SharedSection=1024,3072,512” part. Those 3 numbers define, in kb, the size of various specific heap limits in this order: global, interactive, non-interactive. You most likely will not ever need to mess with the first one (global).

The third (non-interactive) value is the one that enabled me to host hundreds/thousands of sites on a single server without getting the 500.13 errors. If you’re running more than about 60-80 IIS websites and getting those 500.13’s like I was, you need to increase this number. I increased it to 8192 on my server (an 8-core dual xeon with 8 GB RAM) and am now able to run more websites on that one machine than I was able to run on 6 separate windows servers without the adjustment. Needless to say this clever limitation is making MS a lot of $$$ and I am living proof. I bought 6 copies of server 2k3 x64 when I could have done it with 1! In light of this and hardware costs the $300 it cost me to find out was well worth it.

The second (interactive) value can be increased to allow you to scale your usage of interactive desktop heap, or in other words you can now run way more windows desktop apps simultaneously. I found this to be of particular value on a windows xp machine that I was trying to run many (100+) copies of the same app. After a certain points the instances would become unstable and could not spawn any more processes. I increased the middle value and the limit was lifted.

After adjusting these numbers reboot your machine and do performance tests to verify that you are now able to run everything without problems. Increasing the individual numbers too much can make you use up too much memory and eventually hit that total heap maximum we adjusted in the first part (which is why we increased it to help prevent this from happening.) I suggest increasing in 2 MB increments until you hit a point where you are no longer hitting those limits, but don’t push it much further than you need to. As I mentioned before, I’m having no problems with my numbers set to 1024,10240,8192 and can run over 600 websites (and probably thousands more) without a hitch.

I find it hard to believe that I’ve never run across anything on the web that really talks about the significance of these numbers and what a massive artificially-imposed limitation they are on the windows platform. There are a couple of reference pages here and there which talk about adjusting the heap but they carefully avoid talking in detail about the real-world implications. Also I did see in at least one or two places people posting on forums who had the exact same problem/scenario as me but they never got the answer they needed and NOWHERE on the web have I ever been able to find a link between the 500.13 problem (which plagues even 2k8 servers) and the desktop heap adjustments fix to it. Also I haven’t found any page at all which really explains,  in a way that most people would find useful, how to go about tweaking these numbers to your particular situation.

To most home users this is probably no big deal but for we business users who are trying to maximize our performance and fully take advantage of new hardware (especially those doing windows web hosting), this heap issue is massively important. Personally I think MS should have refunded my $300 on grounds that is a (mostly) undocumented bug but I’m sure they have a different “perspective” on the whole issue and I didn’t bother trying to argue it. At best I can hope to prevent them from making some more money off other poor suckers who are trying to find the answer to the same problem.

I should also mention that the MS techs were not especially forthcoming about WHY I was having this problem and what these various tweaks were doing. It was as if they wanted to solve my problem just enough to make me go away without actually letting me understand what was going on. The only reason I know as much as I do is because I badgered them relentlessly for the missing info, the why’s and how’s. This after I paid them $300 for the support call. And it took them nearly 2 weeks to finally get to a resolution. They did not seem to want to encourage me to explore the upper limits of these numbers and they did not really seem to want to explain the rationale behind how to tweak them. I had to drag it out of them.

Also I should note that this specific problem will most likely not affect you if you are running IIS in purely x64 mode. I am running classic ASP apps which make use of 32-bit DLLs like ASPUpload so my IIS has to be set to run in a 32 bit compatible mode.

I hope this helps at least one person out there because I spent literally years trying to find a solution, and $10,000’s trying to work around not having a solution. (Buying and hosting lots of servers and windows licenses.)

As a cross-platform dev who has always been the devils advocate for MS, I am now thoroughly disgusted and alienated by this company and although I’ll continue to develop and support my existing applications I am done doing any new development on this platform.

发表评论