PDA

View Full Version : Universal Countdown - Servers ability to handle significant simultaneous loads?



mg777
11-04-2007, 04:53 AM
Re Script:
http://www.dynamicdrive.com/dynamicindex6/universalcountdown.htm

Question:
Hi

I have managed to get the universal countdown script to work.
My main concern is how this script will impact server resources in the event that many (thousands) of simultaneous users access the site, considering that the time is updated fom the server every second as per below code:

setTimeout(function(){thisobj.updateTime()}, 1000) //update time every second

Will the server resources be incrementally used up with each additional simultaneous user who access the web page with this countdown timer, and eventually lead to a server crash if too many users access? Or is the amount of users a non-issue?

Any feedback is much appreciated.

Thanks
MG

jscheuer1
11-04-2007, 05:54 AM
Nope.

The server is only accessed once per page load for the time. After that, it is the user's CPU that does all the math and all the display changes.

mg777
11-04-2007, 07:51 AM
Thanks

That begs the question: if the user has a slow cpu or if the cpu is being used by other large programs - is it possible that over a period of time the countdown accuracy may be affected?

Ie. Shouldn't I use this countdown if I want to be guaranteed that all users have exactly the same countdown time?

jscheuer1
11-04-2007, 08:14 AM
They would have to have a pretty crappy CPU and/or it would have to be really overloaded, but things could get out of whack. However, this wouldn't effect subsequent visits to the page. Generally, if things got so bad on the local machine that it couldn't keep up with updating a whole number value once every second, the user would have much worse things to worry about than if they were keeping proper track of the countdown or not. In all likelihood, they would need to close some programs at the very least, perhaps reboot. If closing programs took care of the problem, the countdown would probably catch up, or be off by a few seconds, but only until they either refreshed or revisited the page.

How crucial is the matter of timing here? Must everyone jump in the air at the same moment to see if that alters the earth's trajectory? If this is some mission critical event, you would need to get everyone an absolutely accurate clock and synchronize them. Even then, you couldn't account for possible lack of dedication on a given individual's end, how that might affect the timing.

ddadmin
11-04-2007, 10:10 AM
Regarding the server potentially being bogged down, like John said, since this is a client side script, all the processing is done in the client's computer for each individual browsing that page. If he/she has a really slow computer, usually what happens is that the script will start to skip in between seconds, so you might see something like "3:08, 3:11, 3:15 etc". The time itself may still be accurate for each update, but the script is no longer updated every second. Each browser behaves slightly different though, so don't time your rocket launch to it like John says.