Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-11-2011, 03:37 PM   PM User | #1
tomharto
Regular Coder

 
Join Date: Jul 2010
Location: Sheffield
Posts: 795
Thanks: 91
Thanked 18 Times in 18 Posts
tomharto is on a distinguished road
IS it My shoutbox refreshes and requeries every 25 seconds, is this a bad idea?

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?

Last edited by tomharto; 08-11-2011 at 03:41 PM..
tomharto is offline   Reply With Quote
Old 08-11-2011, 04:50 PM   PM User | #2
guelphdad
Super Moderator


 
guelphdad's Avatar
 
Join Date: Mar 2006
Location: St. Catharines, Ontario Canada
Posts: 2,629
Thanks: 4
Thanked 147 Times in 138 Posts
guelphdad will become famous soon enoughguelphdad will become famous soon enough
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.
guelphdad is offline   Reply With Quote
Old 08-11-2011, 05:43 PM   PM User | #3
tomharto
Regular Coder

 
Join Date: Jul 2010
Location: Sheffield
Posts: 795
Thanks: 91
Thanked 18 Times in 18 Posts
tomharto is on a distinguished road
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?
tomharto is offline   Reply With Quote
Old 08-11-2011, 08:02 PM   PM User | #4
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,237
Thanks: 59
Thanked 3,998 Times in 3,967 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
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.
Old Pedant is offline   Reply With Quote
Old 08-11-2011, 08:04 PM   PM User | #5
tomharto
Regular Coder

 
Join Date: Jul 2010
Location: Sheffield
Posts: 795
Thanks: 91
Thanked 18 Times in 18 Posts
tomharto is on a distinguished road
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.
tomharto is offline   Reply With Quote
Old 08-11-2011, 08:13 PM   PM User | #6
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,237
Thanks: 59
Thanked 3,998 Times in 3,967 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
MySQL won't even notice that.
Old Pedant is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:37 AM.


Advertisement
Log in to turn off these ads.