[Zope-dev] Warning! TransparentFolders and ZClasses

Phillip J. Eby pje@telecommunity.com
Thu, 04 May 2000 14:12:53 -0500


At 06:57 PM 5/4/00 +0000, Jason Spisak wrote:
>R. David Murray:
>
>> On Thu, 4 May 2000, Jason Spisak wrote:
>> > How is this different from having the 30,000 objects that I have in
one of
>> > my instace folders?
>> 
>> How do you manage to get Zope to even respond with 30K objects in
>> one Folder?  You must be using boatloads of memory.
>
>That's a yes. 1 gig of memory.
>
>Actually I don't use the management interface for these folders as you
>probably guessed :)
>
>Well I have a folder called Candidates which contains 15,000 candidates,
>and each candidate contains a resume.  Isn't that 30,000 objects in the
>Candidates namespace?

I would suggest you move them to a Rack/Specialist combination, which is
designed for this sort of thing.  You'll still have the data in the ZODB,
but it won't be as attributes and you'll avoid the boatloads of memory
issue.  Plus, you won't have the enormous disk space hits that occur
whenever you add another candidate to the folder.  :)

To do this with ZPatterns 0.3.0, subclass Candidate from
Products.ZPatterns.Rack.RackMountable (or use the ZClass base provided).
Create a Specialist called Candidates (or whatever), with a Rack to store
the instances.  On the Rack's Storage tab, select your candidate ZClass as
the kind of object to store.  You can then proceed to load up your Rack
with objects, and add methods to the Specialist for any search operations
you might need.  The default Specialist implementation is traversable like
a folder, but will search all contained racks for the specified id.
Acquisition will be in effect (each candidate acquiring from the
Specialist, but not the Rack) but will not include the other candidates as
acquirable attributes.  Less memory, less fuss, less disk space.  To get an
object from DTML, just say Candidates.getItem(id), and to create one, use
Candidates.newItem(id), then populate its attributes.

You know, I probably should stop doing all this posting today so I can
finish 0.3.0 for release tomorrow.  There are still a few bits of cleanup
and testing not done yet.  Ty's also working on the necessary updates to
LoginManager for compatibility with 0.3.0.