View Single Post
Old 12-22-2005, 12:21 AM  
phpslave
Confirmed User
 
Join Date: Jan 2003
Location: San Jose
Posts: 548
!!! Just a thought !!!

Maybe you should cache the results locally get the time before you enter a loop, (while loop or whatever doesn't matter) loop in it making your read requests, if you don't make the read in x amount of seconds, (1 sec would be a max time for me) read the cached local content.

It is very hard on your server to hang up apache on these long processes, I'd only read remotely if i had to. If it is a news feed or something you can get away normally with only having to read this in once or twice a day. The rest of the time reading from the local cached file you created.

In addition if you are pharsing the information you are reading in. Cache it in the form of already being pharse as pharsing is an expensive process as well.

If this site gets any type of traffic, a code written in such a way to keep trying if even for only 3 - 5 seconds could bring the server to its knees. So you need to think of other ways to achive your end result. With apache you only have so many processes you can use, generally around 250 apache processes on a server. After this, or close to this number you'll stop serving pages, aka loose your ass on your money. Long connection times can really cause this number to go much higher than needed and even spiral out of control, in general it's a really bad idea.

As mentioned by others if it keeps trying and you have no memory limit set and no script execution time set, the script could (and in my opinion at some time will) crash your server.

In addition about 'sleeping' in your php scripts this produces the above results, which are very harmful to your server. There is no reason to sleep in your php.


I don't know what problem you have, but you need to take a different look at it as what i see written here will not scale at all, and will greatly harm your server.
__________________

phpslave is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote