Обсуждение: Monitoring Active Connections

Поиск
Список
Период
Сортировка

Monitoring Active Connections

От
rajan
Дата:
Hello,

I have a scenario in which a deadlock occurred following an unusual increase
in Number of Active Connections to the database.

In an hour, the Active Connection shooted up to 250 from 1 and it came back
to normal by the end of the hour. At that time the deadlock occurred.
Deadlock information contains a relation id and two pids, both of them are
NOT traceable.

Now I want to analysed what would have caused an unsual number of increase
in the number of Active Connections, I can't get any data out of
pg_stat_activity. Now the total number of connections is 75 only. Will there
be any log from which I can get those queries or connection details?

Can anybody help me on this?



-----
--
Thanks,
Rajan.
--
View this message in context: http://postgresql.nabble.com/Monitoring-Active-Connections-tp5886073.html
Sent from the PostgreSQL - admin mailing list archive at Nabble.com.


Re: Monitoring Active Connections

От
Keith
Дата:
Ensure you have "log_connections" and "log_disconnections" set to "on" in your postgresql.conf. This will add the connection info to your postgres logs. Keep in mind if you have a very high connection rate, this can cause a very noticeable increase in your log size. If you did not have these turned on before, there's nothing I'm aware of within the database itself that tracks connections in the manner you're looking for. pg_stat_activity only shows what is happening right at that moment when you query it.

On Fri, Feb 5, 2016 at 12:24 PM, rajan <vgmonnet@gmail.com> wrote:
Hello,

I have a scenario in which a deadlock occurred following an unusual increase
in Number of Active Connections to the database.

In an hour, the Active Connection shooted up to 250 from 1 and it came back
to normal by the end of the hour. At that time the deadlock occurred.
Deadlock information contains a relation id and two pids, both of them are
NOT traceable.

Now I want to analysed what would have caused an unsual number of increase
in the number of Active Connections, I can't get any data out of
pg_stat_activity. Now the total number of connections is 75 only. Will there
be any log from which I can get those queries or connection details?

Can anybody help me on this?



-----
--
Thanks,
Rajan.
--
View this message in context: http://postgresql.nabble.com/Monitoring-Active-Connections-tp5886073.html
Sent from the PostgreSQL - admin mailing list archive at Nabble.com.


--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Re: Monitoring Active Connections

От
Fernando Hevia
Дата:

On Fri, Feb 5, 2016 at 2:24 PM, rajan <vgmonnet@gmail.com> wrote:
Hello,

I have a scenario in which a deadlock occurred following an unusual increase
in Number of Active Connections to the database.

In an hour, the Active Connection shooted up to 250 from 1 and it came back
to normal by the end of the hour. At that time the deadlock occurred.
Deadlock information contains a relation id and two pids, both of them are
NOT traceable.


My guess would be that the deadlock caused the spike in connections, not the other way around.
 
Now I want to analysed what would have caused an unsual number of increase
in the number of Active Connections, I can't get any data out of
pg_stat_activity. Now the total number of connections is 75 only. Will there
be any log from which I can get those queries or connection details?


If you have log_connections enabled you will find client connections logged in PostgreSQL's log file.
 

Re: Monitoring Active Connections

От
rajan
Дата:
Thanks for the information...

Unfortunately I don't have the log_connections enabled. :(



-----
--
Thanks,
Rajan.
--
View this message in context: http://postgresql.nabble.com/Monitoring-Active-Connections-tp5886073p5886113.html
Sent from the PostgreSQL - admin mailing list archive at Nabble.com.