#1
  1. No Profile Picture
    hmm...
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2001
    Location
    Nashville
    Posts
    50
    Rep Power
    14

    postgres maxing out on connections


    When I run pg_close on a resource id , it does not seem to shut down properly(not at all). If I refresh a page rapidly, eventually, the page will stop working, due to too many connections.
    if I do a 'ps' i see a long list of idle postgres processes spawned by apached.
    Any thoughts on where to look?
    I've tried persistent connections and non-persistant, same thing.
    Also tried PEAR with the same result.
    I close all connections with either PEAR or pg_close($rid);

    If you need more details, just let me know.

    Thanks
  2. #2
  3. No Profile Picture
    hmm...
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2001
    Location
    Nashville
    Posts
    50
    Rep Power
    14
    Googled around a little bit and found something that might suggest a solution.
    If httpd.conf has a MaxClients set to a greater number than the maximum number of connections allowed in postgresql.conf, this could cause the problem.
    Seems like there is a timeout somewhere before these connections shut down.
  4. #3
  5. No Profile Picture
    Gödelian monster
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 1999
    Location
    Central Florida, USA
    Posts
    2,307
    Rep Power
    62
    Hmm... this doesn't sound quite right. Are you seeing anything unusual in the PostgreSQL or Apache logs?. It might be that you have some poorly tuned queries that are "running away" with the process. I made a mistake in a query once that resulted in PostgreSQL churning for hours, so of course every PHP page using that query would start another interminable process .

    Have you tried comparing the number of running apache processes to the number of postgres processes?
    The real n-tier system:

    FreeBSD -> PostgreSQL -> [any_language] -> Apache -> Mozilla/XUL

    Amazon wishlist -- rycamor (at) gmail.com

IMN logo majestic logo threadwatch logo seochat tools logo