Configuring Hazelcast as Second Level Cache for Hibernate

2,618 views
Skip to first unread message

santhosh TR

unread,
Jan 14, 2011, 8:42:14 AM1/14/11
to Hazelcast
Hi All,

Here we were looking for some efficient alter native for terracotta/
coherence. HC seems to be a very good option for us and we are in the
process of evaluating HC for our products. We are mainly looking into
two main features,

1. Distributed Data Structures and
2. L2 Cache for Hibernate.

But from the documentation (http://hazelcast.com/
documentation.jsp#HibernateSecondLevelCache) it is not clear the steps
required to configure HazelCast as l2 cache. Can any one here please
guide me how to configure the same? I'm really looking forward for
some expert advice :).

Mehmet Dogan

unread,
Jan 14, 2011, 10:36:54 AM1/14/11
to haze...@googlegroups.com
Hi,

In simplest form first set some hibernate properties (either in hibernate.cfg.xml or hibernate.properties or spring config xml etc..);
  • set hibernate.cache.use_second_level_cache => true
  • if you want query cache set hibernate.cache.use_query_cache => true 
  • if your hibernate version is prior to 3.3.x then set hibernate.cache.provider_class => com.hazelcast.hibernate.provider.HazelcastCacheProvider else set hibernate.cache.region.factory_class => com.hazelcast.hibernate.HazelcastCacheRegionFactory
Assuming you already know hibernate L2 cache configurations.
Then put hazelcast-hibernate-x.y.z.jar and hazelcast.xml into your classpath.
Every hazelcast entity is cached in a hazelcast map. So you can configure backup, eviction, TTL and near cache for those maps in hazelcast.xml. If you do not specify any configuration for a map then default config will be used. (Map name in configuration is name of your hibernate entity.)


@mm



--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To post to this group, send email to haze...@googlegroups.com.
To unsubscribe from this group, send email to hazelcast+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hazelcast?hl=en.


santhosh TR

unread,
Jan 17, 2011, 6:25:47 AM1/17/11
to Hazelcast
Hi mm/all,


Thanks for your quick response,
According your pointers we now trying to configure HC as our L2 Cache.
But hibernate is throwing an exception

org.hibernate.cache.NoCachingEnabledException: Second-level cache is
not enabled for usage [hibernate.cache.use_second_level_cache |
hibernate.cache.use_query_cache]
org.hibernate.cache.NoCacheProvider.buildCache(NoCacheProvider.java:
21)

org.hibernate.cache.UpdateTimestampsCache.<init>(UpdateTimestampsCache.java:
42)
org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:
337)

org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:
1294)

org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:
860)

org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:
779)

org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:
211)

org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:
1477)

org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:
1417)
......................
.....................
For our POC we are using

1. Spring-3.0.5
2. Hibernate-3.3.X
3. HazelCast-1.9(Default hazelcast.xml, obtained
from the hazelcat-1.9.jar)
4. Mysql-5.0

In the POC a distributed map(HC) is created for cashing purpose and
spring AOP is used to maintain the map. For "cache" we haven't created
any new map (the default map is being used for this purpose).

My "hibernate.cfg.xml" :

<hibernate-configuration>
<session-factory>
<property name="hibernate.cache.use_second_level_cache">true</
property>
<property name="hibernate.cache.use_query_cache">true</property>
<property name="hibernate.cache.use_minimal_puts">true</property>
<property
name="hibernate.cache.region.factory_class">com.hazelcast.hibernate.HazelcastCacheRegionFactory</
property>
<mapping class="com.ibsplc.tcc.poc.spring.contact.form.Contact" />
</session-factory>
</hibernate-configuration>

Can you please tell me where we went wrong?


thanks and regards,
SAN



On Jan 14, 8:36 pm, Mehmet Dogan <mehmetdog...@gmail.com> wrote:
> Hi,
>
> In simplest form first set some hibernate properties (either in
> hibernate.cfg.xml
> or hibernate.properties or spring config xml etc..);
>
>    - set hibernate.cache.use_second_level_cache => true
>    - if you want query cache set hibernate.cache.use_query_cache => true
>    - if your hibernate version is prior to 3.3.x then set
> hibernate.cache.provider_class
>    => com.hazelcast.hibernate.provider.HazelcastCacheProvider else set
>    hibernate.cache.region.factory_class =>
>    com.hazelcast.hibernate.HazelcastCacheRegionFactory
>
> Assuming you already know hibernate L2 cache configurations.
> Then put hazelcast-hibernate-x.y.z.jar and hazelcast.xml into your
> classpath.
> Every hazelcast entity is cached in a hazelcast map. So you can configure
> backup, eviction, TTL and near cache for those maps in hazelcast.xml. If you
> do not specify any configuration for a map then default config will be used.
> (Map name in configuration is name of your hibernate entity.)
>
> ps: This page is more readable to me:http://code.google.com/docreader/#p=hazelcast&s=hazelcast&t=Hibernate...
>
> @mm
>
>
>
>
>
>
>
> On Fri, Jan 14, 2011 at 15:42, santhosh TR <santhosh.re...@gmail.com> wrote:
> > Hi All,
>
> > Here we were looking for some efficient alter native for terracotta/
> > coherence. HC seems to be a very good option for us and we are in the
> > process of evaluating HC for our products. We are mainly looking into
> > two main features,
>
> > 1. Distributed Data Structures and
> > 2. L2 Cache for Hibernate.
>
> > But from the documentation (http://hazelcast.com/
> > documentation.jsp#HibernateSecondLevelCache) it is not clear the steps
> > required to configure HazelCast as l2 cache. Can any one here please
> > guide me how to configure the same? I'm really looking forward for
> > some expert advice :).
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Hazelcast" group.
> > To post to this group, send email to haze...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > hazelcast+...@googlegroups.com<hazelcast%2Bunsubscribe@googlegroups .com>
> > .

santhosh TR

unread,
Jan 17, 2011, 7:53:04 AM1/17/11
to Hazelcast
Hi mm/all,

finally we could make our POC up and running by changing to
hibernate-3.2.0 with a configuration change in the
"hibernate.cfg.xml" (According to your mail). But with change we are
seeing another problem. To test the POC we are using two
Tomcats(6.0.29). But in the console we are seeing four(4) cluster
members rather than two(2)? What could be issue where we actually went
wrong?

But, we are seeing excellent results for the distributed map as
cache( we are yet to load test our POC ).

thanks & regards,
San

On Jan 14, 8:36 pm, Mehmet Dogan <mehmetdog...@gmail.com> wrote:
> Hi,
>
> In simplest form first set some hibernate properties (either in
> hibernate.cfg.xml
> or hibernate.properties or spring config xml etc..);
>
>    - set hibernate.cache.use_second_level_cache => true
>    - if you want query cache set hibernate.cache.use_query_cache => true
>    - if your hibernate version is prior to 3.3.x then set
> hibernate.cache.provider_class
>    => com.hazelcast.hibernate.provider.HazelcastCacheProvider else set
>    hibernate.cache.region.factory_class =>
>    com.hazelcast.hibernate.HazelcastCacheRegionFactory
>
> Assuming you already know hibernate L2 cache configurations.
> Then put hazelcast-hibernate-x.y.z.jar and hazelcast.xml into your
> classpath.
> Every hazelcast entity is cached in a hazelcast map. So you can configure
> backup, eviction, TTL and near cache for those maps in hazelcast.xml. If you
> do not specify any configuration for a map then default config will be used.
> (Map name in configuration is name of your hibernate entity.)
>
> ps: This page is more readable to me:http://code.google.com/docreader/#p=hazelcast&s=hazelcast&t=Hibernate...
>
> @mm
>
>
>
>
>
>
>
> On Fri, Jan 14, 2011 at 15:42, santhosh TR <santhosh.re...@gmail.com> wrote:
> > Hi All,
>
> > Here we were looking for some efficient alter native for terracotta/
> > coherence. HC seems to be a very good option for us and we are in the
> > process of evaluating HC for our products. We are mainly looking into
> > two main features,
>
> > 1. Distributed Data Structures and
> > 2. L2 Cache for Hibernate.
>
> > But from the documentation (http://hazelcast.com/
> > documentation.jsp#HibernateSecondLevelCache) it is not clear the steps
> > required to configure HazelCast as l2 cache. Can any one here please
> > guide me how to configure the same? I'm really looking forward for
> > some expert advice :).
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Hazelcast" group.
> > To post to this group, send email to haze...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > hazelcast+...@googlegroups.com<hazelcast%2Bunsubscribe@googlegroups .com>
> > .

Fuad Malikov

unread,
Jan 17, 2011, 8:00:50 AM1/17/11
to haze...@googlegroups.com
Hi,

Can you try Hazelcast 1.9.1 instead of 1.9.

Fuad

To unsubscribe from this group, send email to hazelcast+...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/hazelcast?hl=en.




--

@fuadm

Mehmet Dogan

unread,
Jan 17, 2011, 8:04:32 AM1/17/11
to haze...@googlegroups.com
yes its problem of build 1.9. just try 1.9.1

and there is a thread about it :)

@mm

santhosh TR

unread,
Jan 17, 2011, 10:13:05 AM1/17/11
to Hazelcast
Hi mm/fuadm/All

Thanks for the reply, now we are trying with HC-1.9.1 along with
1. hibernate-core-3.3.0.ga
2. hibernate-annotations-3.4.0.ga and
3. hibernate-commons-annotations.3.3.0.ga

and ofcourese cache config hasbeen changed to
<property
name="hibernate.cache.region.factory_class">com.hazelcast.hibernate.HazelcastCacheRegionFactory</
property>

But still i'm getting the previous exception. Please help

org.hibernate.cache.NoCachingEnabledException: Second-level cache is
not enabled for usage [hibernate.cache.use_second_level_cache |
hibernate.cache.use_query_cache]
org.hibernate.cache.NoCacheProvider.buildCache(NoCacheProvider.java:
21)

org.hibernate.cache.UpdateTimestampsCache.<init>(UpdateTimestampsCache.java:
42)
org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:
337)

org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:
1294)

org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:
867)

org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:
860)

org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:
779)

org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:
211)

org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:
1477)

org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:
1417)

org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:
519)

org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:
456)
org.springframework.beans.factory.support.AbstractBeanFactory
$1.getObject(AbstractBeanFactory.java:291)
...........................................
..........................................

On Jan 17, 6:04 pm, Mehmet Dogan <mehmetdog...@gmail.com> wrote:
> yes its problem of build 1.9. just try 1.9.1
>
> and there is a thread about it :)http://groups.google.com/group/hazelcast/browse_thread/thread/1aef243...
>
> @mm
>
> On Jan 17, 2011, at 3:00 PM, Fuad Malikov wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > Can you try Hazelcast 1.9.1 instead of 1.9.
>
> > Fuad
>
> > For more options, visit this group athttp://groups.google.com/group/hazelcast?hl=en.

santhosh TR

unread,
Jan 17, 2011, 10:33:25 AM1/17/11
to Hazelcast
Hi mm/fuadm/All,

Now one more experiment....
Right now i'm trying with HC-1.9.1 with hibernate-3.2.0. When we are
staring out first tomcat, it works. But it seems when the second
tomcat tries to join the cluster we can see an exception in the first
one's console. It reads

java.io.EOFException
at java.io.DataInputStream.readFully(DataInputStream.java:178)
at java.io.DataInputStream.readUTF(DataInputStream.java:565)
at java.io.DataInputStream.readUTF(DataInputStream.java:522)
at com.hazelcast.config.GroupConfig.readData(GroupConfig.java:
119)
at com.hazelcast.config.Config.readData(Config.java:504)
at com.hazelcast.cluster.JoinRequest.readData(JoinRequest.java:
68)
at com.hazelcast.cluster.JoinInfo.readData(JoinInfo.java:51)
at com.hazelcast.cluster.JoinInfo.readFromPacket(JoinInfo.java:
84)
at
com.hazelcast.impl.MulticastService.receive(MulticastService.java:109)
at
com.hazelcast.impl.MulticastService.run(MulticastService.java:88)
at java.lang.Thread.run(Thread.java:595)
java.io.EOFException
at java.io.DataInputStream.readFully(DataInputStream.java:178)
at java.io.DataInputStream.readUTF(DataInputStream.java:565)
at java.io.DataInputStream.readUTF(DataInputStream.java:522)
at com.hazelcast.config.GroupConfig.readData(GroupConfig.java:
119)
at com.hazelcast.config.Config.readData(Config.java:504)
at com.hazelcast.cluster.JoinRequest.readData(JoinRequest.java:
68)
at com.hazelcast.cluster.JoinInfo.readData(JoinInfo.java:51)
at com.hazelcast.cluster.JoinInfo.readFromPacket(JoinInfo.java:
84)
at
com.hazelcast.impl.MulticastService.receive(MulticastService.java:109)
at
com.hazelcast.impl.MulticastService.run(MulticastService.java:88)
at java.lang.Thread.run(Thread.java:595)
java.io.EOFException
at java.io.DataInputStream.readFully(DataInputStream.java:178)
at java.io.DataInputStream.readUTF(DataInputStream.java:565)
at java.io.DataInputStream.readUTF(DataInputStream.java:522)
at com.hazelcast.config.GroupConfig.readData(GroupConfig.java:
119)
at com.hazelcast.config.Config.readData(Config.java:504)
at com.hazelcast.cluster.JoinRequest.readData(JoinRequest.java:
68)
at com.hazelcast.cluster.JoinInfo.readData(JoinInfo.java:51)
at com.hazelcast.cluster.JoinInfo.readFromPacket(JoinInfo.java:
84)
at
com.hazelcast.impl.MulticastService.receive(MulticastService.java:109)
at
com.hazelcast.impl.MulticastService.run(MulticastService.java:88)
at java.lang.Thread.run(Thread.java:595)
java.io.EOFException
at java.io.DataInputStream.readFully(DataInputStream.java:178)
at java.io.DataInputStream.readUTF(DataInputStream.java:565)
at java.io.DataInputStream.readUTF(DataInputStream.java:522)
at com.hazelcast.config.GroupConfig.readData(GroupConfig.java:
119)
at com.hazelcast.config.Config.readData(Config.java:504)
at com.hazelcast.cluster.JoinRequest.readData(JoinRequest.java:
68)
at com.hazelcast.cluster.JoinInfo.readData(JoinInfo.java:51)
at com.hazelcast.cluster.JoinInfo.readFromPacket(JoinInfo.java:
84)
at
com.hazelcast.impl.MulticastService.receive(MulticastService.java:109)
at
com.hazelcast.impl.MulticastService.run(MulticastService.java:88)
at java.lang.Thread.run(Thread.java:595)
java.io.EOFException
at java.io.DataInputStream.readFully(DataInputStream.java:178)
at java.io.DataInputStream.readUTF(DataInputStream.java:565)
at java.io.DataInputStream.readUTF(DataInputStream.java:522)
at com.hazelcast.config.GroupConfig.readData(GroupConfig.java:
119)
at com.hazelcast.config.Config.readData(Config.java:504)
at com.hazelcast.cluster.JoinRequest.readData(JoinRequest.java:
68)
at com.hazelcast.cluster.JoinInfo.readData(JoinInfo.java:51)
at com.hazelcast.cluster.JoinInfo.readFromPacket(JoinInfo.java:
84)
at
com.hazelcast.impl.MulticastService.receive(MulticastService.java:109)
at
com.hazelcast.impl.MulticastService.run(MulticastService.java:88)
at java.lang.Thread.run(Thread.java:595)

It seems HC-1.9.1 build is not working with hibernate 3.3.x /3.2.x. Or
are we doing something wrong? Please help

Thanks and regards,

On Jan 17, 6:04 pm, Mehmet Dogan <mehmetdog...@gmail.com> wrote:
> yes its problem of build 1.9. just try 1.9.1
>
> and there is a thread about it :)http://groups.google.com/group/hazelcast/browse_thread/thread/1aef243...
>
> @mm
>
> On Jan 17, 2011, at 3:00 PM, Fuad Malikov wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > Can you try Hazelcast 1.9.1 instead of 1.9.
>
> > Fuad
>
> > For more options, visit this group athttp://groups.google.com/group/hazelcast?hl=en.

Fuad Malikov

unread,
Jan 17, 2011, 11:52:00 AM1/17/11
to haze...@googlegroups.com, Hazelcast
Pls make sure you have correctly switched to 1.9.1. The log states that there is a different version in network

@fuadm

santhosh TR

unread,
Jan 17, 2011, 11:31:37 PM1/17/11
to Hazelcast
hi fuadm,

yes, there was an issue with my build file. Its working now but still
have issues with hibernate3.3.x.

thanks and regards
San

On Jan 17, 9:52 pm, Fuad Malikov <f...@hazelcast.com> wrote:
> Pls make sure you have correctly switched to 1.9.1. The log states that there is a different version in network
>
> @fuadm
>

santhosh TR

unread,
Jan 18, 2011, 6:22:25 AM1/18/11
to Hazelcast
Hi mm/fuadm/All,

Right now were concentrating on the L2 cache capabilities of HC.
Please have a look at our hibernate.cfg.xml
<property name="hibernate.show_sql">true</property>
<property name="hibernate.cache.use_second_level_cache">true</
property>
<property name="hibernate.cache.use_query_cache">true</property>
<property name="hibernate.cache.use_minimal_puts">true</property>
<property
name="hibernate.cache.provider_class">com.hazelcast.hibernate.provider.HazelcastCacheProvider</
property>

But in performance wise we are not able to gain any thing
significantly. Please see our console

INFO: [dev] Address[192.168.3.59:5701] is STARTING
Jan 18, 2011 4:30:36 PM com.hazelcast.impl.Node
INFO: [dev]


Members [1] {
Member [192.168.3.59:5701] this
}

Jan 18, 2011 4:30:36 PM com.hazelcast.impl.LifecycleServiceImpl
INFO: [dev] Address[192.168.3.59:5701] is STARTED
Jan 18, 2011 4:30:36 PM
com.hazelcast.hibernate.provider.HazelcastCache
INFO: Creating new HazelcastCache with region name:
com.ibsplc.tcc.poc.spring.contact.form.Contact
Jan 18, 2011 4:30:37 PM
com.hazelcast.hibernate.provider.HazelcastCache
INFO: Creating new HazelcastCache with region name:
org.hibernate.cache.UpdateTimestampsCache
Jan 18, 2011 4:30:37 PM
com.hazelcast.hibernate.provider.HazelcastCache
INFO: Creating new HazelcastCache with region name:
org.hibernate.cache.StandardQueryCache
Jan 18, 2011 4:30:37 PM org.apache.catalina.startup.HostConfig
deployDirectory
INFO: Deploying web application directory back
Jan 18, 2011 4:30:37 PM org.apache.catalina.startup.HostConfig
deployDirectory
INFO: Deploying web application directory docs
Jan 18, 2011 4:30:38 PM org.apache.catalina.startup.HostConfig
deployDirectory
INFO: Deploying web application directory examples
Jan 18, 2011 4:30:38 PM org.apache.catalina.startup.HostConfig
deployDirectory
INFO: Deploying web application directory ROOT
Jan 18, 2011 4:30:38 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8090
Jan 18, 2011 4:30:38 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Jan 18, 2011 4:30:38 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/32 config=null
Jan 18, 2011 4:30:38 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 10113 ms
Hibernate: select contact0_.ID as ID0_, contact0_.FIRSTNAME as
FIRSTNAME0_, contact0_.LASTNAME as LASTNAME0_, contact0_.EMAIL as
EMAIL0_, contact0_.TELEPHONE as TELEPHONE0_ from CONTACTS contact0_
------------------------------------------ >>>>> 71.374
Hibernate: select contact0_.ID as ID0_, contact0_.FIRSTNAME as
FIRSTNAME0_, contact0_.LASTNAME as LASTNAME0_, contact0_.EMAIL as
EMAIL0_, contact0_.TELEPHONE as TELEPHONE0_ from CONTACTS contact0_
------------------------------------------ >>>>> 62.842
Hibernate: select contact0_.ID as ID0_, contact0_.FIRSTNAME as
FIRSTNAME0_, contact0_.LASTNAME as LASTNAME0_, contact0_.EMAIL as
EMAIL0_, contact0_.TELEPHONE as TELEPHONE0_ from CONTACTS contact0_
------------------------------------------ >>>>> 62.795

In the POC(Spring MVC 3.0 application,Hibernate-3.2.0,HC-1.9.1), we
are firing a HQL statement (with out any criteria) from a table which
has 10000 rows(MySQL). Ideally in subsequent fetches there should be
some significant gain in performance, but we are not able to achieve
any thing. POC is showing only a 5-6 seconds gain. Are we doing some
thing wrong?
> ...
>
> read more »

Mehmet Dogan

unread,
Jan 18, 2011, 7:39:50 AM1/18/11
to haze...@googlegroups.com
In Hibernate queries are not cached by default, you should explicitly set Query.setCacheable(true) for every query that you wish to be cached to get query cache gain. 
And also you should set cache properties for entities those are result of your query; 

@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "mydummyregion"

OR

<class-cache usage="read-write" class="com.hazelcast.hibernate.model.DummyModel"/>  


@mm

santhosh TR

unread,
Jan 18, 2011, 9:10:20 AM1/18/11
to Hazelcast
Hi mm,

Thanks a lot... i really missed to add "Query.setCacheable(true)" in
our DAO. I have a few doubts more. For a "select *" statement for
10000 records, it shows considerable improvement in my first node. But
when the second one joins, its again degrading (even then we are
seeing about 50% gain, but the first time hit to DB is expensive now).
is there any way to optimize the performance again?

On Jan 18, 5:39 pm, Mehmet Dogan <mehmetdog...@gmail.com> wrote:
> In Hibernate queries are not cached by default, you should explicitly set Query.setCacheable(true) for every query that you wish to be cached to get query cache gain.
> And also you should set cache properties for entities those are result of your query;
>
> @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "mydummyregion")
>
> OR
>
> <class-cache usage="read-write" class="com.hazelcast.hibernate.model.DummyModel"/>  
>
> @mm
>
> On Jan 18, 2011, at 1:22 PM, santhosh TR wrote:
>
>
>
>
>
>
>
> > Hi mm/fuadm/All,
>
> > Right now were concentrating on the L2 cache capabilities of HC.
> > Please have a look at our hibernate.cfg.xml
> >                <property name="hibernate.show_sql">true</property>
> >            <property name="hibernate.cache.use_second_level_cache">true</
> > property>
> >            <property name="hibernate.cache.use_query_cache">true</property>
> >            <property name="hibernate.cache.use_minimal_puts">true</property>
> >            <property
> > name="hibernate.cache.provider_class">com.hazelcast.hibernate.provider.Haze lcastCacheProvider</
> ...
>
> read more »

Mehmet Dogan

unread,
Jan 19, 2011, 2:34:35 AM1/19/11
to haze...@googlegroups.com
Hi,

I guess it is because your 10000 records data has been distributed into 2 nodes. And when you get all (select *) nearly half of data will be serialized through other node.
You can configure near cache that will have some help to decrease performance penalty.


@mm

santhosh TR

unread,
Jan 19, 2011, 10:50:01 AM1/19/11
to Hazelcast
Hi mm/fuadm/All,

Thanks a lot for your support.
We are still experimenting with our POC (But now only a single
node :)) and would like quote our preliminary test results.
Currently we have 2 scenarios, with a load of 5000 rows in a single
table.
A) With out L2 cache enabled
B) L2 Cache enabled with HC


A) With out L2 cache enabled
-------------------------------------------
our POC took 28 - 29 seconds to query data from table.

B) L2 Cache enabled with HC
-------------------------------------------
For the first DB hit, our POC is taking 40 to 42 seconds
In the subsequent fetches it is taking 21 to 23 seconds

Its this the expected result from HC as l2 Cache (no significant
performance gain)? Or are we doing something wrong? need your advise

Thanks and regards
> ...
>
> read more »

Mehmet Dogan

unread,
Jan 19, 2011, 11:21:28 AM1/19/11
to haze...@googlegroups.com
  • How does your entity class look like? How much its size?
  • Does it have a complex object graph?
  • Does it have any other referenced entity? If yes, is it also cache enabled?
  • Does it have any collection reference? If yes, is entity inside collection cache enabled?


@mm

santhosh TR

unread,
Jan 19, 2011, 10:45:38 PM1/19/11
to Hazelcast
Hi mm,

for the purpose of POC, we have only one entity mapped to a table. It
does not have a complex object graph.



On Jan 19, 9:21 pm, Mehmet Dogan <mehmetdog...@gmail.com> wrote:
> How does your entity class look like? How much its size?
> Does it have a complex object graph?

This is our entity

@Entity
@Table(name="CONTACTS")
@Cache(usage =
CacheConcurrencyStrategy.READ_WRITE,region="com.tcc.poc.spring.contact.form.Contact")
public class Contact implements Serializable{

@Id
@Column(name="ID")
@GeneratedValue
private Integer id;

@Column(name="FIRSTNAME")
private String firstname;

@Column(name="LASTNAME")
private String lastname;

@Column(name="EMAIL")
private String email;

@Column(name="TELEPHONE")
private String telephone;


public String getEmail() {
return email;
}
public String getTelephone() {
return telephone;
}
public void setEmail(String email) {
this.email = email;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public String getFirstname() {
return firstname;
}
public String getLastname() {
return lastname;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public void setLastname(String lastname) {
this.lastname = lastname;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}

}



> Does it have any other referenced entity? If yes, is it also cache enabled?

We don't have any reference entity...

> Does it have any collection reference? If yes, is entity inside collection cache enabled?
>

No


Our L2 cache configuration is (hibernate.cfg)
--------------------------------------------------------------------

<property name="hibernate.show_sql">true</property>
<property name="hibernate.cache.use_second_level_cache">true</
property>
<property name="hibernate.cache.use_query_cache">true</property>
<property name="hibernate.cache.use_minimal_puts">true</property>
<property name="hibernate.generate_statistics">true</property>
<property
name="hibernate.cache.provider_class">com.hazelcast.hibernate.provider.HazelcastCacheProvider</
property>


Hibernate query
-----------------------
Query query =
sessionFactory.getCurrentSession().createQuery("from Contact");
query.setCacheable(true);
List<Contact> conList =query.list();
> ...
>
> read more »

Mehmet Dogan

unread,
Jan 20, 2011, 7:17:44 AM1/20/11
to haze...@googlegroups.com
I have tried your exact case using both hibernate-3.2.0 and hibernate-3.5.2.
(System: local Mysql db, 64-bit os, java 6)

For one node, cost of loading 50000 objects are nearly:

1st run: 14590ms
2nd run: 4410ms
3rd run: 1600ms

For two nodes, cost of loading 50000 objects are nearly: (2nd node is more slow because at start all data is on 1st node)

1st node / 1st run: 45500ms
1st node / 2nd run: 6300ms
1st node / 3rd run: 2500ms

2nd node / 1st run: 48500ms
2nd node / 2nd run: 16500ms
2nd node / 3rd run: 15600ms


@mm


> ...
>
> read more »

santhosh TR

unread,
Jan 20, 2011, 6:33:13 AM1/20/11
to Hazelcast
Hi mm,

We are seeing the following exception in one of the HZ node

Jan 20, 2011 2:48:57 PM com.hazelcast.nio.WriteHandler
SEVERE: [dev] Fatal Error at WriteHandler for endPoint:
Address[127.0.0.1:3371]
java.lang.RuntimeException: Packet is already released!
at com.hazelcast.impl.Node$1.onRelease(Node.java:173)
at com.hazelcast.impl.Node$1.onRelease(Node.java:169)
at
com.hazelcast.util.NoneStrictObjectPool.release(NoneStrictObjectPool.java:
33)
at com.hazelcast.nio.WriteHandler.handle(WriteHandler.java:99)
at com.hazelcast.nio.SelectorBase.run(SelectorBase.java:133)
at java.lang.Thread.run(Thread.java:619)
java.lang.RuntimeException: Packet is already released!
at com.hazelcast.impl.Node$1.onRelease(Node.java:173)
at com.hazelcast.impl.Node$1.onRelease(Node.java:169)
at
com.hazelcast.util.NoneStrictObjectPool.release(NoneStrictObjectPool.java:
33)
at com.hazelcast.nio.WriteHandler.handle(WriteHandler.java:99)
at com.hazelcast.nio.SelectorBase.run(SelectorBase.java:133)
at java.lang.Thread.run(Thread.java:619)
Jan 20, 2011 2:48:57 PM com.hazelcast.cluster.ClusterService
SEVERE: [dev] error processing messages packet=Packet [HEARTBEAT]
name=heartbeat, connection=Connection [/192.168.3.59:3283 ->
Address[192.168.3.59:5702]] live=true, client=false,
type=MEMBER,blockId=-1, keySize=0, valueSize=0 client=false
java.lang.RuntimeException: Packet is already released!
at com.hazelcast.impl.Node$1.onRelease(Node.java:173)
at com.hazelcast.impl.Node$1.onRelease(Node.java:169)
at
com.hazelcast.util.NoneStrictObjectPool.release(NoneStrictObjectPool.java:
33)
at
com.hazelcast.impl.BaseManager.releasePacket(BaseManager.java:1195)
at com.hazelcast.cluster.ClusterManager.access
$200(ClusterManager.java:34)
at com.hazelcast.cluster.ClusterManager
$4.process(ClusterManager.java:82)
at
com.hazelcast.cluster.ClusterService.processPacket(ClusterService.java:
146)
at
com.hazelcast.cluster.ClusterService.dequeuePackets(ClusterService.java:
192)

we are not sure what is happening. We got this error after keeping the
cluster nodes idle for some time, i think.

Thanks and regards
SAN

On Jan 20, 8:45 am, santhosh TR <santhosh.re...@gmail.com> wrote:
> Hi mm,
>
> for the purpose of POC, we have only one entity mapped to a table. It
> does not have a complex object graph.
>
> On Jan 19, 9:21 pm, Mehmet Dogan <mehmetdog...@gmail.com> wrote:
>
> > How does your entity class look like? How much its size?
> > Does it have a complex object graph?
>
> This is our entity
>
> @Entity
> @Table(name="CONTACTS")
> @Cache(usage =
> CacheConcurrencyStrategy.READ_WRITE,region="com.tcc.poc.spring.contact.form .Contact")
> name="hibernate.cache.provider_class">com.hazelcast.hibernate.provider.Haze lcastCacheProvider</
> ...
>
> read more »

santhosh TR

unread,
Jan 20, 2011, 8:30:27 AM1/20/11
to Hazelcast
hi mm,

we are getting one more exception too... this is happened when we
switch to <near-cache>

Jan 20, 2011 6:53:19 PM com.hazelcast.nio.WriteHandler
SEVERE: [dev] Fatal Error at WriteHandler for endPoint:
Address[127.0.0.1:2070]
java.lang.RuntimeException: Packet is already released!
at com.hazelcast.impl.Node$1.onRelease(Node.java:173)
at com.hazelcast.impl.Node$1.onRelease(Node.java:169)
at
com.hazelcast.util.NoneStrictObjectPool.release(NoneStrictObjectPool.java:
33)
at com.hazelcast.nio.WriteHandler.handle(WriteHandler.java:99)
at com.hazelcast.nio.SelectorBase.run(SelectorBase.java:133)
at java.lang.Thread.run(Thread.java:619)
java.lang.RuntimeException: Packet is already released!
at com.hazelcast.impl.Node$1.onRelease(Node.java:173)
at com.hazelcast.impl.Node$1.onRelease(Node.java:169)
at
com.hazelcast.util.NoneStrictObjectPool.release(NoneStrictObjectPool.java:
33)
at com.hazelcast.nio.WriteHandler.handle(WriteHandler.java:99)
at com.hazelcast.nio.SelectorBase.run(SelectorBase.java:133)
at java.lang.Thread.run(Thread.java:619)
Jan 20, 2011 6:53:19 PM com.hazelcast.client.InRunnable
SEVERE: In Thread can not handle: RESPONSE : 89
Jan 20, 2011 6:53:19 PM com.hazelcast.client.ConnectionManager
WARNING: Connection to Connection [0] [localhost/127.0.0.1:5701 ->
127.0.0.1:5701] is lost
java.nio.BufferOverflowException
at java.nio.Buffer.nextPutIndex(Buffer.java:501)
at java.nio.HeapByteBuffer.putLong(HeapByteBuffer.java:398)
at com.hazelcast.nio.Packet.onEnqueue(Packet.java:180)
at
com.hazelcast.nio.WriteHandler.enqueueSocketWritable(WriteHandler.java:
65)
at com.hazelcast.impl.BaseManager.writePacket(BaseManager.java:
1455)
at
com.hazelcast.impl.BaseManager.sendOrReleasePacket(BaseManager.java:
1438)
at
com.hazelcast.cluster.ClusterManager.heartBeater(ClusterManager.java:
242)
at com.hazelcast.cluster.ClusterManager
$1.run(ClusterManager.java:64)
at
com.hazelcast.cluster.ClusterService.checkPeriodics(ClusterService.java:
272)
at
com.hazelcast.cluster.ClusterService.run(ClusterService.java:169)
at java.lang.Thread.run(Thread.java:619)
Jan 20, 2011 6:53:19 PM com.hazelcast.cluster.ClusterManager
SEVERE: [dev] null
java.nio.BufferOverflowException
at java.nio.Buffer.nextPutIndex(Buffer.java:501)
at java.nio.HeapByteBuffer.putLong(HeapByteBuffer.java:398)
at com.hazelcast.nio.Packet.onEnqueue(Packet.java:180)
at
com.hazelcast.nio.WriteHandler.enqueueSocketWritable(WriteHandler.java:
65)
at com.hazelcast.impl.BaseManager.writePacket(BaseManager.java:
1455)
at
com.hazelcast.impl.BaseManager.sendOrReleasePacket(BaseManager.java:
1438)
at
com.hazelcast.cluster.ClusterManager.heartBeater(ClusterManager.java:
242)
at com.hazelcast.cluster.ClusterManager
$1.run(ClusterManager.java:64)
at
com.hazelcast.cluster.ClusterService.checkPeriodics(ClusterService.java:
272)
at
com.hazelcast.cluster.ClusterService.run(ClusterService.java:169)
at java.lang.Thread.run(Thread.java:619)


Thanks and Regards,
SAN
> > CacheConcurrencyStrategy.READ_WRITE,region="com.tcc.poc.spring.contact.form .Contact")
> > name="hibernate.cache.provider_class">com.hazelcast.hibernate.provider.Haze lcastCacheProvider</
> ...
>
> read more »

santhosh TR

unread,
Jan 20, 2011, 4:45:21 AM1/20/11
to Hazelcast
Hi MM,

unacceptable results from hazelcast was due to some "MISTAKE FROM OUR
SIDE", really "SORRY FOR QUOTING WORNG RESULTS".

1. We were running on java 1.5, now switched to java 1.6
2. POC was log enabled, with out any filter, all the execution time
was eaten up by our logger.

Now our POC shows drastic performance "IMPROVEMENT"

1. HazelCast as L2 cache (not in clustor)
-----------------------------------------------------------------------------------------------------------------

We are able to retrieve from cache in .3 to .4 secs

2. HazelCast as L2 cache (in clustor, 5000 records,splitted across 3
nodes)
-----------------------------------------------------------------------------------------------------------------
We are able to retrieve from cache in 1 to 2 secs


Thanks and regards

On Jan 20, 8:45 am, santhosh TR <santhosh.re...@gmail.com> wrote:
> Hi mm,
>
> for the purpose of POC, we have only one entity mapped to a table. It
> does not have a complex object graph.
>
> On Jan 19, 9:21 pm, Mehmet Dogan <mehmetdog...@gmail.com> wrote:
>
> > How does your entity class look like? How much its size?
> > Does it have a complex object graph?
>
> This is our entity
>
> @Entity
> @Table(name="CONTACTS")
> @Cache(usage =
> CacheConcurrencyStrategy.READ_WRITE,region="com.tcc.poc.spring.contact.form .Contact")
> name="hibernate.cache.provider_class">com.hazelcast.hibernate.provider.Haze lcastCacheProvider</
> ...
>
> read more »

Fuad Malikov

unread,
Jan 21, 2011, 3:31:37 PM1/21/11
to haze...@googlegroups.com
Hi San, 

Packet is allready released is a known issue and is fixed with 1.9.2-RC. Please try that. 

> ...
>
> read more »

--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To post to this group, send email to haze...@googlegroups.com.
To unsubscribe from this group, send email to hazelcast+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hazelcast?hl=en.




--

@fuadm

santhosh TR

unread,
Jan 24, 2011, 12:29:53 AM1/24/11
to Hazelcast
Hi Faud/mm,

We are now working with HZ-1.9.2-RC, its working. Thank you all.

But now we are facing another issue, as per documentation - to avoid
network trips - we configured our cache as "NEAR CACHE". But the HC-
Monitor shows the objects in my cache are still distributed across the
nodes. Please have a look at the near cache configuration.

<map name="com.ibsplc.tcc.poc.spring.contact.form.Contact">
<near-cache>
<backup-count>1</backup-count>
<eviction-policy>LRU</eviction-policy>
<max-size>15000</max-size>
<eviction-percentage>25</eviction-
percentage>
<merge-policy>hz.ADD_NEW_ENTRY</merge-
policy>
<time-to-live-seconds>0</time-to-live-
seconds>
<max-idle-seconds>60</max-idle-seconds>
<invalidate-on-change>true</invalidate-on-
change>
</near-cache>
</map>

is it the right way to configure near cache? Please help

Regards,
San



On Jan 22, 1:31 am, Fuad Malikov <f...@hazelcast.com> wrote:
> Hi San,
>
> Packet is allready released is a known issue and is fixed with 1.9.2-RC.
> Please try that.
>
> ...
>
> read more »

Fuad Malikov

unread,
Jan 24, 2011, 2:29:37 AM1/24/11
to haze...@googlegroups.com
Hi,

This is normal behavior. Hazelcast will allways distribute your data among the members. However enabling near-cache will cache the objects at each node that are not owned by that node itself. 

Fuad 

> ...
>
> read more »

--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To post to this group, send email to haze...@googlegroups.com.
To unsubscribe from this group, send email to hazelcast+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hazelcast?hl=en.




--

@fuadm

santhosh TR

unread,
Jan 24, 2011, 5:11:49 AM1/24/11
to Hazelcast
Hi Fuadm/mm/All,

After a long period of inactivity, say 2-3 hrs one of my cluster
node(manager node) started to poll continuously(I think to find
peers). Please have a look at the console log. We are working with
"HC-1.9.2-rc2"


Jan 24, 2011 1:01:12 PM com.hazelcast.impl.Node
WARNING: [dev] Packet is already released.
Jan 24, 2011 1:01:27 PM com.hazelcast.client.ProxyHelper
INFO: There is no response for Call [5707] operation=GET_MEMBERS in 5
seconds.
Jan 24, 2011 1:01:32 PM com.hazelcast.client.ProxyHelper
INFO: There is no response for Call [5707] operation=GET_MEMBERS in 10
seconds.
Jan 24, 2011 1:01:37 PM com.hazelcast.client.ProxyHelper
INFO: There is no response for Call [5707] operation=GET_MEMBERS in 15
seconds.
Jan 24, 2011 1:01:42 PM com.hazelcast.client.ProxyHelper
INFO: There is no response for Call [5707] operation=GET_MEMBERS in 20
seconds.
Jan 24, 2011 1:01:47 PM com.hazelcast.client.ProxyHelper
INFO: There is no response for Call [5707] operation=GET_MEMBERS in 25
seconds.
Jan 24, 2011 1:01:52 PM com.hazelcast.client.ProxyHelper
INFO: There is no response for Call [5707] operation=GET_MEMBERS in 30
seconds.
Jan 24, 2011 1:01:57 PM com.hazelcast.client.ProxyHelper
INFO: There is no response for Call [5707] operation=GET_MEMBERS in 35
seconds.
Jan 24, 2011 1:02:02 PM com.hazelcast.client.ProxyHelper
INFO: There is no response for Call [5707] operation=GET_MEMBERS in 40
seconds.
Jan 24, 2011 1:02:07 PM com.hazelcast.client.ProxyHelper
INFO: There is no response for Call [5707] operation=GET_MEMBERS in 45
seconds.
Jan 24, 2011 1:02:12 PM com.hazelcast.client.ProxyHelper
INFO: There is no response for Call [5707] operation=GET_MEMBERS in 50
seconds.
Jan 24, 2011 1:02:17 PM com.hazelcast.client.ProxyHelper
INFO: There is no response for Call [5707] operation=GET_MEMBERS in 55
seconds.
Jan 24, 2011 1:02:22 PM com.hazelcast.client.ProxyHelper
INFO: There is no response for Call [5707] operation=GET_MEMBERS in 60
seconds.
Jan 24, 2011 1:02:27 PM com.hazelcast.client.ProxyHelper
INFO: There is no response for Call [5707] operation=GET_MEMBERS in 65
seconds.
Jan 24, 2011 1:02:32 PM com.hazelcast.client.ProxyHelper
INFO: There is no response for Call [5707] operation=GET_MEMBERS in 70
seconds.
Jan 24, 2011 1:02:37 PM com.hazelcast.client.ProxyHelper
INFO: There is no response for Call [5707] operation=GET_MEMBERS in 75
seconds.
Jan 24, 2011 1:02:42 PM com.hazelcast.client.ProxyHelper

Please help

On Jan 24, 12:29 pm, Fuad Malikov <f...@hazelcast.com> wrote:
> Hi,
>
> This is normal behavior. Hazelcast will allways distribute your data among
> the members. However enabling near-cache will cache the objects at each node
> that are not owned by that node itself.
>
> Fuad
>
> ...
>
> read more »

Talip Ozturk

unread,
Jan 24, 2011, 9:47:52 AM1/24/11
to haze...@googlegroups.com
> Jan 24, 2011 1:01:12 PM com.hazelcast.impl.Node
> WARNING: [dev] Packet is already released.
> Jan 24, 2011 1:01:27 PM com.hazelcast.client.ProxyHelper
> INFO: There is no response for Call [5707] operation=GET_MEMBERS in 5
> seconds.


On this JVM, you are running a normal Hazelcast member. On this JVM do
you also have HazelcastClient or Monitoring Tool running? Can you
also tell us the hazelcast build-date? I am also assuming that all
your JVMs are using the 1.9.2-RC jars for sure..

-talip

santhosh TR

unread,
Jan 24, 2011, 11:51:08 PM1/24/11
to Hazelcast
Hi ,

Please see my answers to your questions ...

> On this JVM, you are running a normal Hazelcast member.

Yes

> On this JVM do you also have HazelcastClient or Monitoring Tool running?

Yes

> Can you also tell us the hazelcast build-date?

2011/01/19

> I am also assuming that all your JVMs are using the 1.9.2-RC jars for sure..

Yes

Fuad Malikov

unread,
Jan 25, 2011, 1:52:19 AM1/25/11
to haze...@googlegroups.com
The problem seems to be related to the client. There is a call that is made from client and it can not get the response. So are you using client or monitoring tool. I guess it is monitoring tool. What happens when you undeploy it. Does it effect your cluster(Hazelcast nodes)?

Fuad

--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To post to this group, send email to haze...@googlegroups.com.
To unsubscribe from this group, send email to hazelcast+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hazelcast?hl=en.




--

@fuadm

santhosh TR

unread,
Jan 25, 2011, 8:48:03 AM1/25/11
to Hazelcast
Hi,

HZ monitor was running on the same node, but we are not able to
reproduce the scenario now. Our set up is showing any issues :)

Thanks and regards,
san


On Jan 25, 11:52 am, Fuad Malikov <f...@hazelcast.com> wrote:
> The problem seems to be related to the client. There is a call that is made
> from client and it can not get the response. So are you using client or
> monitoring tool. I guess it is monitoring tool. What happens when you
> undeploy it. Does it effect your cluster(Hazelcast nodes)?
>
> Fuad
>
> > hazelcast+...@googlegroups.com<hazelcast%2Bunsu...@googlegroups.com>
> > .

Vikas Sharma

unread,
Feb 13, 2015, 4:37:14 AM2/13/15
to haze...@googlegroups.com
Where should  i set cache properties for entities .Previously I was using ehcache as cache provider .There was a file ehcache.xml in which i can define cache properties for entities as well as cache property for cache regions as well . But in case of hazelcast i dont know .There is no such file.Nothing is given in the doc as well.
I am using query cache with hazelcast 3.1.7.And i want to configure cache regions for it.Please help .Thanks
...

Vikas Sharma

unread,
Feb 13, 2015, 4:42:59 AM2/13/15
to haze...@googlegroups.com
Every hazelcast entity is cached in a hazelcast map. So you can configure backup, eviction, TTL and near cache for those maps in hazelcast.xml. If you do not specify any configuration for a map then default config will be used. (Map name in configuration is name of your hibernate entity.

I have my applicationContext-hazelcast.xml file for hazelcast maps.
In this i have defined a map like below:-

  <hz:map name="com.demo.entity.Program"
               backup-count="1"
               max-size="100"
               eviction-percentage="0"
               read-backup-data="true"
               
               eviction-policy="LRU"
               merge-policy="hz.ADD_NEW_ENTRY"
               time-to-live-seconds="0">              
       </hz:map>

Here Program is my entity.

But its not working.Am i wrong.?Please correct me.


for a map then default config will be used. (Map name in configuration is name of your hibernate entity.
On Friday, January 14, 2011 at 9:06:54 PM UTC+5:30, mmdogan wrote:
Hi,

In simplest form first set some hibernate properties (either in hibernate.cfg.xml or hibernate.properties or spring config xml etc..);
  • set hibernate.cache.use_second_level_cache => true
  • if you want query cache set hibernate.cache.use_query_cache => true 
  • if your hibernate version is prior to 3.3.x then set hibernate.cache.provider_class => com.hazelcast.hibernate.provider.HazelcastCacheProvider else set hibernate.cache.region.factory_class => com.hazelcast.hibernate.HazelcastCacheRegionFactory
Assuming you already know hibernate L2 cache configurations.
Then put hazelcast-hibernate-x.y.z.jar and hazelcast.xml into your classpath.
Every hazelcast entity is cached in a hazelcast map. So you can configure backup, eviction, TTL and near cache for those maps in hazelcast.xml. If you do not specify any configuration for a map then default config will be used. (Map name in configuration is name of your hibernate entity.)

On Fri, Jan 14, 2011 at 15:42, santhosh TR <santhos...@gmail.com> wrote:
Hi All,

Here we were looking for some efficient alter native for terracotta/
coherence. HC seems to be a very good option for us and we are in the
process of evaluating HC for our products. We are mainly looking into
two main features,

1. Distributed Data Structures and
2. L2 Cache for Hibernate.

But from the documentation (http://hazelcast.com/
documentation.jsp#HibernateSecondLevelCache) it is not clear the steps
required to configure HazelCast as l2 cache. Can any one here please
guide me how to configure the same? I'm really looking forward for
some expert advice :).
--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To post to this group, send email to haze...@googlegroups.com.
To unsubscribe from this group, send email to hazelcast+...@googlegroups.com.

Emrah Kocaman

unread,
Feb 13, 2015, 4:57:01 AM2/13/15
to haze...@googlegroups.com

To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+...@googlegroups.com.

To post to this group, send email to haze...@googlegroups.com.

Vikas Sharma

unread,
Feb 13, 2015, 5:30:16 AM2/13/15
to haze...@googlegroups.com
Thanks a lot Emrah .
I have checked it.I have defined hazelcast.xml in the root of my application.
Now i dont know how to configure cache regions in it.
I have defined it on my entity.Now for query caching of hibernate what should i write in hazelcast.xml.
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "dummyregion")

i have done below configuration:-

  <hz:map name="dummyregion"
               backup-count="1"
               max-size="100"
               eviction-percentage="0"
               read-backup-data="true"
    
               eviction-policy="LRU"
               merge-policy="hz.ADD_NEW_ENTRY"
               time-to-live-seconds="0">              
       </hz:map> 
 
Is it correct

Vikas Sharma

unread,
Mar 31, 2015, 8:50:20 AM3/31/15
to haze...@googlegroups.com
  How can i set the cache properties for the  region ="mydummyregion" ? I have searched the entire doc of hazelcast but unable to get the answer of this.
  Kindly please tell if you have any idea.

  Thanks



...
Reply all
Reply to author
Forward
0 new messages