Saturday, May 23

Visualizing the persistent structure of a page

Inspired by David's blog post I took his script and modified it slightly for a different purpose. Instead of showing an entire Plone site, I used it on a single page, with only a simple title and text. Here's what a page actually consists of on the persistent data level:



So what you think of commonly as one page object is indeed at the minimum ten persistent objects. As soon as you add references to it or store certain other information on it, it will grow even more.

If you ever heard complains about what is wrong with the way we store data in Plone, this might make it more obvious. Another thing you need to know about the ZODB is that it is slightly simplified just one big table with a unique identifier (oid) mapped to the pickle data. While conceptually the above object references are important, on the DB level loading any of these objects from the DB is the same operation. If you have a ZEO setup where loading an object incurs some network latency, you'll end up with ten times the latency for loading what seems to be a simple page object.

So if you ever wondered why you need to increase your ZODB cache to numbers in the thousands and Plone needs so much RAM, the above should give you some ideas. Fixing these problems is incredibly hard after they have been introduced, but people like Laurence Rowe keep reminding us of the importance of it. </rant> ;)