19 Scaling JPA Applications Using TopLink Grid with Oracle Coherence

This chapter introduces TopLink Grid and provides an overview of how it can be used to achieve high availability and to scale out applications. For details on using TopLink Grid, see Integrating Oracle Coherence.

This chapter includes the following sections:

Use Case

JPA applications must scale out to meet demand and also achieve high availability.

Solution

The implementation is achieved by using TopLink Grid: an integration between TopLink and Coherence.

Components

Sample

See Section 19.3, "Additional Resources," for links to sample applications.

19.1 Introduction to the Solution

Oracle TopLink Grid is a feature of Oracle TopLink that provides integration between the EclipseLink JPA and Coherence. Standard JPA applications interact directly with their primary data store, typically a relational database. However, with TopLink Grid you can store some or all of your domain model in the Coherence data grid. This configuration is also known as JPA on the Grid.

You can configure TopLink Grid to use Coherence as the primary data store, execute queries against the grid, and allow Coherence to manage the persistence of new and modified data. Coherence provides the layer between JPA and the data store, where direct database calls can be offloaded from every application instance. This makes it possible for clustered application deployments to scale beyond the bounds of standard database operations.

These are the typical TopLink Grid configurations that applications can use:

  • Grid Cache configuration, which uses Coherence as the TopLink L2 (shared) cache. This configuration applies the Coherence data grid to JPA applications that rely on database-hosted data that cannot be entirely preloaded into a Coherence cache. Some reasons why it might not be able to be preloaded include extremely complex queries that exceed the feature set of Coherence Filters, third-party database updates that create stale caches, reliance on native SQL queries, stored procedures or triggers, and so on.

    In this configuration, you can scale TopLink up into large clusters while avoiding the requirement to coordinate local L2 caches. Updates made to entities are available in all Coherence cluster members immediately, upon committing a transaction.

  • Grid Entity configuration, which is optimal for applications that require fast access to large amounts of (fairly stable) data and perform relatively few updates. This configuration can be combined with a Coherence cache store using write-behind to improve application response time by performing database updates asynchronously.

  • Grid Read configuration, which is optimal for entities that require fast access to large amounts of (fairly stable) data and must write changes synchronously to the database. In these entities, cache warming could be used to populate the Coherence cache, but individual queries could also be directed to the database if necessary.

19.2 Implementing the Solution

For complete details on configuring Toplink Grid and developing applications with TopLink Grid, see Integrating Oracle Coherence.

19.3 Additional Resources

See the following resources for more information about the technologies and tools used to implement the solutions in this chapter: