Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Magma seaside
Last updated at 6:39 am UTC on 9 December 2007
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

Uploaded Image: localConfig.jpg

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.

Uploaded Image: remoteConfig.jpg

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:

A change set is provided from this page implementing these functions and to demonstrate how the WAStore application was modified to use Magma.

Installing the Tutorial change Set

  1. Install Seaside 2.5 or 2.6 from SqueakSource
  2. Install MagmaServerLoader from SqueakMap (part of the Magma project)
  3. Install Magma seaside from SqueakSource (part of the Magma project)
  4. Install the seasideSushiStoreWithMagma.cs.gz change set.

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.


Help

Contact Brent Pinkney or the Magma mailing list for assistance.

seasideSushiStoreWithMagma.cs.gz