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...

sxc731
  • 1,244

1 Answers1

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.
sxc731
  • 1,244