[Zope-dev] Specialist/Rack scalability
Steve Alexander
steve@cat-box.net
Sun, 21 Jan 2001 22:37:26 +0000
Michael Bernstein wrote:
>
>> Make sure that each large attribute is an instance of a class that
>> derives from Persistent.
>
> Ok, I'll give that a try. Since Photo is a Python Product,
> what will happen to current instances if I make this (and
> only this) change?
I don't know. I can think of reasons that it might be ok. I can also
rationalize why it would cause badness. :-)
>> [[ put images in their own specialist ]
>
> I'm not certain that that makes sense, since the Images are
> really cached 'views' of the Photo object. When a new image
> is uploded to replace an existing one, *all* versions
> (thumbnails, small, medium, large, etc) are regenerated.
Makes sense to me. You're not generating them on the fly; you're storing
them persistently.
If you put them in their own Specialist and Rack or Racks, you get to
say how they are stored entirely independently of how the Photo objects
are stored.
I would have just one Images specialist, and then probably store them in
different racks, but expose them to the rest of the application as all
being of the same class of Image, but with a different image_size
attribute; either "thumbnail", "small", "medium" or "large".
That way, I could make the small rack generate thumbnails from the
medium rack if, for example, the small size was rarely requested.
There are many ways to design that though, and it depends on how you
want things to work. (Obviously :-) )
> But assuming that I went so far as to break out the Images
> to their own Rack, would you reccomend that each image size
> have a dedicated Rack, or would you suggest that all images
> be stored in the same Rack?
There are advantages and disadvantages to each approach. However, you
should be hiding the details of what Racks exist behind the facade of
the Specialist.
The Specialist will have a getItem method, which will get an Image from
the appropriate rack, and probably some methods like
listImagesFor(photo) and getImageFor(image_type, photo) so you can get
all the images for a particular photo.
Perhaps also storeImageFor(photo, original_image), which would end up
processing and storing images derived from the original image.
--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net