3

Does someone knows a good java framework for distributed hashmaps (DHT)?

Some time ago I worked with Overlay Weaver, but a good documentation is missing here, so I only used it for an prototype with ugly hacks..., but now I need reliable code. Or does someone found a good docu for OverlayWeaver?

It would be perfect if the dht framework supports Chord or Kademlia and can be called inside my java application.

Or does someone knows a better approach to save reliable and failuresafe short string data in distibuted systems?

heaphach
  • 1,492
  • 1
  • 20
  • 44

4 Answers4

10

I think that Hazelcast works fine for this type of situation. It practically requires no setup (more than that you need to add the dependencies to the Hazelcast jars). The following code sample shows how to setup a shared Map.

// Code in process 1
Config cfg = new Config();
HazelcastInstance instance = Hazelcast.newHazelcastInstance(cfg);
Map<Integer, String> sharedData = instance.getMap("shared");
sharedData.put(1, "This is shared data");

// Code in process 2
Config cfg = new Config();
HazelcastInstance instance = Hazelcast.newHazelcastInstance(cfg);
Map<Integer, String> sharedData = instance.getMap("shared");
String theSharedString = sharedData.get(1);

Hazelcast support various shared data structures including Map, Queue, List, AtomicLong, IdGenerator etc. The documentation is good and in my experience the implementation is solid.

If your are using a sane build environment (e.g. Maven) the following dependency is all that is needed to get started:

<dependency>
    <groupId>com.hazelcast</groupId>
    <artifactId>hazelcast</artifactId>
    <version>3.4</version>
</dependency>
wassgren
  • 18,651
  • 6
  • 63
  • 77
  • Wow hazelcast is really amazing and easy. Thank you for this fast answer :-) – heaphach Jan 07 '15 at 08:59
  • But it seems you can pay for it, so maybe it has some limitations. Do you know the limits of the free version? – heaphach Jan 07 '15 at 11:20
  • Check this out for pricing: http://hazelcast.com/pricing/ - the Open Source alternative does not include support, Tomcat session clustering etc – wassgren Jan 07 '15 at 11:33
  • But is there some rate limiting (e.g. many items in queue) in the free version? That is not mentioned here, so I guess there is none, but I dont know. – heaphach Jan 07 '15 at 11:51
  • I would assume so since it is not mentioned. – wassgren Jan 07 '15 at 11:55
2

Try Hazelcast.It is open-source and has Enterprise support.

gorkemgok
  • 66
  • 1
  • 2
0

Give a try to Redisson PRO. It supports sharded maps.

Nikita Koksharov
  • 10,283
  • 1
  • 62
  • 71
0

You can also check Apache Ignite . It supports In-memory distributed key-value store, Distributed Tasks, Durable Memory, Distributed Locks etc. It also support ANSI-99 complaint distributed SQLs.

Getting started is as simple as adding maven dependencies -

<dependency>
    <groupId>org.apache.ignite</groupId>
    <artifactId>ignite-core</artifactId>
    <version>${ignite.version}</version>
</dependency>
<dependency>
    <groupId>org.apache.ignite</groupId>
    <artifactId>ignite-spring</artifactId>
    <version>${ignite.version}</version>
</dependency>
<dependency>
    <groupId>org.apache.ignite</groupId>
    <artifactId>ignite-indexing</artifactId>
    <version>${ignite.version}</version>
</dependency>
Pankaj
  • 2,220
  • 1
  • 19
  • 31