2

I have a 12.04 box running postgresql 9.1.8-0ubuntu12.04, which serves a Java webapp (an Atlassian Confluence wiki). I'm trying to take advantage of powernap's IOMonitor feature. However, if I uncomment the corresponding line in /etc/powernap/config:

[IOMonitor]
postgres-io = "postgres"

... powernap never allows the box to go to sleep, the logs (with DEBUG=3) show this:

Looking for [postgres-io] IOMonitor
Activity found, reset absent time [0/60]

One thing I have noticed is that postgres appears to be respawning processes every 2-3 mins (even without any user activity against the wiki); every time this happens, powernap prints:

<powernap.monitors.IOMonitor.IOMonitor instance at 0xXXXX> - adding new PID 16783 to list.

The PIDs in questions appear to be the ones serving my wiki DB, eg:

postgres 16783  1067  0 11:05 ?        00:00:00 postgres: confluence confluence 127.0.0.1(50689) idle

I presume this is getting in the way? Is this an issue with Postgres (is it supposed to respawn processes that often, even w/o activity?). Any pointer as to how I go about debugging this would be most appreciated (maybe starting with how powernap infers I/O activity - since there are many postgres processes, perhaps I can find a regexp that will target just the right one?).

PS: If I comment out the Postgres IOMonitor, powernap works a treat but then it does suspend the box while the Wiki is being used...

4
  • Pg isn't really designed to totally stop all I/O; things like the autovaccum workers, stats collector and bgwriter tend to keep I/O ticking over lightly. Ideally you'd be able to get your activity monitor to ignore such I/O but unless you can match on and exclude the process names that'll be hard. Can't you just monitor the network I/O sockets for the wiki instead? Apr 1, 2013 at 11:03
  • Thx a lot Craig! I suspected smth of the sort was happening. Powernap does have a [TCPMonitor] section for the purpose you suggest; I tried sticking the Wiki's http port in there (8080) but activity doesn't seem to get detected. I suspect this might be because powernap only samples (using netstat) every so often and the http connections are too transient?
    – sxc731
    Apr 1, 2013 at 14:58
  • Actually I can see the http connections showing ESTABLISHED for reasonable length of time using netstat -a. Upon closer inspection, I noticed the connections occur over IPv6 (for obscure reasons), which led me to this bug
    – sxc731
    Apr 1, 2013 at 15:13
  • That looks like an answer candidate to me... Apr 1, 2013 at 23:30

1 Answer 1

1

Per above comments - with thanks to @craig-ringer for putting me on the right track!

  1. Postgresql isn't suitable to I/O monitoring to determine whether it's idle
  2. Instead, it's better to monitor TCP connections to the front-end app if possible
  3. However, be aware of bug 1070695 if your connections are established over IPv6. The bug ticket has a patch which worked a treat for me.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .