Giter Site home page Giter Site logo

mikelabib / elasticacheredisloadbalancer Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 4.0 14 KB

This simple library provides a list of available read replica's for a given ElastiCache ReplicationGroupId and provides options to load balance against them by randomly selecting a node that you can connect to.

Java 100.00%

elasticacheredisloadbalancer's Introduction

ElastiCacheRedisLoadBalancer

Summary

Version: 0.0.1
Notes: To be used in a non-sharded redis version.

This simple library provides a list of available read replica's for a given ElastiCache ReplicationGroupId and provides options to load balance against them by randomly selecting a node that you can connect to.

static ReadReplicaBalancer readReplicaBalancer = new ReadReplicaBalancer();

Example: ArrayList endpoints = readReplicaBalancer.getReadReplicaEndpoints(replicationGroupId, elastiCacheClient);

Option 1: Randomly select a node from the available replica's

Example 1: String node = readReplicaBalancer.loadBalance(endpoints);

Option 2: Randomly select a node from the available replica's excluding a node

Example 2: String node = readReplicaBalancer.loadBalance(endpoints, NodetoExclude);

Demo code shows how it can be used with Jedis but any Redis Java Library will work.

The code loops through the library so you can test against it.

Jedis jedis = new Jedis(node, 6379);

elasticacheredisloadbalancer's People

Contributors

mikelabib avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.