Overview
The space can load data from external data sources, store data into external data sources, and persist data into a relational database or an indexed file.

A space can interact with an external data source, such as a database, in order to extend or back up the physical memory of the process running the space. When searching for desired objects, the space uses both its process memory (cache), and its persistent media files. When the space is restarted, data from the media files can be loaded into the space cache.
The space can also be used as a Hibernate or JDO second level cache.
Persistency Architecture
GigaSpaces provides several persistency models, which allow different modes of interaction with a database.
Expand this...
All external data source space interaction is based on one common interface – the IStorageAdapter. The Storage Adapter (SA) is the GigaSpaces engine component responsible for loading data from external resources, storing data into external resources, and persisting data to durable storage when performing space operations.
In addition to the IStorageAdapter, GigaSpaces exposes several interfaces and persistency implementations. Each provides a different persistency model suitable for a different scenario. These persistency models are described below.
JDBC Storage Adapter
Persists space operation into RDBMS. Mapping is done using the classic class-to-table approach. Data in the database is owned by GigaSpaces and may not be modified by external applications; it can be accessed directly via database interfaces in read-only mode. The JDBC SA option supports any RDBMS and using the JDBC driver to interact with the database.
 | This option supports implicit data recovery from the database when a space is started, stores Entry meta data and notify templates, and persists a redo log, providing reliable asynchronous replication. |
CacheLoader & CacheStore
When an object is written to the space, the CacheStore implementation is used to update the external data source with space destructive operations (write, update and take). This method is used to store the object's content in the database table. When an application attempts to read data from the space, and it does not exist within the space, the CacheLoader or CacheIteratorFactory implementation is called.
Expand this...
These interfaces can retrieve data, based on passed template or key, from the external data source back into the space, and return it to the client as a space Entry. The CacheBulk implementation is used when performing a space operation with a transaction. The CacheBulk implementation allows the space to perform all of the specific transaction operations in one database transaction, ensuring that the space's data is coherent and consistent with the database's data, and vice versa.
 | This option does not support:
- Implicit data recovery from the database when the space is started.
- Storing of Entry meta data and notify templates into an external data source.
- Persisting redo log data when performing a replication.
|
The CacheLoader, CacheIteratorFactory, CacheStore, and CacheBulk interfaces are supported both by the JavaSpaces API and by the Map API.
Hibernate CacheLoader & CacheStore
Enables mapping of space objects to database tables using Hibernate configuration files. In this case, the Entry class should implement getter and setter methods for the relevant fields. You may also use POJO classes and have the space class mapping, using annotations or gs.xml space mapping configuration files. gs.xml configuration files can be generated via Hibernate mapping files to speed up the mapping process.
The Hibernate CacheLoader/CacheStore is supported both by the Map API and the JavaSpaces API.
Hibernate Cache Plugin
The space is accessed via the Hibernate API. Hibernate query results and data are saved in the space. Repeated query results are fetched from the space, not from the database.
This option mostly boosts database read operations.
Mirror Service
Expand this...
A reliable asynchronous persistency – enables space operations to be delegated in a reliable asynchronous manner into a dedicated service that interacts with the database or external data sources in batch mode for maximum efficiency. In this case, the CacheBulk implementation is also used to perform the asynchronous delivered operations against the external data source in one batch. GigaSpaces provides default implementation of the CacheBulk implementation used by the Mirror Service, to persist objects into RDBMS using Hibernate mapping files.
Indexed File
Expand this...
An indexed file holds the space data in memory for small durations and periodically flushes data into a file. With this option, the interaction with the file is faster than RDBMS, however, the persistency handling is done as part of the space's process. This means that the space process utilizes the machine CPU both for the space operations, and for interaction with the file. The file's persistency is also dependent on the space's life cycle – abnormal shutdown of the space might impact the file's coherency and consistency.
|
Section Contents
- Data Loading and Dumping — How an application can load data into the space at some point, and later save it back to other systems.
- Generic Storage Adapter — Using the Generic SA interfaces to perform write-through or read-through.
- Hibernate Cache Plugin — Using GigaSpaces together with Hibernate to access a database using complex SQL queries.
- Hibernate Architecture — The GigaSpaces Hibernate architecture is based on the classic master-worker pattern.
- Hibernate Cache Plugin Implementation — The Hibernate cache interface is implemented using the GigaSpaces Map API, and comprises the classes GigaSpacesCacheProvider and GigaHibernateCache.
- Interacting with Hibernate Cache — Hibernate implements a simple session-level cache, useful on a per-transaction basis. This cache is primarily used to optimize the SQL generated by Hibernate. It is sometimes referred to as a first-level Hibernate cache.
- Mirror Service — Allows different runtime spaces to push write operations in an asynchronous manner into a central service that can aggregate the operations and persist these into a file or a database.
- Persistency Into Indexed File — Using the command line or GigaSpaces Browser to create a persistent space backed up by an indexed file.
- Persistency into RDBMS — Persistency configuration files; creating persistent space using JDBC; configuring JDBC connection pool; configuring DB2 7.2.
- Persistent Space Schema — All the persistency options in the persistent space schema file.
- RDBMS Read-Through and Write-Through for Map - 5.0 — Using the CacheLoader and CacheStore interfaces.
- Read-Through and Write-Through — About space write-through and read-through operations and how to configure them by implementing the CacheLoader/Store interface, or by using a standard Hibernate interface.
- Transient Entries — How to specify that some objects in a persistent space should not be saved to persistent storage.
|
Add Comment