简体   繁体   中英

Client-side load-balancing with Apache HTTP Client

We are building a scalable point-to-point microservice architecture with client-side load-balancing and fail-over. The base idea is to manage service discovery with DNS SRV records, just as HashiCorps' Consul does.

As HTTP client we use Apache http-components.

The algorithm I envision looks something like this:

  • On start-up the client looks up the SRV records for the service it wants to consume.
  • The client configures an instance of HttpClient to round-robin through the available services.
  • The client periodically queries the DNS server for updates (governed by the DNS record's TTL) and updates the HttpClient if hosts are added or removed.
  • Code that invokes the client only uses absolute paths without scheme, host or port.

Constraints:

  • Respect priority and weight fields of SRV records.
  • Implement fail-over with a back-off strategy and temporary host disabling.

Is there a pretty way to configure Apache's http-components this way that I haven't found yet? Is there any better library for this kind of requirements?

Thanks a lot for input and ideas.

我发现Netflix提供的Ribbon功能确实满足我的需求。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM