503 Service Unavailable Woes and Notifications

Discussion in 'General troubleshooting' started by Ben Amada, May 13, 2009.

  1. Just last night I setup my second hosting account at DASP. Shortly after uploading my files and browsing the website a bit, my site was apparently down and I was getting a 503 Service Unavailable message. Support told me my site was using 70% or more of the CPU for over 5 minutes.

    My site is on IIS7 and it's an ASP.NET website. There's 3 pages, 2 of which are basically static and the third is a Contact form that just sends me an email and saves a copy of that email in a folder (in case of an email problem). It has to be one of the simplest sites I've developed. On my local machine, I can't get the w3wp.exe process for this site's app pool over 1% CPU usage. Getting it over 0% is rare.

    After support put my site back up, this morning, it was down again -- 503 Service Unavailable. It appeared to be taken down about 10 - 15 minutes after I tested the contact form last night. I've been testing it since then, and the site's still up. Support suggested I turn on the raw stats logging feature, which I did. I guess I'll see those stats tonight.

    Has anyone else ever had these types of unexpected/unexplained 503 Service Unavailable problems? Hopefully I can get to the bottom of this.

    On a related note, it's a little frustrating that DASP doesn't email me to let me know the site has gone down. Having had a dedicated server in the past where I needed to monitor the site somewhat extensively, one thing I've always enjoyed with shared hosting is the peace of mind that if something on the server fails (e.g. hardware, software), because it will affect so many people and because support is monitoring the shared servers closely, I know support is going to get the server fixed asap. Yet, with these problems I'm having now, support doesn't e-mail me! It's quite ironic and disappointing to have your site on a shared server that is monitored by a hosting company and expect someone is watching over your site, but yet has a system to turn off your site when problems like CPU/memory arise, and not even notify you! :mad:

    Does anyone use any type of monitoring service to make sure their sites are up? I have a .NET program that does something similar to monitoring a site and sends me email notifications. I can make a simple adjustment to it to check for 503 HTTP responses. I'd be interested in hearing what others may be doing.

    Thx ... Ben
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    I understand the frustration but this is a built in IIS feature (with IIS7) that disable the application pool and we do not even know this happened unless we actively check the server. I am sure you understand that it is rather impossible for us to check every single site that we host and notify customer when this happens.

    In general, if your site is using this much CPU time, there's something very wrong w/ the code itself. You should be able to replicate this easily in your dev environment by monitoring the CPU usage of the w3wp process. I also recommend you cross reference the HTTP log to see which page hit causes this high CPU usage.

    Here's a free site monitoring service that you can check out.

    http://www.siteuptime.com/
     
  3. Hi Bruce,

    There's actually an event that gets recorded in the event viewer when the site gets shut down. Support forwarded me a copy of the details from event viewer. Here's a description of the event:

    http://technet.microsoft.com/en-us/library/cc735237(WS.10).aspx

    There's a pretty good handful of applications out there that monitor the event log for events and send notifications.

    http://www.google.com/search?q=monitor+event+viewer+notification

    So although it's not feasible for a person to manually check every site, I see no reason this event couldn't be monitored for and and a notification sent. Considering the high level of tools and integration DASP has already built into the control panel, adding this type of functionality seems rather trivial.

    Thanks for the link to siteuptime.com. I'm either going to sign up for that, or use this little .NET console application I have to notify me when my site isn't up.

    I understand you would think there's something very wrong with the code. I would think the same thing too :) I was monitoring the w3wp.exe process on my computer. I have the site setup in a separate app pool. I'll do some more testing to see if I can reproduce the problem.

    It would be nice to know in the control panel or somewhere, what type of CPU / memory usage my app is consuming at DASP. For instance, other than the two times the CPU usage went very high and the site was taken down, is the CPU / memory normally high and just barely underneath the threshold of being taken down again. Or is it normally on the low end and only these 2 times did something go haywire. For diagonosing this type of problem, this type of information would really be helpful.

    Thanks again ...

    Ben
     
  4. Good news. I was able to consistently reproduce the high CPU problem on my computer, and fix the problem. The problem didn't appear to occur when debugging through Visual Studio (even when going through IIS7) -- it only was happening outside of VS.

    This probably won't help many people, but I'm using the System.Net mail classes in ASP.NET. At a different host, I had sporadic connection errors to the mail server ... .NET wasn't disconnecting from the mail server causing errors when sending another email 30 or so seconds later. I could reproduce the problem over and over. At the time, I added this code

    sc.ServicePoint.MaxIdleTime = 1;
    sc.ServicePoint.ConnectionLimit = 1;

    ... where "sc" is an instance of the SmtpClient class. This would ensure SmtpClient would disconnect from the mail server asap. The errors stopped after using that code. It was on an IIS6 server. This was the only suspect code in my mail sending page. After removing those 2 lines of code on my computer tonight (Vista/IIS7), no more high CPU.
     
  5. mjp

    mjp

    Those tools are under consideration, but it is not a trivial matter to implement them for tens of thousands of sites across hundreds of servers, as you might suspect.

    But we are aware of their potential value, and it is something that we are pursuing. As to when it might happen, I can't give you any time frame, as it is not currently in the active development pipeline. Eventually it is something we would like to offer though.
     
  6. Bruce

    Bruce DiscountASP.NET Staff

    Glad you resolved the issue.

    We've considered monitoring the Event log but decided against it because the event log is SOOO... huge (our system event logs generate several hundred thousand rows every day). If we do that, most of the server resource (largely I/O) will be devoted to parsing the event log rather than serving website.
     
  7. Bruce,

    If you've ever run a program like RegMon, FileMon or ProcMon (from SysInternals), you would see the unbelievable high volume of constant access to the registry and files -- even on a basic workstation. So it would be naive for anyone to think 100% or even 85% or 80% of the background process activity going on within a web server is purely for serving websites.

    A good, lightweight event log notification program wouldn't waste its time scanning through all the logs -- but instead attach itself as a listener to quickly determine if each new event logged is of interest to the program. The listener would take no action for over 99% of the events logged. A good event log listening program either by a 3rd party or one written in-house by DASP would have a negligible performance impact on the server and would be very valuable in letting customers know their site has just been taken down and is no longer up.

    Just some thoughts ... thanks.
     
  8. Bruce

    Bruce DiscountASP.NET Staff

    thanks for your suggestion.
     
  9. Ohh had I stumbled upon this post earlier...

    I had the same 100% CPU / 503 issue for exactly the same reason (SmtpClient class and the above two "fix" lines of code). I only found this out after dumping DiscountASP.NET and moving to a VPS solution with another host - there, after five minutes running final tests, I hit upon our mail notification code and side I had a remote control and process manager going, the 100% CPU issue was immediately visible and eventually traceable.

    DiscountASP.NET you've lost my business due to this incident. I'm not sure what you could have done better since your support was always instantaneous, but since I was not getting the http.sys log or other feedback I needed to pin this one down, I simply couldn't fix it. And now that I'm on the VPS I'm confident I can track down anything else that comes up far easier, so I think it's worth the extra cash.

    Shared hosting for real business apps in the IIS world just simply doesn't seem to work. It's too bad I had to experiment to find that solution and I hope others just go straight for VPS, bite the bullet, and manage the server themselves.

    Or am I missing something?
     
  10. Bruce

    Bruce DiscountASP.NET Staff

    Well.. having console access always gives you more control.

    The flip side is that you have to know what you are doing. We made a lot of performance enhancing changes on the server that most end users would not have the experience to do.

    If you are comfortable with maintaining a server, VPS/dedicated may work well for you, but most of our clients want us to handle all the headaches behind managing a server.

    Good luck.
     
  11. 503 Service Unavailable

    It would certainly be useful to know if it was CPU or memory that has caused my site to start doing this. I am not using the ms smtp class (and only send a couple of mails a day). I only started getting this issue about 4 weeks ago. I have never had it before (over many years). :(
     
  12. I don't know, "More Control" isn't a good reason to be on call 24-7/365. Maybe that's just me.
     

Share This Page