Magma provides very suitable database support to a Seaside web application.
Summary
The Magma repository on SqueakSource includes a package Magma seaside. This package may be installed after installing Magma and Seaside to provide Seaside applications a suggested interface to a Magma repository, and a supplemental panel in Seaside's Configuration utility to point the application to any local or remote Magma repository.
Session Management
Communication with Magma occurs through database sessions. Each Seaside session will create its own connection to the Magma repository, known as a MagmaSession. Note WAMagmaSession extends WASession to manage the allocation of this MagmaSession and its closure when the Seaside session is finalized.
Two Types of Connections
With the new panel in Seaside's configuration utility you may specify one of two ways it should connect the MagmaSession, local or remote. The base Magma installation abstracts this distinction with subclasses of MagmaLocation.
Local Connections
For small systems with just a few users, a local connection serializes all database requests from all Seaside sessions, single-threaded.
The fully qualified pathname of the Magma repository must be supplied to the MagmaLocalLocation
Remote Connections
Larger systems may utilize a remote connection to the Magma repository running in a separate image. This should scale to a significantly larger user base, particularly in the context of multiple Seaside images (each handling a finite number of Seaside sessions), by dividing the heavy Magma-client burden across multiple images, threads, machines. The lightly-taxed Magma-server will not starve so long for requests and, under maximum throughput conditions, always have a few requests queued and ready.
Under this configuration, each MagmaSession accesses the repository over TCP. To this end only the hostname and port need be supplied.
Note, when using a remote connection, the remote repository must be opened and started separately, for more information see Getting started with Magma.
Transparency
Regardless of which type of connection is used (local or remote), the Seaside application code remains exactly the same. Once the connection has been set through the Configuration utility, all access to the data from a MagmaSession is transparent; e.g., via normal method sends. Each session's view of the data is refreshed at each transaction boundary, with optimistic locking to ensure consistency.
Tutorial
Integrating The Seaside Sushi Store with Magma
Seaside provides a Sushi Store application to demonstrate the features it offers. This application (WAStore) does not read the inventory of available sushi options (WAStoreItem) from a database, nor does it store the orders once they have been processed.
To add this functionality, the following must be performed:
The change set will open a Workspace with instructions.
About WAMagmaSession
WAMagmaSession also provides convenience methods to acess the Magma repository (via the MagmaSession).
About WAMagmaConfiguration
To ensure that all Seaside applications use WAMagmaSession and can configure a MagmaLocation via the seaside/config application, the Magma seaside package provides WAMagmaConfiguration which is used by Seaside root components.