Skip to content

Latest commit

 

History

History
64 lines (51 loc) · 1.94 KB

README.md

File metadata and controls

64 lines (51 loc) · 1.94 KB

Distributed-Cache-Ballerina

Features

  • Core Distributed in memory storage using consistant hashing
  • Node Add/Remove in runtime with data realocation
  • Data Replication with Dynamic/Adaptive Replication
  • Failure detection
  • Cluster Discovery
  • Consensus protocol

Todos

  • Performance analysis
  • Make Raft reusable with objects

Get started

Sample Application

    import anjanas/distributed_cache as cache;
    
    cache:connectToCluster();
    cache:Cache oauthCache = new("oauthCache");
    oauthCache.put("Name", "Ballerina");
    io:println (<string>oauthCache.get("Name"));

Sample cluster

If you just want to see distributed cache in action in cluster mode you can simply execute run the following shell script to spawn processes without doing any configurations yourself
./ThreeNode.sh

Configuration documentation

[cache]
ip="http://localhost" #IP of the Node
port=7000 #Port for cache communication
hosts="" #IP and ports of the known nodes in the cluster
capacity=10 #Entry capacity for the node
request.timeout=2000   #Timeout of remote calls
relocation.timeout=60000 #Timeout for a relocation request
eviction.factor=0.1 #Amount of entries will be cleaned in a cleanup
replication.fact=1 #Replicas available of one entry

[local.cache]
enabled=false #Local cache availability
capacity=100 #Capacity of the local cache
eviction.factor=0.25 #Eviction factor of the local cache

[raft] #Keep these at default values if you don't know about Raft
min.election.timeout=2000 #Maximum election timeout for raft
max.election.timeout=3000 #Minimum election timeout for raft
heartbeat.timeout=1000 #Heartbeat timeout for raft

[failure.detector]
suspect.value=10 # Suspect points increased for each connection failure
timeout.millis=1000 # Timeout for failure detector
backoff.fact=1 # Backoff factor for failure detector

[consistent.hashing]
partitions=7 # Number of partitions in the hash ring

Cluster Mode