Search code examples
python-3.xpyramidzodb

what is connection_cache_size in zodbconn.uri(pyramid-framework-zodb-scaffold)?


In pyramid framework(scaffold zodb project package) there is a line in development.ini

zodbconn.uri = file://%(here)s/Data.fs?connection_cache_size=20000 

When pserve development.ini is invoked data.fs, data.fs.index, data.fs.lock and data.fs.tmp is created. I readily understand that, zodbconn.uri creates zodb db on disk for usage but what is cache_connection_size, the default value of it corresponds to 20000 in the development.ini. What can be the value of it., i.e., what the value is based on?


Solution

  • The parameter configures how many objects the connection caches in RAM. Note that this is an object count, not a size in bytes.

    Keeping a number of objects in memory reduces load times, but increases RAM size. What you set the number to then depends on how much RAM you have and how big your objects are.

    You may want to monitor your ZODB activity to see how many loads are performed over a given time period, see how much RAM is used at the same time, and adjust the cache size accordingly. Nagios or a similar monitoring / graphing system is ideal there.