5.2. Component Monitoring

There are several ways available to see what Slony-I processes are up to:

5.2.1. Looking at pg_stat_activity view

The standard PostgreSQL view pg_stat_activity indicates what the various database connections are up to.

On recent versions of PostgreSQL, this view includes an attribute, application_name, which Slony-I components populate based on the names of their respective threads.

5.2.2. Looking at sl_components view

Slony-I has a table, sl_components, introduced in Slony-I 2.1, which captures Slony-I activity for each node.

slonyregress1@localhost->  select * from _slony_regress1.sl_components  order by co_actor;
       co_actor       | co_pid | co_node | co_connection_pid |   co_activity    |      co_starttime      | co_event | co_eventtype
----------------------+--------+---------+-------------------+------------------+------------------------+----------+--------------
 local_cleanup        |  24586 |       0 |             24907 | thread main loop | 2011-02-24 17:02:55+00 |          | n/a
 local_listen         |  24896 |       1 |             24900 | thread main loop | 2011-02-24 17:03:07+00 |          | n/a
 local_monitor        |  24586 |       0 |             24909 | thread main loop | 2011-02-24 17:02:55+00 |          | n/a
 local_sync           |  24517 |       0 |             24906 | thread main loop | 2011-02-24 17:03:09+00 |          | n/a
 remote listener      |  24586 |       2 |             24910 | thread main loop | 2011-02-24 17:03:03+00 |          | n/a
 remoteWorkerThread_2 |  24586 |       2 |             24908 | thread main loop | 2011-02-24 17:02:55+00 |          | n/a
(6 rows)

This example indicates the various Slony-I threads that are typically running as part of a slon process:

local_cleanup

This thread periodically wakes up to trim obsolete data and (optionally) vacuum Slony-I tables

local_listen

This thread listens for events taking place on the local node, and changes the slon's configuration as needed.

local_monitor

This thread is rather self-referential, here; it manages the queue of events to be published to the sl_components table.

local_sync

This thread generates SYNC events on the local database. If the local database is the origin for a replication set, those SYNC events are used to propagate changes to other nodes in the cluster.

remote_listener

This thread listens for events on a remote node database, and queues them into the remote worker thread for that node.

remoteWorkerThread_2

This thread waits for events (from the remote listener thread), and takes action. This is the thread that does most of the visible work of replication.

5.2.3. Notes On Interpreting Component Activity