EclipseLink/Examples/JPA/Partitioning

From Eclipsepedia

Jump to: navigation, search

Scaling the Database with Data Partitioning

Data partitioning can be used to scale an application across multiple database machines, or with a clustered database such as Oracle RAC.

Partitioning splits your data across each of the database nodes. There is horizontal partitioning, and vertical partitioning. Vertical partitioning splits your data by class or table across multiple database nodes.

For horizontal partitioning each database node will have the same tables, but each node's table will only store part of the data. You can partition the data by the data values, such as range partitioning, value partitioning, hash partitioning or a custom partitioning policy.

Data replication can be used to backup data, for fault tolerance and fail-over, or for load balancing and scaling the database.

EclipseLink supports data partitioning, replication, load-balancing and fail-over. Several different partitioning policies are supported:

  • @HashPartitioning - partition data by hashing a field value into a set of connection pools/database nodes.
  • @ValuePartitioning - partition data by mapping the value of a field to a different connection pool/database nodes.
  • @RangePartitioning - partition data by mapping a range of values of a field to a different connection pool/database node.
  • @PinnedPartitioning - pin data to a specific connection pool/database node (vertical partitioning).
  • @ReplicationPartitioning - replicate data to a set of connection pools/database nodes.
  • @RoundRobinPartitioning - load-balance requests to a set of connection pools/database nodes.
  • @UnionPartitioning - union the results of a request to a set of connection pools/database nodes.
  • @Partitioning - provide a custom partitioning policy.

Partitioning can be set at the session, entity, relationship and query level. Partitioning is supported on any database, include both clustered databases such as Oracle RAC, and standard databases such as MySQL. Fail-over is support through EclipseLink's connection pooling support by allowing a set of fail-over connection pools for each connection pool.