[Zope] Re: finding which request dragged all the objects into memory

Tres Seaver tseaver at palladion.com
Thu Oct 11 11:40:17 EDT 2007

Hash: SHA1

Chris Withers wrote:

> Anyone found any good logging methods or other strategies for 
> determining which request dragged all the object in the zodb into memory?

I haven't used it this way, but the ActivityMonitor attached to the
database keeps track of statistics which could be useful:
'db.getActivityMonitor().log' is the time-series (per request) which is
used to generate the data for the "Activity" tab on the Control_Panel,
via its 'getActivityAnalysis' method.

However, that data doesn't record anything about the request except the
"end time".  You could also use the connection's 'getTransferCounts'
method, which returns the number of loads and stores done on the jar.

You might be able to get away with hacking in some extra records into
the trace log with this data, e.g.:

  loads_before, stores_before = connection.getTransferCounts()
  # do the reqeust
  loads_after, stores_after = connection.getTransferCounts()
  from ZServer.DebugLogger import log
  log('L', id(request), loads_after - loads_before)
  log('S', id(request), loads_after - stores_before)

You might need to monkeypatch Zope2.bobo_before and Zope2.bobo_after to
get this hooked in right.

- --
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


More information about the Zope mailing list