Ecosystem:Terracotta BigMemory Max

From PostgreSQL wiki
Revision as of 05:13, 1 September 2016 by Maumau (talk | contribs) (Initial creation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Test procedure

BigMemory Max itself does not interact with databases, so here we test it as a second-level cache of Hibernate ORM, with PostgreSQL as a backing database. Hibernate supports Ehcache as a second-level cache, and BigMemory Max provides the Ehcache interface. Thus, Hibernate can use BigMemory Max as a second-level cache.

Hibernate has a regression test suite to test integration with Ehcache. It resides in the directory hibernate-ehcache. You can run it exactly like other Hibernate test suites. See here for the procedure.

Before running the regression test, you need to perform some preliminary steps to make the test suite use BigMemory Max. First, install the BigMemory Max and start the Terracotta server array by following the Installation Guide. Hereafter, ${HibernateSrcDir} refers to the top directory of Hibernate source distribution.

Copy the BigMemory Max license file (terracotta-license.key) to ${HibernateSrcDir}/project/hibernate-ehcache/src/test/resources/.

To add your BigMemory Max libraries as the dependencies of the regression test, edit ${HibernateSrcDir}/project/hibernate-ehcache/hibernate-ehcache.gradle as follows. Comment out the existing dependency on libraries.ehcache, and add a files dependency line.

dependencies {
//    compile( libraries.ehcache )
    compile files('${BigMemoryInstDir}/apis/ehcache/lib/ehcache-ee-', '/tuna/bigmem/apis/ehcache/lib/slf4j-api-1.7.7.jar', '${BigMemoryInstDir}/apis/toolkit/lib/terracotta-toolkit-runtime-ee-')

Modify the Ehcache configuration file ${HibernateSrcDir}/project/hibernate-ehcache/src/test/resources/ehcache.xml to use BigMemory Max and Terracotta Server Array. Specifically, set the overflowToDisk attribute of defaultCache and cache elements to false, add the terracotta element under the defaultCache element, and add the terracottaConfig element under the ehcache element. For example:


    <cache name="sampleCache1"

    <cache name="sampleCache2"

    <terracottaConfig url="localhost:9510"/>