Professional Web Applications Themes

mysql_pconnect() Do persistent connections ever die? - PHP Development

Folks, I currently connect to my db with PHP code that uses non-persistent connections. I've read that persistent connections can help performance since a connection to the db will use an existing unused connection. If my system was to go through a busy period whereby I seen an extra 50% or more activity for ten minutes or so, would the extra connections stay alive for ever or is there a time limit of inactivity? Would the unused connections just sleep if they don't die? Is there any negative effect of having these connections waiting around? Thanks - all help via ...

  1. #1

    Default mysql_pconnect() Do persistent connections ever die?


    Folks,
    I currently connect to my db with PHP code that uses non-persistent
    connections. I've read that persistent connections can help performance
    since a connection to the db will use an existing unused connection.

    If my system was to go through a busy period whereby I seen an extra 50% or
    more activity for ten minutes or so, would the extra connections stay alive
    for ever or is there a time limit of inactivity?

    Would the unused connections just sleep if they don't die? Is there any
    negative effect of having these connections waiting around?

    Thanks - all help via the ng would be much appreciated...

    --
    A: Because it messes up the order in which people normally read text.
    Q: Why is top-posting such a bad thing?
    A: Top-posting.
    Q: What is the most annoying thing on usenet?


    Randell D. Guest

  2. #2

    Default Re: mysql_pconnect() Do persistent connections ever die?

    It all depends on the database you are connecting to and its configuration.
    Many databases will kill inactive threads after a defined unit of time. You
    can also configure the max number of connections on many databases as well.

    The negative effect of unused connections is wasted resources (memory).
    There is a threshold where too many connections can cause problems. It all
    depends on your database, OS, and hardware.

    Tuning your database and good database design can go a long way in enhancing
    performance of your PHP application.

    /dkm



    "Randell D." <you.can.email.me.at.randelld> wrote in message
    news:qakhb.54953$9l5.45409pd7tw2no...
    >
    > Folks,
    > I currently connect to my db with PHP code that uses non-persistent
    > connections. I've read that persistent connections can help performance
    > since a connection to the db will use an existing unused connection.
    >
    > If my system was to go through a busy period whereby I seen an extra 50%
    or
    > more activity for ten minutes or so, would the extra connections stay
    alive
    > for ever or is there a time limit of inactivity?
    >
    > Would the unused connections just sleep if they don't die? Is there any
    > negative effect of having these connections waiting around?
    >
    > Thanks - all help via the ng would be much appreciated...
    >
    > --
    > A: Because it messes up the order in which people normally read text.
    > Q: Why is top-posting such a bad thing?
    > A: Top-posting.
    > Q: What is the most annoying thing on usenet?
    >
    >

    RavenMaster Guest

  3. #3

    Default Re: mysql_pconnect() Do persistent connections ever die?

    "Randell D." <you.can.email.me.at.randelld> wrote in
    news:qakhb.54953$9l5.45409pd7tw2no:
    > I currently connect to my db with PHP code that uses non-persistent
    > connections. I've read that persistent connections can help
    > performance since a connection to the db will use an existing unused
    > connection.
    Can I point you to the PHP manual page on Persistent Connections?

    [url]http://ca3.php.net/manual/en/features.persistent-connections.php[/url]

    This is a pretty good article covering the ups and downs of persistent
    connections, and things to look out for. They've written it all out for me
    so no need to say it here :)

    --
    Richard

    Richard Podsada Guest

  4. #4

    Default Re: mysql_pconnect() Do persistent connections ever die?

    On Fri, 10 Oct 2003 03:06:00 GMT, Richard Podsada
    <jslwebsuperduperspamdiedietelusplanet.net> wrote:
    >"Randell D." <you.can.email.me.at.randelld> wrote in
    >news:qakhb.54953$9l5.45409pd7tw2no:
    >
    >> I currently connect to my db with PHP code that uses non-persistent
    >> connections. I've read that persistent connections can help
    >> performance since a connection to the db will use an existing unused
    >> connection.
    >
    >Can I point you to the PHP manual page on Persistent Connections?
    >
    >[url]http://ca3.php.net/manual/en/features.persistent-connections.php[/url]
    >
    >This is a pretty good article covering the ups and downs of persistent
    >connections, and things to look out for. They've written it all out for me
    >so no need to say it here :)
    Unfortunately it says nothing about timeouts; dropping connections that have
    been unused for a configurable amount of time would seem to be a useful
    optimisation for PHP persistent connections, but there doesn't appear be a
    PHP-side facility for this.

    --
    Andy Hassall (andyandyh.co.uk) icq(5747695) ([url]http://www.andyh.co.uk[/url])
    Space: disk usage ysis tool ([url]http://www.andyhsoftware.co.uk/space[/url])
    Andy Hassall Guest

Similar Threads

  1. MSSQL persistent connections and PHP
    By Chung Leong in forum PHP Development
    Replies: 0
    Last Post: December 8th, 01:05 AM
  2. [PHP] Persistent database connections in PHP
    By Cesar Aracena in forum PHP Development
    Replies: 4
    Last Post: September 5th, 10:04 AM
  3. Persistent database connections in PHP
    By David Brannlund in forum PHP Development
    Replies: 0
    Last Post: September 5th, 06:05 AM
  4. Replies: 2
    Last Post: August 19th, 08:09 PM
  5. shouldn't mysql_pconnect force reuse of mysql connections?
    By Jeremy Zawodny in forum PHP Development
    Replies: 0
    Last Post: August 19th, 06:14 PM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139