Re: [ZODB-Dev] zodb cache settings
Miles Waller wrote at 2006-12-21 17:31 +: ... Now, if I access say, the title attribute of the top folder, the entire folder object is loaded into memory. Am I correct that the subfolder objects (attributes of the folder) are not loaded in at this point, just references to them? This should indeed happen: only the top folder is loaded with persistent references to its persistent children. The persistent reference is automatically turned into the true object when one of the object's instance attributes it accessed (description slightly simplified). At this point the object is loaded from the storage. Does the same apply to the DateTime objects which are attributes of this folder? No, as DateTime is not persistent, a DateTime instance is loaded as soon as the object containing it is loaded. At this point, how many objects would the cache show as needed to be loaded? The cache will should the number of truely loaded persistent objects. It will not count the persistent references nor any non persistent objects. Assuming that I access the datetime attribute when I load the folder, could I avoid evicting objects from the cache by storing dates as strings rather than DateTimes, so I load one large object rather than two? No. As DateTime is not persistent, DateTime instances are not seen by the ZODB cache management (they behave like strings in this respect). Also, am I right that the cache size is determined by total number of objects, rather than by cache size? Yes. So loading a large file in, for example, would not evict tons of objects to make room for it. Hopefully, this is wrong. The standard File implementations fragment their content over a number of persistent objects. This is necessary in order not to blow up your RAM requirements. Thus, a File instance is indeed a collection of persistent objects -- and a huge File object can evict larger numbers of other objects. Of course, they might be unintelligent File implementations (not the standard ones, but potentially third party developments). -- Dieter ___ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org http://mail.zope.org/mailman/listinfo/zodb-dev
[ZODB-Dev] zodb cache settings
Hi, I'm hoping someone can answer a simple question about the zodb cache settings that are shown in the control panel of the ZMI under zope. In summary, I'm trying to understand a bit more about how zodb loads objects into memory, so I can make sure that objects I need aren't being evicted from the cache unnecessarily. In my database, I have a zope folder (it's not a btree folder) so items in the folder are stored as attributes, and the ids of the items as a list. In the folder I have 10 subfolders. Each subfolder contains one simple object, again, stored as an attribute. The folder, the subfolders and the objects all have an attributes which is a DateTime object. They also all have a single string attribute which is the title. Now, if I access say, the title attribute of the top folder, the entire folder object is loaded into memory. Am I correct that the subfolder objects (attributes of the folder) are not loaded in at this point, just references to them? Does the same apply to the DateTime objects which are attributes of this folder? At this point, how many objects would the cache show as needed to be loaded? Assuming that I access the datetime attribute when I load the folder, could I avoid evicting objects from the cache by storing dates as strings rather than DateTimes, so I load one large object rather than two? Also, am I right that the cache size is determined by total number of objects, rather than by cache size? So loading a large file in, for example, would not evict tons of objects to make room for it. Thanks in advance for any help, Miles ___ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org http://mail.zope.org/mailman/listinfo/zodb-dev