Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Posts
    2

    Unanswered: Persistent Connections

    Hello,
    A script opens a connection to my sql database every time that a user requests that specific script. The problem I am having is, after a while, this error message appears:
    User 'site_game' has exceeded the 'max_questions' resource
    (current value: 10000).
    I have read a little about persistent connections within PHP, but don't really understand how I would be able to get the number of connections to the SQL database down from the current number. Any help would be appreciated!!
    Steven Michaels

  2. #2
    Join Date
    Oct 2003
    Location
    Slovakia
    Posts
    482

    Re: Persistent Connections

    Originally posted by smichae
    Hello,
    A script opens a connection to my sql database every time that a user requests that specific script. The problem I am having is, after a while, this error message appears:
    User 'site_game' has exceeded the 'max_questions' resource
    (current value: 10000).
    I have read a little about persistent connections within PHP, but don't really understand how I would be able to get the number of connections to the SQL database down from the current number. Any help would be appreciated!!
    Steven Michaels
    Basicaly persistent connections using just one physical (shared) connection to the SQL server.

    You may to do following:
    Create one persistent connection. You will be connecting by standard way, one user - one connection. If max connections will be exceeded (catch the errror) then you simply use the persistent connection opened before.

  3. #3
    Join Date
    Oct 2003
    Posts
    706

    Lightbulb

    Google said:
    Sounds like their host allows a certain number of queries per day/month/week/etc and they've gone over the limit ...
    Correct. The problem is the host doesn't know how to change it!


    This is a fairly new feature, available since MySQL 4.0.2.
    Your host can change it by running a GRANT query (note that these limits can be granted only via a global GRANT, that is, a GRANT ON *.*):

    GRANT USAGE
    ON *.*
    TO user IDENTIFIED BY 'password'
    WITH MAX_QUERIES_PER_HOUR N1
    MAX_UPDATES_PER_HOUR N2
    MAX_CONNECTIONS_PER_HOUR N3; ("0" is "no limit")
    In this circumstance I expect that the real cause of the problem is that the application in question is stuck in an endless loop. This is the basic purpose of this feature: preventing a flood of queries from an application whose bug might otherwise never be diagnosed. It's quite reasonable that any application which manages to put out 10,000 queries an hour, and whose user/owner is surprised by a limit-message to that effect, is probably misbehaving. (Or seriously mis-coded!)

    I would ask for assistance from the ISP in obtaining any sort of log that might be available to find out where the endless-loop bug is.

    Note: I do not know if a persistent connection affects the limit and therefore the appropriateness of that conclusion. Most likely a persistent connection would not reset the count. Maybe if this is the most popular and compute-intensive website God ever made, it would justifiably hit this kind of a limit. I dunno. But I'd suspect a programming error first.
    Last edited by sundialsvcs; 01-01-04 at 18:08.
    ChimneySweep(R): fast, automatic
    table repair at a click of the
    mouse! http://www.sundialservices.com

Posting Permissions

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