Search code examples
node.jsmicroservicesnetflix-ribbon

How to do client side load balancing for discovered microservices in nodejs


We are trying to build a microservice with nodejs in an environment with other microservices written in java/spring boot.

The other microservices are using consul.io for service discovery and ribbon for client side load balancing. (that would be: spring-boot, spring-cloud-starter-consul-discovery, spring-cloud-starter-feign and spring-cloud-starter-ribbon projects)

Now in this mix, we have a consul node module to register or discover services, but what of rest of the things? How do I do a discovery-aware rest call with a load balancing handled on the client, similar to that of ribbon.

How can I achieve this in node's stack?


Solution

  • I think I should just close this for now, it's been a while. Like I said in the comment above, I have built and used logical counterpart for Feign, Ribbon, with extensible support for service discovery frameworks (currently plugin available for consul.in), with different strategies for load balancing, and declarative API mapping like that of feign interfaces in spring boot, configurable retries, fluent API and support for hystrix. It's a family of node modules: https://www.npmjs.com/search?q=Sarathi