SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member sujititc's Avatar
    Join Date
    Mar 2009
    Location
    Nepal
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MySql Database Overloaded

    I want to retrieving every second information from the MySql database and it must be automatic.
    For this, I have used Ajax/jQery and setTimeout is in 1000 to call php page. In this way what I want it is working but when user will be increasing then the myslq server is hang time to time...

    Please help me how I can handle such issue?

    Can you help me how this type of issue will be handle in facebook.com, swoopo.co.uk?
    Regards,
    Sujit Shah
    PHP Programmer & Freelancer
    http://www.sks.com.np

  2. #2
    SitePoint Guru
    Join Date
    Jan 2005
    Location
    heaven
    Posts
    953
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sujititc View Post
    I want to retrieving every second information from the MySql database and it must be automatic.
    For this, I have used Ajax/jQery and setTimeout is in 1000 to call php page. In this way what I want it is working but when user will be increasing then the myslq server is hang time to time...

    Please help me how I can handle such issue?

    Can you help me how this type of issue will be handle in facebook.com, swoopo.co.uk?
    Every second? why ever second? That's seems horribly inefficient. It is probably taking longer than a second to retrieve data and parse it. So you end up with overlapping requests. You might want to increase the time out.

    Aside from that you'll want to make sure your database is properly indexed and caching query results for data that doesn't change often. If you absolutely must
    Creativity knows no other restraint than the
    confines of a small mind.
    - Me
    Geekly Humor
    Oh baby! Check out the design patterns on that framework!

  3. #3
    SitePoint Member sujititc's Avatar
    Join Date
    Mar 2009
    Location
    Nepal
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually user may be post is every second but not sure so I had call in every second.
    Regards,
    Sujit Shah
    PHP Programmer & Freelancer
    http://www.sks.com.np

  4. #4
    SitePoint Guru
    Join Date
    Jan 2005
    Location
    heaven
    Posts
    953
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sujititc View Post
    Actually user may be post is every second but not sure so I had call in every second.
    It doesn't matter if a user posts ever second or not. You do not want over lapping requests. If you haven't finished parsing and updating the data on the page, there is no need to send another request to retrieve data.
    Creativity knows no other restraint than the
    confines of a small mind.
    - Me
    Geekly Humor
    Oh baby! Check out the design patterns on that framework!

  5. #5
    SitePoint Guru
    Join Date
    Jun 2006
    Posts
    638
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's 1 second per user... so if you have 100 people on, that's 100 requests per second, so 0.01 sec max time allowed to generate your page.

    If your server slows down a bit and takes long (usually does...), you app will crash and burn.

    If you want "to the second" updates, use sockets not http requests.

  6. #6
    SitePoint Member
    Join Date
    Oct 2008
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also, I would look into optimizing with INSERT DELAYED.

    http://dev.mysql.com/doc/mysql/en/insert-delayed.html
    Need high quality, fast, and secure coding?


Bookmarks

Posting Permissions

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