I had a little adventure today. I purchased orlandopostgresql.com so that I could have a domain for the Orlando Meet-Up group that I run here in town for PostgreSQL professionals. Our previous domain orlandopg.com was allowed to expire. Unfortunately I was not its owner. At any rate as I went to add the necessary MX records and test that the email address I set up worked I happened to notice that my gmail account was reporting that it was unable to retrieve email from my home mail server ( I will post about how I use Gmail for my various domains, yet still run my own mail server as well in a later post). Curious I looked and found that postfix was unable to connect to my Pg server due to "Too many connections". Believe it or not I was pleasantly surprised. The fact that I was running out of connections meant that I am actually getting traffic to my website. A quick verification with lsof -i | grep postgres revealed that Apache had eaten up all my connections which were still at the default 100. This is a perfect opportunity to set up
PgBouncer which is my favorite connection pooler for PostgreSQL. Its config file is very simple and easy to follow, and 10 minutes later the site is back up and running faster than ever and I won't have to worry about running out of connections again.