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

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.
主站蜘蛛池模板: 大悟县| 滨海县| 余干县| 无为县| 湖州市| 钟山县| SHOW| 若尔盖县| 东乌珠穆沁旗| 烟台市| 汤原县| 安宁市| 无锡市| 临高县| 辽阳县| 竹山县| 泽普县| 沙湾县| 宝应县| 开封县| 马关县| 武川县| 县级市| 靖州| 商都县| 寻甸| 长治县| 赤城县| 正蓝旗| 永仁县| 夏邑县| 页游| 沙田区| 牡丹江市| 门头沟区| 昌都县| 通城县| 仙游县| 遂平县| 宝山区| 礼泉县|