Spring :issue with Connect to Ignite Server Runing on Diff Server.

classic Classic list List threaded Threaded
9 messages Options
Abhishek M Abhishek M
Reply | Threaded
Open this post in threaded view
|

Spring :issue with Connect to Ignite Server Runing on Diff Server.

This post has NOT been accepted by the mailing list yet.
Hi I have one Ignite Cluster Running on Diff Machine. When i start my Spring Project, then its creating one  more node in that cluster. When i shutdown my Spring Application then that node removed from that cluster and i loss my data. Please let me know how i can connect with that cluster(Without creating any node).
yakov yakov
Reply | Threaded
Open this post in threaded view
|

Re: Spring :issue with Connect to Ignite Server Runing on Diff Server.

First of all, starting node in local JVM (process) is the fastest and most reliable way to access the cluster.

As far as behavior you see, it can be observed in two cases:
1. Node you start is a data node. So, when you stop the node data can be lost if no backups are configured for the cache (see org.apache.ignite.configuration.CacheConfiguration#setBackups). If you start node for short period of time, no point of making it a data node. You can start it as a client, so it will not carry data. Just call:
Ignition.setClientMode(true);
Ignition.start(..);

2. The second possible reason is that class definitions of the objects you put into cache are not available on remote nodes and when master node (node initiating put and holding the definitions) exits all other nodes have to cleanup caches. To fix this you can make your classes available on all the nodes - just build a jar and put it to classpath of each jvm involved. Please also turn off peer deployment which is recommended for performance - org.apache.ignite.configuration.IgniteConfiguration#setPeerClassLoadingEnabled
Abhishek M Abhishek M
Reply | Threaded
Open this post in threaded view
|

Re: Spring :issue with Connect to Ignite Server Runing on Diff Server.

This post has NOT been accepted by the mailing list yet.
Hi,

Yes when i set client mode its work fine. but now when i am putting data into cache i am getting that data in heap (checking in heap dump). Server Config and client config is attached. Please let me know how i can put this data out of heap. igniteConfig.txt
yakov yakov
Reply | Threaded
Open this post in threaded view
|

Re: Spring :issue with Connect to Ignite Server Runing on Diff Server.

Please add
<property name="backups" value="1"/>
to your configuration.

Some part of your data can get to the node that you stop after and therefore is lost. Having backup should prevent the loss.
Abhishek M Abhishek M
Reply | Threaded
Open this post in threaded view
|

Re: Spring :issue with Connect to Ignite Server Runing on Diff Server.

This post has NOT been accepted by the mailing list yet.

I set the <property name="backups" value="1"/>. Also i updated the configuration:

<bean class="org.apache.ignite.configuration.CacheConfiguration">
        <property name="startSize" value="3000000"/>
        <property name="rebalanceMode" value="SYNC"/>
        <property name="writeSynchronizationMode" value="FULL_SYNC"/>
        <property name="name" value="replicated_tx"/>
        <property name="cacheMode" value="LOCAL"/>
        <property name="atomicityMode" value="TRANSACTIONAL"/>
        <property name="memoryMode" value="OFFHEAP_TIERED"/> 
        <property name="SwapEnabled" value="true"/> 
        <property name="offHeapMaxMemory" value="#{10 * 1024L * 1024L * 1024L}"/>
        <property name="backups" value="1"/>
</bean>

And cache Configuration is :

CacheConfiguration<Long, CreativeLineItemAdslot> cfg = new CacheConfiguration<Long, CreativeLineItemAdslot>();
cfg.setCacheMode(CacheMode.LOCAL);
cfg.setName(this.getClass().getName());
cfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);
cfg.setIndexedTypes(Long.class, CreativeLineItemAdslot.class);
cfg.setSwapEnabled(Boolean.TRUE);
cfg.setOffHeapMaxMemory(offHeapMemoryMaxSize);
cache = ignite.getOrCreateCache(cfg);

Now When i am puting data in this cache and then checking the heap. I am getting all data in heap dump. Please let me know how i can put the data offHeap. And also how i can check the size of cache(how many key it have).
yakov yakov
Reply | Threaded
Open this post in threaded view
|

Re: Spring :issue with Connect to Ignite Server Runing on Diff Server.

As far as size you can call this method: org.apache.ignite.IgniteCache#size

When you look at your heapdump can you please trace GC roots of your data and let me know? Can you share your heapdump somehow?

Thanks!
Abhishek M Abhishek M
Reply | Threaded
Open this post in threaded view
|

Re: Spring :issue with Connect to Ignite Server Runing on Diff Server.

This post has NOT been accepted by the mailing list yet.
Hi Yakov,

yes now i am able to get size Thank you.

Please find the attache "ignite_config.rar". its contains Spring Client Config, Ignite Server Config , Cache Creation code and heap dump( ignite server heap dump). Dump>>

Abhishek M Abhishek M
Reply | Threaded
Open this post in threaded view
|

Re: Spring :issue with Connect to Ignite Server Runing on Diff Server.

This post has NOT been accepted by the mailing list yet.
Hi any one face the same issue?
yakov yakov
Reply | Threaded
Open this post in threaded view
|

Re: Spring :issue with Connect to Ignite Server Runing on Diff Server.

Even if offheap is configured Ignite uses onheap cache to cache indexed values to avoid extra-deserializaitons.

In your dump you have 6,625 com.toi.expresso.dto.CreativeLineItemAdslot instances. By default org.apache.ignite.configuration.CacheConfiguration#getSqlOnheapRowCacheSize is 10240. Which means all your objects can be fit in cache. Try putting more objects.

Onheap cache size should be tuned individually for each application after getting profiling information.