Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Data Partitioning Help

Hello Everyone,

I am new to EclipseLink and have a couple of questions regarding Partitioning policies.

I followed the example at:

http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Data_Partitioning

I annotated my entity with the HashPartitioning policy but I am unable to get any entities to be persisted to the 'node2' connection pool.

Here is my persistence.xml:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
  <persistence-unit name="MServicePU" transaction-type="RESOURCE_LOCAL">
    <class>com.e.m.persistence.Conv</class>
    <properties>
      <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
      <property name="javax.persistence.jdbc.url" value="jdbc:mysql://server-dev-db.example.com:3306/t_c_db_1"/>
      <property name="javax.persistence.jdbc.user" value="root"/>
      <property name="javax.persistence.jdbc.password" value="pass"/>
      <!-- The database platform is auto-detected by default,
                 if you want to set a specific platform this can be set. -->
      <!-- property name=""eclipselink.target-database" value="Oracle" / -->
      <!-- Configure connection pool. -->
      <property name="eclipselink.connection-pool.default.initial" value="10"/>
      <property name="eclipselink.connection-pool.default.min" value="64"/>
      <property name="eclipselink.connection-pool.default.max" value="64"/>
      <!-- Configure 2nd database connection pool. -->
      <property name="eclipselink.connection-pool.node2.url" value="jdbc:mysql://server-dev-db.example.com:3306/t_c_db_2"/>
      <property name="eclipselink.connection-pool.node2.user" value="root"/>
      <property name="eclipselink.connection-pool.node2.password" value="pass"/>
      <property name="eclipselink.connection-pool.node2.initial" value="10"/>
      <property name="eclipselink.connection-pool.node2.min" value="64"/>
      <property name="eclipselink.connection-pool.node2.max" value="64"/>
      <property name="eclipselink.connection-pool.node2.initial" value="10"/>
      <property name="eclipselink.connection-pool.node2.min" value="64"/>
      <property name="eclipselink.connection-pool.node2.max" value="64"/>
      <property name="eclipselink.partitioning" value="Replicate" />
    </properties>
  </persistence-unit>
</persistence>

Some questions I have are:

Will HashPartitioning scale to 10+ shards? (Where I have millions of records in each shard that will be heavily loaded with 50/50 read/writes)

Would I be able to use the PartitioningPolicy to define my own policy that does a lookup in memcache for what shard to route requests to? If it is not present in memcache then I would need to scan all shards to find the entities ID, then populate memcache -- to then finally return the shard connection pool. Does this sound like it would work reasonably well?

Are there more examples/documentation that I could look at?

Thank you,

--
Atman
Software Developer
atteeela@xxxxxxxxx


Back to the top