Persistent Storage Strategy

Tapestry pages store a certain amount of client state between request cycles. Each implemention of the IEngine interface provides a different strategy.

Currently, only the SimpleEngine class is provided with the framework; it uses in-memory page recorders. When the engine is serialized, the page recorders are serialized along with it.

The IPageRecorder interface doesn't specify anything about how a page recorder works. This opens up many possibilities for storage of state, including flat files, databases, stateful EJB session beans, or HTTP Cookies.

In fact, a very sophisticated application engine could mix and match, using cookies for some pages, in-memory for others.

By default, page recorders stay active for the duration of the user session. If a page will not be referenced again, or its persistent state is no longer relevant or needed, the application may explicitly "forget" its state.

Remember that for load balancing and fail over reasons, the engine will be serialized and de-serialized. Ideally, its serialized state should be less than two kilobytes; because Java serialization is inefficient, this does not leave much room.

The Tapestry Inspector can be used to monitor the size of the serialized engine in a running application.