Open groldan opened 4 years ago
In order for the app to be "cloud native", it must do so in a way that supports automatic client-side load balancing, so that the value of
${gn.index.url}
can be the name of the indexing service, and the load-balanced http client can discern which service instance to hit (usually it has a cache of service instances retrieved from discovery-service).
The search app needs only the Elasticsearch instance. For the time being we have usually only one, but the idea is to have a cluster of 3 at least.
When using Java API, you can select an array of node to connect to https://www.elastic.co/guide/en/elasticsearch/client/java-rest/7.9/java-rest-high-getting-started-initialization.html. So maybe we should have at some point similar config for the HTTP proxy? or a route which balance across nodes?
So the current situation is
And we should move to something like
So the actions would be:
org.fao.geonet.searching.controller.EsHttpProxy
uses manual http connection handling to query the indexing service at the URL defined by${gn.index.url}
.In order for the app to be "cloud native", it must do so in a way that supports automatic client-side load balancing, so that the value of
${gn.index.url}
can be the name of the indexing service, and the load-balanced http client can discern which service instance to hit (usually it has a cache of service instances retrieved from discovery-service).The easiest way of achieving so is using spring's
WebClient
(see https://spring.io/guides/gs/spring-cloud-loadbalancer/) The recommended way is to create an OpenFeign client for the target service, which under the hood will useWebClient