Usage of ZODB temporary storage

424 views Asked by At

In plone.recipe.zope2instance there is an option called zodb-temporary-storage that is used to replace Zope's default temporary storage definition.

When is this recommended? What are the upsides and downsides?

1

There are 1 answers

3
Martijn Pieters On BEST ANSWER

By default the recipe includes a temporary storage service to store session data:

Temporary Folders are Zope folders that are used for storing objects temporarily. Temporary Folders acts almost exactly like a regular Folder with two significant differences:

  • Everything contained in a Temporary Folder disappears when you restart Zope. (A Temporary Folder’s contents are stored in RAM).
  • You cannot undo actions taken to objects stored a Temporary Folder.

This is great for the highly volatile session data, but if you are running Zope in a cluster you may want to swap out the storage for something that shared data across your cluster, for example.

The default configuration used is:

<zodb_db temporary>
    # Temporary storage database (for sessions)
    <temporarystorage>
      name temporary storage for sessioning
    </temporarystorage>
    mount-point /temp_folder
    container-class Products.TemporaryFolder.TemporaryContainer
</zodb_db>

which corresponds with the default session management setup for Zope.

I've always avoided using Zope's sessions, as they can easily become a bottleneck (loads of conflicts on the temporary storage), opting to store everything in cookies instead. If you really need server-side session storage, using Beaker (via collective.beaker might be a better option.

Better still, use Products.BeakerSessionDataManager to swap out the default Zope session manager to one backed by Beaker.