Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

zc.monitor plugin to modify cache sizes

Project Description

zc.montorcache is a zc.z3monitor plugin that allows one to modify or check the cache size (in objects or bytes) of a running instance.

>>> import zc.monitorcache
>>> import zope.component
>>> import zc.ngi.testing
>>> import zc.monitor
>>> import zc.monitor.interfaces
>>> import zc.z3monitor
>>> import zc.z3monitor.interfaces
>>> connection = zc.ngi.testing.TextConnection()
>>> server = zc.monitor.Server(connection)
>>> zope.component.provideUtility(zc.monitorcache.cacheMonitor,
...     zc.z3monitor.interfaces.IZ3MonitorPlugin, 'cache_size')
>>> connection.test_input('cache_size\n')
-> CLOSE

We have no databases right now. Let’s add a few so that we can test.

>>> import ZODB.tests.util
>>> import ZODB.interfaces
>>> main = ZODB.tests.util.DB()
>>> zope.component.provideUtility(main, ZODB.interfaces.IDatabase)
>>> test = ZODB.tests.util.DB()
>>> zope.component.provideUtility(
...     test, ZODB.interfaces.IDatabase, 'test')

Now we should get information on each of the database’s cache sizes

>>> connection = zc.ngi.testing.TextConnection()
>>> server = zc.monitor.Server(connection)
>>> connection.test_input('cache_size\n')
DB cache sizes for main
Max objects: 400
Max object size bytes: 0MB
DB cache sizes for test
Max objects: 400
Max object size bytes: 0MB
-> CLOSE

We can request information about a specific db as well

>>> connection = zc.ngi.testing.TextConnection()
>>> server = zc.monitor.Server(connection)
>>> connection.test_input('cache_size -\n')
DB cache sizes for main
Max objects: 400
Max object size bytes: 0MB
-> CLOSE
>>> connection = zc.ngi.testing.TextConnection()
>>> server = zc.monitor.Server(connection)
>>> connection.test_input('cache_size test\n')
DB cache sizes for test
Max objects: 400
Max object size bytes: 0MB
-> CLOSE

We can also modify cache sizes for a specific db

>>> connection = zc.ngi.testing.TextConnection()
>>> server = zc.monitor.Server(connection)
>>> connection.test_input('cache_size test 300\n')
Set max objects to 300
-> CLOSE
>>> connection = zc.ngi.testing.TextConnection()
>>> server = zc.monitor.Server(connection)
>>> connection.test_input('cache_size test 10MB\n')
Set max object size bytes to 10MB
-> CLOSE
>>> connection = zc.ngi.testing.TextConnection()
>>> server = zc.monitor.Server(connection)
>>> connection.test_input('cache_size test\n')
DB cache sizes for test
Max objects: 300
Max object size bytes: 10MB
-> CLOSE
Release History

Release History

This version
History Node

0.1.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
zc.monitorcache-0.1.0.tar.gz (3.0 kB) Copy SHA256 Checksum SHA256 Source Jan 3, 2011

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting