Thank you for the informative post. We believe this was caused by a network issue yesterday after checking our network speeds. We were maxing our ethernet port at 100 mbps, i believe some apache processes were hanging because of this issue, having no available bandwidth left. Considering an upgrade to a gbps port and we will see how this will effect.
On Tue, Oct 6, 2009 at 9:28 AM, Steve Crawford < scrawf...@pinpointresearch.com> wrote: > Aras Angelo wrote: > >> ... >> When i kill the earliest idle process the others stop too. So i dont know >> whats wrong really. All our apps use the same footer, with pg_close() at the >> end.... >> ... >> I have done most of the things you guys suggested, so it seems to me that >> something between php-apache-postgresql is not doing good, and it only >> effects us at peak times, so just wondering if killing processes every 2-3 >> minutes, would do harm on our setup.... >> > > Are you killing web processes or postgresql processes? If web, you will > probably end up impacting at least some of you users directly. If > PostgreSQL, then you will undoubtedly end up yanking the rug out from under > a process that expected a working database connection. So yes, you might > cause harm. Worse still, you may not solve the problem. > > When I hear symptoms like this, especially when they tend to happen under > load, I start looking for a process that is slowing/blocking the other > processes. > > Consider a fairly typical PHP script. It might start out opening a database > connection and then do various queries interspersed with processing. If one > process hogs sufficient resources or is holding some resource or lock that > slows or blocks the other PHP processes then you could easily see numerous > idle PG processes. Kill the "offending" process and the others will often > rapidly complete thus releasing their connections. > > If you have enough traffic to justify three webservers then you probably > have enough traffic to deplete your available pg connections in seconds, not > minutes so keep digging. > > Cheers, > Steve > >