Hazelcast JCache to load all data in every node

118 views
Skip to first unread message

Ashok KS

unread,
Dec 18, 2017, 10:58:33 PM12/18/17
to Hazelcast
Hi All,

I'm new to Hazelcast and tried to setup JCache for one of the project.
Currently if I add 10 entries and when 2 Nodes running, then the data is divided between the nodes as 5 each.

But my requirement is to have all the nodes have the entire data from memory. And any update should be synced.
Is this possible in Hazlecast?

Thanks in advance.

Regards,
Ashok

oz...@hazelcast.com

unread,
Dec 19, 2017, 3:48:04 AM12/19/17
to Hazelcast
Hi Ashok, 

replicating data on all members is not supported for JCache. 
You can achieve your requirements via ReplicatedMap data structure. See docs: http://docs.hazelcast.org/docs/3.9.1/manual/html-single/index.html#replicated-map

Or you could use IMap and configure Near Cache for all members. Docs: http://docs.hazelcast.org/docs/3.9.1/manual/html-single/index.html#near-cache

Vassilis Bekiaris

unread,
Dec 19, 2017, 3:59:52 AM12/19/17
to haze...@googlegroups.com
Hi Ashok,

apart from the options to use ReplicatedMap or IMap with near cache, as described by Ozan, if you still want to use the JCache API you can use JCache with a near-cache on a Hazelcast client, so you can enjoy the benefits of scalable partitioned storage and have your hot entries in a local near-cache. The link provided by Ozan describes near cache for JCache as well, just take into account that JCache near cache is only available on Hazelcast client.

Cheers,
Vassilis

-- 
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
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.
Visit this group at https://groups.google.com/group/hazelcast.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/0888ff91-6acf-4a91-aba4-a41ce1ecbda8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ashok KS

unread,
Dec 19, 2017, 6:05:48 PM12/19/17
to Hazelcast
Hi Ozan and Vassillis,

Thanks a lot for your response.
I'm actually more confused now. 

What is the difference between a Hazelcast client and a member?

Currently I create an Hazelcast instance using HazelcastInstance hz = Hazelcast.newHazelcastInstance(cfg);
And then start a Cache by Cache<Integer, String> cache = manager.createCache("users", configuration);

How would I know a member and a client?

Regards,
Ashok

Sertuğ Kaya

unread,
Dec 20, 2017, 4:47:57 AM12/20/17
to Hazelcast
Ashok;

I guess there might be some misunderstanding here, so let me try to clear the fog :)

Yes, Hazelcast distributes your data to members (nodes), so that each member carry equal amount of your data. But this does not mean members can not access to each other's data. You can still do operations on every key you put in the cluster from any of the members or clients you have. 

Hazelcast Clients does not carry any data unlike Members, you can use a client from within your application to talk to your members. That enables you to separate your application from your Hazelcast cluster. 

Instead of doing `Hazelcast.newHazelcastInstance`, you can call `HazelcastClient.newHazelcastClient` and create a client instance easily. Please keep in mind that you'll need to provide a client config which has IP addresses of your Hazelcast members. Feel free to take a look at the docs regarding the member and client setups: http://docs.hazelcast.org/docs/3.9/manual/html-single/index.html#getting-started

If you still need all members have all copy of your data, then you can take a look at Near Cache or Replicated Map as Vassilis and Ozan suggested.


On Tuesday, December 19, 2017 at 6:58:33 AM UTC+3, Ashok KS wrote:
Reply all
Reply to author
Forward
0 new messages