Spring Boot health-based load balancing -


i'm using spring boot microservices, , came accross , issue load balancing.

spring actuator adds special health , metrics endpoint apps; this, basic information can acquired running instances.

what do, create (reverse)proxy (e.g. zuul and/or ribbon?), creates centralized load balancer, selects instances health status.

for example, have following microservices

  • client
  • proxy (<- implement this)
  • server 1
  • server 2

when client sends http request proxy, proxy should able decide, of server instances has least load, , forward request one.

is there easy way this?

thanks, krisy

if want make choice on various load-data, implement custom healthindicators accumulate kind of 'load on time' data, use in load balancer decide send traffic.

all custom health indicators picked spring-boot, , invoked on actuator /health endpoint.

@component class loadindicator implements healthindicator {      @override     health health() {         def loaddata = ... stuff gather whatever load         return health.up()                         .withdetail("load", loaddata)                         .build();     }  } 

perhaps use of spring-boots metrics already, there's multiple endpoints in actuator. /beans, /trace, /metrics. should possible find data in application too.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -