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...
[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?netstat -a
. Upon closer inspection, I noticed the connections occur over IPv6 (for obscure reasons), which led me to this bug