Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Introduce Infinispan as cache and hibernate back-end #577

Merged
merged 25 commits into from Mar 12, 2015

Conversation

carlosmunoz
Copy link
Member

Make infinispan the backend used for all caches (hibernate included) as well as hibernate search indexes. All configuration for caching now falls on standalone.xml. Additionally, these caches can be made to persist to the database meaning it's now possible to have caches that persist server shutdowns (statistics come to mind here), as well as keep them solely in memory (to test hibernate search without needing to create index files)

@carlosmunoz
Copy link
Member Author

@seanf Sean, do you mind taking an early look? No configuration details in the PR, I'll create a wiki page for those.

@carlosmunoz
Copy link
Member Author

For configuration details (still a very early draft) see https://github.com/zanata/zanata-server/wiki/Infinispan

@carlosmunoz carlosmunoz force-pushed the infinispan branch 4 times, most recently from 8c1a38e to 3a3d8ee Compare September 12, 2014 01:12
@seanf
Copy link
Contributor

seanf commented Sep 12, 2014

@carlosmunoz Shouldn't we keep the integration tests' configuration as close to production as we can, in terms of persistence?

@carlosmunoz
Copy link
Member Author

Might not be a bad idea for the arquillian tests. I'm sure the JdbcStore works with H2. Until we get some serious performance tests I don't think we'll be able to see anything go to the database though, but at least it will validate our configuration.


@Override
public V getWithLoader(K key) {
// NB: Need to manually implement the cache loader feature
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this method be synchronised or something?

@seanf
Copy link
Contributor

seanf commented Sep 12, 2014

What are the effects of switching from CacheConcurrencyStrategy.READ_WRITE to CacheConcurrencyStrategy.TRANSACTIONAL?

cacheManager.shutdown();
// NB Since infinispan is container managed, there's no need to stop the
// cache manager with
// cacheContainer.stop();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might as well get rid of the whole method then. One less thing to migrate from Seam to CDI.

@carlosmunoz
Copy link
Member Author

What are the effects of switching from CacheConcurrencyStrategy.READ_WRITE to CacheConcurrencyStrategy.TRANSACTIONAL?

From what I've investigated, READ_WRITE is the least performant of all the basic options just because it locks entries and compares versions (hash?) of objects when saving. TRANSACTIONAL is the one designed specifically for distributed caches. It does not lock, but rather relies on the cache to provide consistency. It can be registered with the local JTA transaction and comes with the price of XA. So, it will be less efficient, but if we can use the option to save in the background it might not be noticeable from a response time perspective... might even be faster than our current solution.

@Override
protected void prepareResources() {
MockitoAnnotations.initMocks(this);

cacheContainer.start();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we call cacheContainer.stop() somewhere too?

@seanf
Copy link
Contributor

seanf commented Sep 12, 2014

I won't list all of them, but I think all the tests which start() CacheContainer should also stop() it in an @AfterMethod or something.

value="infinispan" />
<!-- to use an existing cache manager (Good for external configuration) -->
<property name="hibernate.search.infinispan.cachemanager_jndiname"
value="java:jboss/infinispan/container/hibernate-search"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about this bit (from the other persistence.xml)?

<property name="hibernate.cache.region.factory_class"
    value="org.hibernate.cache.infinispan.JndiInfinispanRegionFactory" />
<property name="hibernate.cache.infinispan.cachemanager" 
    value="java:jboss/infinispan/container/hibernate" />

@carlosmunoz carlosmunoz force-pushed the infinispan branch 7 times, most recently from dcd7aa2 to 671603b Compare September 15, 2014 05:30
Conflicts:
	zanata-war/src/test/java/org/zanata/service/impl/StatisticsServiceImplTest.java
@carlosmunoz
Copy link
Member Author

@seanf Can we consider merging this into master now that we've branched for release?

@carlosmunoz
Copy link
Member Author

@seanf bump

@seanf seanf added the Reviewed label Feb 26, 2015
@seanf
Copy link
Contributor

seanf commented Feb 26, 2015

@carlosmunoz Looks good, but we might need QA to look again, after the branch is rebased (or master is merged in).

Conflicts:
	pom.xml
	zanata-war/pom.xml
	zanata-war/src/main/java/org/zanata/service/impl/TranslationStateCacheImpl.java
@carlosmunoz
Copy link
Member Author

@seanf Care to review the last commits for this pull request?

<h5>Infrastructure Changes</h5>

Zanata now uses Infinispan as its cache provider, and the cache needs to be configured in Jboss' `standalone.xml` file. Please see the [Infinispan](configuration/infinispan) section for more information.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this pull request updates all SIX! copies of standalone*.xml in the source tree.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the configuration to all our standalone.xml files.

@seanf
Copy link
Contributor

seanf commented Mar 11, 2015

Otherwise looks fine.

@carlosmunoz
Copy link
Member Author

No. We left hibernate search out of infinispan for the time being due to less than desirable performance.

@seanf
Copy link
Contributor

seanf commented Mar 11, 2015

👍 Once the tests pass. I would suggest running all functional tests before merging though.

carlosmunoz added a commit that referenced this pull request Mar 12, 2015
Introduce Infinispan as cache and hibernate back-end

Full functional tests passed. Not attempting a squash merge.
@carlosmunoz carlosmunoz merged commit 5decdf0 into integration/master Mar 12, 2015
@carlosmunoz carlosmunoz deleted the infinispan branch March 12, 2015 04:33
@carlosmunoz carlosmunoz restored the infinispan branch March 9, 2016 06:38
@seanf seanf deleted the infinispan branch September 21, 2016 02:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
4 participants