Forum Moderators: coopster

Message Too Old, No Replies

Continously running script

Continously running script

         

drooh

10:32 pm on Sep 9, 2008 (gmt 0)

10+ Year Member



Ive got a radio station broadcasting over the internet. Im using a script to check and see how many listeners there are at a given time. Im then using php to create a graph so i can see listeners over a period of time.

my question is, in order for this script to work, it must be in a loop, say every 15 or 30 seconds. what is the best method for this, javascript?, it seems a cron executing every 15 sec would not be ideal

eelixduppy

10:52 pm on Sep 9, 2008 (gmt 0)



You can use AJAX and query the server for the number of users at a regular interval. You might be able to limit the number of calls to the script if you just run a cron that collects the data and posts it to a file by itself, and then your other pages read from that file instead of invoking the script each time separately. Should save you on system resources.

drooh

11:28 pm on Sep 9, 2008 (gmt 0)

10+ Year Member



ok, thats kind of what i have going on now, its simply writing to a text file.

but, is it ok to have ajax running in a loop like that to were it hits that script every 15 sec forever?

how much is too often to run a cron, from what little i know most dont use them more often then a few times per hour, at most every min...whats the rule?

g1smd

3:02 am on Sep 13, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



No rule, other than the load not impacting the ability of the server to do all of the other stuff that it needs to do.