Discussion on usage scenarios of standard interfaces and messages

Discussion on usage scenarios of standard interfaces and messages

In various system designs, we often use these two methods for information transmission and system decoupling, but it is difficult to say in which scenario we use standard service interfaces and standard messages. It seems that they can be used. Especially when the platform system needs to support the design of various business scenarios, such problems are often difficult to weigh. Let’s first look at the characteristics of these two methods (not the advantages and disadvantages).

Standard service interface interaction

High aging: time consumption is the method processing time
Strong consistency: strong consistency in the theoretical sense. Direct interface calls are strong consistency. SOA calls need distributed transaction support. It is clear that the execution results can be obtained and the execution results can be processed subsequently
Clear semantics: there are clear function names, parameters, return values and types, and the execution purpose is clear at a glance
Strong coupling: fluctuated due to downstream service SLA
Low scalability: when docking different services, you need to add code / configuration to call different logical implementations

Standard message interaction

Weak coupling: it is only data dependency, not system dependency
Flow buffer: it can prevent the backlog of downstream services
High scalability: the message can be subscribed by multiple users without any change in the upstream system
No interaction: it is only data transmission, and the execution result has nothing to do with the upstream service

Back to our system design, we need to state that there is no best design, only the most suitable design. Take the scenario of content creation as an example. In the process of submission, users judge the security of content, and immediately remind users of security risks. If there is no risk, upload it to the platform and recommend it to other users. This way can achieve the best user experience. However, with our current security control granularity, we need to check whether the content involves pornography, violence, suicide, self mutilation and many other behaviors that violate community norms. The implementation of the whole model and strategy has already exceeded 2 or 3 minutes. It’s really intolerable for C-end applications with strong experience. Based on the background of this technical limitation, it is necessary to reverse promote the independence of security detection ability and submission ability. The content security business is responsible for checking the security of content, and the submission business is responsible for ensuring that users can upload content to the platform and ensure their experience. This means that the user uploads the content first and the security check is carried out asynchronously.

Discussion on usage scenarios of standard interfaces and messages

Content review process

User’s point system
Generally speaking, the accumulation of user points can be obtained in many ways, such as placing orders, comments, sharing, etc. points and orders are two completely unrelated fields. The process of points does not need to have an impact on the process of placing orders, or even should not feel the existence of points. In order to achieve this, the statistics of points can be completed by subscribing to the action events of trading orders and other businesses.

Discussion on usage scenarios of standard interfaces and messages

Integral interaction

Open platform
Generally, when cooperating with external business parties with some R & D capabilities, they will use the open platform to provide part of the capabilities of the platform to partners. The open platform provides developer authentication management, unified authentication, routing forwarding, etc. for example, in the more commonly used scenario of e-commerce commodity management, the third-party developer operates a Taobao store on Taobao platform, If you want to synchronously manage the goods in Taobao store through your own ERP system and be able to directly do full reduction activities for the goods, when uploading the goods, the third party needs to clearly know that the Taobao goods have been uploaded successfully and the commodity ID has been returned. Creating an activity is also a similar requirement. Finally, you need to associate the Taobao commodity ID with the activity ID. Therefore, in the open platform scenario, it is necessary to synchronously request the internal system and return relevant data.

Discussion on usage scenarios of standard interfaces and messages

Open platform architecture

Is there a scene where these two methods are combined? That is, a scenario with both standard interfaces and standard data?
Full link management system
We take the open source distributed monitoring system cat of meituan as an example. Cat is a real-time and nearly full monitoring system, which provides system performance indicators, health status, monitoring alarms, etc. for each business line of meituan. Cat has some requirements in the overall design

  • Fault tolerance: the failure of cat itself should not affect the normal operation of business. If cat hangs up, the application should not be affected, but the monitoring ability is temporarily weakened
  • High throughput, quasi real-time: provide timeliness for rapid fault discovery and rapid fault location
    In addition, the monitoring and performance analysis functions have the following scenario requirements:
  • The execution time of a piece of code. A piece of code can be the execution time of URL or SQL.
  • The number of times a piece of code is executed, such as the number of exception records thrown, or the number of times a piece of logic is executed.
  • Execute a piece of code regularly, such as regularly reporting some core indicators: memory utilization, GC, number of threads and so on.
  • Key business monitoring indicators, such as monitoring the number of orders, transaction volume, payment success rate, etc.
    Therefore, it is hoped that the user’s management needs to have a clear meaning of the scene in order to facilitate the subsequent data collection and processing to aggregate and calculate for different scenes. Cat has designed four types of interfaces with clear meanings for the above scenarios newTransaction、Cat. logEvent、Cat. MetricForCount、Cat. Metricforduration, which is used for business R & D integration through SDK.

    Discussion on usage scenarios of standard interfaces and messages

    Link monitoring

Another common scenario of task submission to feedback is introduced. One obvious difference is that the system needs to let the downstream do a time-consuming task, and also wants to obtain the results of task operation, such as Bi report generation. Usually, when submitting a task, the task ID is returned in real time, indicating that the task has been submitted successfully. The business system will be notified after the internal execution of the time-consuming task.
Task operating system

Discussion on usage scenarios of standard interfaces and messages

Task operating system

When you clearly want this system to help you“do”“what”And care about the system“result”, if yesPrescription requirementsIt is recommended to use the standard service interface for interactionNo requirement for time limitYou can refer to the task operating system, quickly return through standard service interface interaction, and notify the business system through callback when there are results.
When just doingData transmission and event awareness, if you don’t want to have an impact on the upstream system and don’t need the upstream to know whether such a system exists, you can interact through standard messages or eventsWe hope to process the data with definite meaning, but we don’t want to affect our own system, you can refer to the cat monitoring system to determine the processing method of the data through SDK, and then submit it to the downstream system.