官术网_书友最值得收藏!

Service discovery patterns

Microservices-based applications may often scale to such a large number of services that it may not be feasible for each microservice to keep a track of all other active service locations. In such scenarios, the service registry helps in discovering microservices to perform a particular task. There are primarily two patterns for service discovery—client-side discovery and server-side discovery, as shown in the following diagram.

In the client-side discovery pattern, the responsibility for determining the location of services by querying the service registry is on the client. Therefore, the service registry must be accessible to the client to look up the location of the required services. Also, each client must have service discovery implementation built-in for this pattern to work.

On the other hand, in the server-side discovery pattern, the responsibility for connecting with the service registry and looking up the location of services is of a router or a gateway that acts as a load balancer as well. Clients just need to send a request to a router and the router takes care of forwarding the request to the required service. Orchestration tools such as Kubernetes support server-side discovery using proxies.

The server-side discovery pattern must be preferred for a large-scale deployment. It can also be used as a circuit breaker to prevent resource exhaustion by controlling the number of open requests to a service that has encountered consecutive failures or is not available.
主站蜘蛛池模板: 霞浦县| 湟源县| 旺苍县| 鄂伦春自治旗| 临桂县| 丰城市| 松阳县| 东光县| 泸州市| 淮南市| 大兴区| 米易县| 高州市| 舟山市| 绥中县| 视频| 安多县| 界首市| 车致| 吴江市| 徐汇区| 清水县| 鹿邑县| 泸西县| 虞城县| 高清| 丰镇市| 新乡市| 堆龙德庆县| 合川市| 读书| 涟水县| 铜山县| 铜陵市| 会东县| 内丘县| 正镶白旗| 通许县| 汉源县| 南投市| 汾西县|