[Seaside] ImageSegments as persistence

Avi Bryant avi at dabbledb.com
Tue Feb 20 17:31:47 UTC 2007


On 2/20/07, Sebastian Sastre <ssastre at seaswork.com> wrote:

> > It's certainly atomic in that there is a single primitive
> > that builds the segment.  But you'll need to do a lot of work
> > yourself to get the ACID properties you might want.
>
> Agree. Do you save them in a #critical: ?

Yes.

> Very nice. Let me see if I understood you right.. by outpointers you mean
> that the image segments must be "closed", I mean objects of one segment
> should not have references to objets outside that segment right?

Sort of.  Your image segment has a root - for me, this is usually
something like a global MyDatabase object, from which all of your data
is accessible.  The trick is that before you put out a segment, you
have to get rid of all references to any of your data that does not
stem from that root.  This includes your Seaside sessions (WARegistry
clearAllHandlers), any open debuggers/inspectors/workspaces that might
hold onto them, maybe DynamicVariables, etc.  You'll know when you've
got an outpointer because it will take an order of magnitude longer to
write out the image segment.

> I think I saw the OS automatically giving more memory to a squeak in low
> memory condition in windows but not in linux. How do you manage a low memory
> condition?

Badly. :)

> Right. When one use this to persist, in your opinion, how one should decide
> to make a "save" on them? By an event? By time? How ofen?

That's a trade off you'll have to figure out based on how your app
gets used.  You will probably want some mix of continuous transaction
logging for worst-case recovery (that might even be just logging the
HTTP requests that come in, since they'll have all of the data you
need), frequent full image snapshotting (which is faster than an image
segment and doesn't require you to clear outpointers, but which takes
up a lot of extra room, is somewhat less reliable [images can get in
wonky states] and harder to upgrade to a new codebase), and periodic
image segment building.  But what mix of those is right for you, and
how to trigger them, is hard for anyone else to say.

Avi


More information about the Seaside mailing list