Skip site navigation (1) Skip section navigation (2)

Re: Verify My Database Isn't Slammed

From: Thom Brown <thom(at)linux(dot)com>
To: Carlos Mennens <carlos(dot)mennens(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Verify My Database Isn't Slammed
Date: 2012-01-05 12:25:30
Message-ID: CAA-aLv7gvprVtZnjUyn_J3aGrRR-JzG9oPJC9g+1URjzJ5Soiw@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
On 4 January 2012 21:30, Carlos Mennens <carlos(dot)mennens(at)gmail(dot)com> wrote:
> I've got a dedicated database server running PostgreSQL 9.1.2 which I
> thought was working fine but I am now having users slowly trickle back
> into the office and using some PHP web applications that use my
> database server and strangely the site will load forever for some
> users. They simply close the browser and or wait a few minutes and
> then they can get in fine. I checked my Apache web logs and found this
> error:
>
> [Tue Jan 03 11:34:09 2012] [error] [client 192.168.1.16] MRBS:
> Fatalerror: unfortunately the database is not available at the
> moment.,referer: https://mysite.tld
>
> I have also a webmail application called RoundCube that over 200 users
> login to and this connects directly to the database server and there's
> never been any communication issue what so ever. I'm going to assume
> the issue is a configuration setting in MRBS in speaking with the
> database and not the database itself but how does one who is extremely
> novice with PostgreSQL determine if their database server is over
> worked or running fine?

Firstly it's worth looking at PostgreSQL's logs and look at the
entries for the timestamp around the time you're seeing the error in
Apache.  Also, at the time users are experiencing problems, run:

SELECT count(*) from pg_stat_activity;

This will give you a count of how many active connections there are on
your database.  Compare this with the result of:

SHOW max_connections;

This will tell you if you have reached or nearly reached your limit.
If you believe your max_connections is too low, either look at
increasing it in your postgresql.conf file or consider a connection
pooler like pgbouncer.

Regards

Thom

In response to

pgsql-novice by date

Next:From: János LöbbDate: 2012-01-05 15:32:24
Subject: Re: Strategy for doing number-crunching
Previous:From: Michael BeattieDate: 2012-01-05 03:43:27
Subject: Re: Verify My Database Isn't Slammed

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group