mysql_pconnect() Do persistent connections ever die?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Randell D.

    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?


  • RavenMaster

    #2
    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@ yahoo.com> wrote in message
    news:qakhb.5495 3$9l5.45409@pd7 tw2no...[color=blue]
    >
    > 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%[/color]
    or[color=blue]
    > more activity for ten minutes or so, would the extra connections stay[/color]
    alive[color=blue]
    > 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?
    >
    >[/color]


    Comment

    • Richard Podsada

      #3
      Re: mysql_pconnect( ) Do persistent connections ever die?

      "Randell D." <you.can.email. me.at.randelld@ yahoo.com> wrote in
      news:qakhb.5495 3$9l5.45409@pd7 tw2no:
      [color=blue]
      > 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.[/color]

      Can I point you to the PHP manual page on Persistent Connections?



      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

      Comment

      • Andy Hassall

        #4
        Re: mysql_pconnect( ) Do persistent connections ever die?

        On Fri, 10 Oct 2003 03:06:00 GMT, Richard Podsada
        <jslweb@superdu perspamdiediete lusplanet.net> wrote:
        [color=blue]
        >"Randell D." <you.can.email. me.at.randelld@ yahoo.com> wrote in
        >news:qakhb.549 53$9l5.45409@pd 7tw2no:
        >[color=green]
        >> 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.[/color]
        >
        >Can I point you to the PHP manual page on Persistent Connections?
        >
        >http://ca3.php.net/manual/en/feature...onnections.php
        >
        >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 :)[/color]

        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 (andy@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk)
        Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)

        Comment

        Working...