Data preloading and warm-up

In many scenarios that incorporate the use of a loader, you can prepare your data grid by preloading it with data.

When used as a complete cache, the data grid must hold all of the data and must be loaded before any clients can connect to it. When you are using a sparse cache, you can warm up the cache with data so that clients can have immediate access to data when they connect.

Two approaches exist for preloading data into the data grid: Loader plug-in or client loader.

Loader plug-in

The Loader plug-in is associated with each map and is responsible for synchronizing a single primary partition shard with the database. The preloadMap method of the :Loader plug-in runs automatically when a shard is activated. For example, if you have 100 partitions, 100 loader instances exist, each loading the data for its partition. When run synchronously, all clients are blocked until the preload completes.

Figure 1. Loader plug-in
Loader plug-in: the primary shard has a loader instance

For more information about the Loader plug-in, see Plug-ins for communicating with databases.

Client loader

A client loader is a pattern for using one or more clients to load the data grid with data. Using multiple clients to load grid data can be effective when the partition scheme is not stored in the database. You can invoke client loaders manually or automatically when the data grid starts. Client loaders can optionally use the StateManager to set the state of the data grid to preload mode, so that clients are not able to access the data grid while it is preloading the data. WebSphere® eXtreme Scale includes a Java Persistence API (JPA)-based loader that you can use to automatically load the data grid with either the OpenJPA or Hibernate JPA providers. For more information about cache providers, see JPA level 2 (L2) cache plug-in.

Figure 2. Client loader
Client loader that is using a JPA provider