Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Jul 2010
    Location
    Sheffield
    Posts
    827
    Thanks
    93
    Thanked 18 Times in 18 Posts

    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 04:41 PM.

  • #2
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,634
    Thanks
    4
    Thanked 148 Times in 139 Posts
    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.

  • #3
    Regular Coder
    Join Date
    Jul 2010
    Location
    Sheffield
    Posts
    827
    Thanks
    93
    Thanked 18 Times in 18 Posts
    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?

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,596
    Thanks
    80
    Thanked 4,631 Times in 4,594 Posts
    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.

  • #5
    Regular Coder
    Join Date
    Jul 2010
    Location
    Sheffield
    Posts
    827
    Thanks
    93
    Thanked 18 Times in 18 Posts
    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.

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,596
    Thanks
    80
    Thanked 4,631 Times in 4,594 Posts
    MySQL won't even notice that.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •