Service architecture positioning mode

1. The basic concept of service orientation

System Integration (System Integration) is an important issue application system architecture design, no matter what kind of industries and applications, the system may need to integrate access to third-party services. These third-party services may come from external suppliers, also may come from different teams in the same organization, more broadly speaking, the same internal team may also need to be found and integration services to various modules and components under different technical architecture of between integration.

The main problem of system integration needs to address is how to obtain and manage third-party services. The cost of third-party service business also requires iteration and version updates, when implementing these services has changed, it involves an integrated part of the code may need to reconstruct, if some user-level code still can not be accessed directly, the entire reconstruction it will be enormous. Questions Services Positioning (Service Locator) pattern is trying to solve the decoupling service provider (Service Provider) and user application does not need direct access to specific categories of service providers, and service solutions that registration (Registration) and discovery (Discovery )mechanism.

The figure contains several core components positioning mode service:

(1) Service (-Service), the actual processing of the service request, may include different implementations. References to such services can be found in the central registry similar to the JNDI server.

(2) Context (the Context), with reference to the service context is to find, such as JNDI InitialContext used as context container.

(3) The service locator (Service Locator), service locator is to find and obtain services through a central registry similar to the JNDI server, and can be cached for service as needed.

(4) Cache (Cache), cache storage services references for reuse.

(5) The client (App), App calling services through the Service Locator object.

Reflect on the nature of the service positioning mode or the decoupling idea, support dynamic upgrade and improve the maintainability of the system. And service positioning mode as well as similar business agent (Business Delegate) mode (see below). We can see in the business called BusinessLookup proxy mode, is responsible for finding services, and BusinessDelegate combination BusinessLookup and BusinessService provide a stable third-party business service discovery and integration solutions for App end.

2. Service location-based applications

In the large-scale distributed systems, due to the large number of calls related to the relationship between publisher and consumer services, location-based services is particularly important, therefore mainstream of distributed service framework provides a mechanism similar registry as a service provider media and service consumers interact, act as service registration and discovery action (registration & discovery) server.

Under a typical registration center model reference chart, graph registry should have publish - subscribe function, reflected in the service provider can publish service metadata services, and services by consumers to subscribe to the service they are interested in and acquire the metadata includes the address of the service, including. Publish - subscribe function is also reflected in the push to change consumer data, that is, when the registry service definition changes, the initiative to push changes to services in order to achieve service routing. Because the service providers and service consumers also depends on the registry, we need to ensure data consistency, service providers and consumers should see the same data at any time. At the same time consumers have service cache function, when the registry is not available, you can synchronize the routing information in this cache to obtain the address of the service provider and remote call.

Then to Dubbo for example, the registry contains a variety of implementations Multicast registry, Zookeeper registry, Redis registries and Simple registration centers. Regardless of what kind of implementation, the basic model and workflow and service positioning mode remains highly consistent.

 

If you are interested in the article, I can focus on the micro-channel public number: Programmer's transition to an architect.

我出版了《系统架构设计:程序员向架构师转型之路》、《向技术管理者转型:软件开发人员跨越行业、技术、管理的转型思维与实践》、《微服务设计原理与架构》、《微服务架构实战》等书籍,并翻译有《深入RabbitMQ》和《Spring5响应式编程实战》,欢迎交流。

发布了92 篇原创文章 · 获赞 9 · 访问量 11万+

Guess you like

Origin blog.csdn.net/lantian08251/article/details/100046710