View Single Post
Wayne 962 Wayne 962 is online now
Author of "101 Projects"
 
Wayne 962's Avatar
I think I found the problem (500 - Error)

So, here's the deal. The software used to run the forums (MySQL) is open-source, but inherently defective in that some queries take forever to process and then the same query (to the database) will process in a few seconds only a few minutes later. I'm not sure what causes this. I have been trying to solve this problem for years now. I've been on all of the bulletin boards, and numerous other people with very large forums often have the same problem. It's caused by the search engine reading too much from the database or something like that.

So, I wrote a program that constantly monitors rogue database inquiries and kills them off (these lock the whole site up for a period of time) after 60 seconds. Trouble is, there was also another setting that set the maximum execution time for scripts to be 30 seconds. So, if everyone else was waiting, and then I killed off that rogue process, everyone else would then get killed too (and get that 500: Error). So, I changed that variable, and that should fix most of the problems with that error for now. I figured it out tonight when I happened to have two forums pages open at the same time in two separate windows, and both gave 500:Internal Server Errors, which in my opinion was impossible. That led me to investigate further and figure out that the processes were timing out - not getting killed erroneously by my watchdog program.

I also believe that the slowdown is caused by disk access - the server itself runs at about 5-10% CPU utlization all of the time - certainly not taxing. Network bandwidth is also not a problem. The only other metric is IO speed. So, I have now set the database to defragment itself every night on the most used files. Each time I have done this, the slowdown problem has gone away temporarily until the files get defragmented, and then the intermittant slowdown comes back.

Conclusion, with these two changes, I think we'll see a remarkable improvement. Less slowdowns, and we should have almost no 500: Internal Server errors now. Sorry if this also doesn't make any sense to the non-computer people...

thx,

Wayne
Old 05-25-2008, 11:36 PM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #1 (permalink)