View Full Version : IS it My shoutbox refreshes and requeries every 25 seconds, is this a bad idea?

08-11-2011, 04:37 PM
EDIT: Oops, ignore the mistake in the title :P

Ive made a shoutbox using MySql and PHP what refreshes every 25 seconds so if anyone else posts it is shown without having to refresh the page, is this putting a lot of strain on my database or anything? The query itself searches one table containing 4 different fields (ID, name, shout, date).

Or is there a general better way to do this?

08-11-2011, 05:50 PM
look up AJAX if you aren't using it already. You should use it to refresh the shoutbox when it is posted to. it doesn't force a page refresh.

08-11-2011, 06:43 PM
Im using AJAX to refresh it, by You should use it to refresh the shoutbox when it is posted to do you mean when the user posts to it or when anyone posts to it?

Old Pedant
08-11-2011, 09:02 PM
How many simulataneous users do you have?

I would think you need hundreds or more before 25 seconds would be a strain. If you'd said 2.5 seconds...

More likely this is a strain on the web server than on MySQL, by the by. But 25 seconds? Can't see how it would be in either case.

08-11-2011, 09:04 PM
Okay, ive never really looked into anything like this before so i just wanted some rough idea, if we get to hundreds of users ill look into a better way of doing it but i imagine wed have roughly 30-40 and not all online at once.

Old Pedant
08-11-2011, 09:13 PM
MySQL won't even notice that.