Jump to content

Archived

This topic is now archived and is closed to further replies.

dagnasty

500 error when too many visitors running script

Recommended Posts

I have a script that can take up to 10 seconds for certain queries. During busy times of the day when a lot of people are using it, the server shoots out 500 internal server errors even on pages unrelated to the script. I'm guessing it has something to do with too many concurrent connections or something related to cpu?

Apache server

Anyone have any ideas?

Much appreciated,
Brian

Share this post


Link to post
Share on other sites
YOu can always work on the performance of your script, do some optimization to it, post it here, maybe we can help you cut it down a couple of lines or something.  Either that or switch to a more powerful host, and hope they can handle the load, or a dedicated ip.

Share this post


Link to post
Share on other sites
One thing I've had amazing speed increasing results from sometimes is by creating some extra indexes on my db tables.  For instance, if you frequently use an sql statement with a clause like: "WHERE city='cityname'", and you have about 20 cities in your database, then adding an index to that field in that table can greatly speed up all queries that use that "WHERE" clause!  I once used that technique to speed up dozens of preexisting programs written by previous programmers - and did it all in one afternoon!  I didn't even have to touch any of the  preexisting code and they all ran faster.

-use this page to guide you on how to add an index to an existing table without destroying it
http://dev.mysql.com/doc/refman/5.0/en/alter-table.html
--just create a small php page to add the new indexes to the tables or use a mysql administration program to make the changes.  No changes will have to be made to any of your other pages for this to work and potentially greatly speed up your pages.  the new indexes will be automatically considered in the 'query optimization engine' of mysql.

Share this post


Link to post
Share on other sites
I appreciate the help and optimization tips but it's not related to MySQL at all, or any database for that matter. Since my host 1and1(I know, they suck) doesn't have error logs, I am only guessing as to what the problem is. Anyone have any idea?

Share this post


Link to post
Share on other sites
as you don't have any logs, i'd ask your host to try and find out what's going on, as 500 errors for me normally occur from misconfiguration of apache config file and/or htaccess files, and never as a result of too much traffic or database load.

Share this post


Link to post
Share on other sites
If it's not related to databases, then why do you use the word 'queries'?
[quote]I have a script that can take up to 10 seconds for certain queries[/quote]
if it is not accessing a database, what exactly is it doing that takes 10 seconds?

Share this post


Link to post
Share on other sites
Whoops. Sorry about that.

It's a [url=http://www.scrapetorrent.com]Torrent Search[/url] site that queries the major torrent indexing sites. With their permission, of course.

Share this post


Link to post
Share on other sites
I googled "500 internal server error cause php" and it seemed to have a lot of stuff you could try

Share this post


Link to post
Share on other sites
its apache configration setup on the host side tell your host.

the reason for goole to coume up with loads and loads of those errors becouse to meny hosts that can not set there servers up properly.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.