You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Himetic <ca...@theplatform.com> on 2016/09/27 21:37:52 UTC

Configuring ignite distributed hibernate cache

I'm using the hibernate caching ignite provides (as documented here:
https://apacheignite.readme.io/docs/hibernate-l2-cache) and having some
difficulty getting the caching to work in a distributed manner.  It works
fine when the object is cached locally, and it seems to be aware of the
other machine (in the logs it prints:

Metrics for local node (to disable set 'metricsLogFrequency' to 0)
    ^-- Node [id=5ae49faa, name=hibernate-grid, uptime=00:01:00:000]
    ^-- *H/N/C [hosts=2, nodes=2, CPUs=16]*
    ^-- CPU [cur=0.53%, avg=9.92%, GC=0%]
    ^-- Heap [used=986MB, free=45.84%, comm=1597MB]
    ^-- Non heap [used=146MB, free=-1%, comm=150MB]
    ^-- Public thread pool [active=0, idle=16, qSize=0]
    ^-- System thread pool [active=0, idle=16, qSize=0]
    ^-- Outbound messages queue [size=0]

when we start up the second machine, which seems to indicate that it's
reaching the second machine, at least in some capacity.  But when we perform
a GET on one machine, and then on the other, the second machine isn't
hitting the cached value.

I believe we've got it set up for partitioned caching across the hosts. 
Here's the xml for the hosts:

        <property name="discoverySpi">
            <bean
class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
                <property name="localPort" value="48500"/>
                <property name="localPortRange" value="20"/>
                <property name="ipFinder">
                    <bean
class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
                        <property name="addresses">
                            <list>
                                
                                <value>[IP addr 1]:48500..48520</value>
                                <value>[IP addr 2]:48500..48520</value>
                            </list>
                        </property>
                    </bean>
                </property>
            </bean>
        </property>

Each of the caches is set up to extend the transactional parent from the
documentation:

    <bean id="transactional-cache"
class="org.apache.ignite.configuration.CacheConfiguration" abstract="true">
        <property name="cacheMode" value="PARTITIONED"/>
        <property name="atomicityMode" value="TRANSACTIONAL"/>
        <property name="writeSynchronizationMode" value="FULL_SYNC"/>
    </bean>

As I said, the cache itself IS working locally, but it doesn't seem to
actually be partitioning it.  I debugged into the cache retrieval method and
it's going through GridCacheAdapter in Ignite, but ultimately not finding
the value that's supposed to cached already from making the call on the
other machine.  Is there something wrong with our configuration?  Or is
there some other step I missed?  Thanks!



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Configuring-ignite-distributed-hibernate-cache-tp7975.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Configuring ignite distributed hibernate cache

Posted by Himetic <ca...@theplatform.com>.
Excellent, that did the trick!  Thanks a lot for the help.



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Configuring-ignite-distributed-hibernate-cache-tp7975p7982.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Configuring ignite distributed hibernate cache

Posted by vkulichenko <va...@gmail.com>.
Denis,

Agree, I updated the doc.

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Configuring-ignite-distributed-hibernate-cache-tp7975p8067.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Configuring ignite distributed hibernate cache

Posted by Denis Magda <dm...@gridgain.com>.
Val,

Can we add this workaround to our documentation by creating an “attention” block? The block can be removed once the issue is fixed for binary marshaller.

—
Denis

> On Sep 27, 2016, at 3:35 PM, vkulichenko <va...@gmail.com> wrote:
> 
> BTW, as a workaround you can try switching to OptimizedMarshaller. Add this
> to your Ignite config:
> 
> <property name="marshaller">
>    <bean
> class="org.apache.ignite.marshaller.optimized.OptimizedMarshaller"/>
> </property>
> 
> Let me know if it works.
> 
> -Val
> 
> 
> 
> --
> View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Configuring-ignite-distributed-hibernate-cache-tp7975p7977.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: Configuring ignite distributed hibernate cache

Posted by vkulichenko <va...@gmail.com>.
BTW, as a workaround you can try switching to OptimizedMarshaller. Add this
to your Ignite config:

<property name="marshaller">
    <bean
class="org.apache.ignite.marshaller.optimized.OptimizedMarshaller"/>
</property>

Let me know if it works.

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Configuring-ignite-distributed-hibernate-cache-tp7975p7977.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Configuring ignite distributed hibernate cache

Posted by vkulichenko <va...@gmail.com>.
Hi,

Most likely this is caused by this issue:
https://issues.apache.org/jira/browse/IGNITE-3429. Hopefully, someone in the
community will pick it up and fix.

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Configuring-ignite-distributed-hibernate-cache-tp7975p7976.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.