Dynamic Web Development with Seaside

Buy PDF Buy Print

25.4.1How it works

A running Magma server is never required to deal with actual instances of the domain, it is really nothing more than a buffer server. The persistent model is encapsulated into serialized object buffers that are relationally-linked by their oid (object-id). Here is the entire class hierarchy:

MaObjectBuffer #('byteArray' 'startPos')
    MaFixedObjectBuffer #()
    MaVariableBuffer #()
        MaByteObjectBuffer #()
            MaStorageObjectBuffer #()
        MaVariableObjectBuffer #()
        MaVariableWordBuffer #()

Every single Magma repository consists of many thousands (millions, billions, etc.) of these buffers written to various object files (note that each Magma repository is physically stored in its own directory of files, you should not remove these Magma-generated files via the OS, or add any additional files). This first-class representation of the buffers allows the Magma server to dance over any part of the domain with agility, rapidly supplying requesting clients with object-answers to their requests by way of the “Ma client server” supporting package, the high-performance client-server framework for Squeak.

After receiving the chunk of buffers from the server, Magma clients translate them into the domain instances, constructing the model and attaching it correctly to the existing cached model. Of course the model is rendered exactly true to its original shape, cycles and all. The “edges” of the cached domain model are terminated by Proxy instances which will automatically mutate that portion of the model if the program ventures there.

This constant conversion to and from the MaObjectBuffer instance format does mean Magma runs more slowly for a single-user than the all-in-memory frameworks. At least until the model grows beyond 100MB. At that point, every single save in the all-in-memory is writing out another 100MB, but Magma will automatically determine only the objects that changed and write out only those changes. Even further, the level of performance can be maintained indefinitely as the size of the model or number of users increases, by adding additional servers as necessary. Magma constantly monitors and captures extensive performance statistics, allowing developers to fine-tune their programs to maximize use of the available resources.

Magma is a safe place to maintain a Squeak object model important to you or your organization. It supports full-backup and DR replication for rapid failover, out of the box. The generic structure of the storage is simple, well documented, has remained compatible across many Squeak versions and will continue to do so

In Magma you have to specify the root of the world that you want to store and Magma identifies the changes that should be saved. Now we will have a look at how to use Magma to save our ToDo application.

Copyright © 30 April 2017 Stéphane Ducasse, Lukas Renggli, C. David Shaffer, Rick Zaccone
This book is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 license.

This book is published using Seaside, Magritte and the Pier book publishing engine.