SOA: Do services need to be differentiated to maintain differences?

Source: Internet
Author: User
Not long ago I saw a movie <the terminal>. Tom Hanks's leading role was forced to live in an airport because he was a stateless person, his nationality is not recognized because his motherland has been dissolved on his way to the United States, and his country no longer exists. of course, I think this is just a new plot prepared by a scriptwriter to capture the hearts of the audience and think it is just a comedy. however, in fact, this film is based on the true life story of merhan Karimi nasseri, because of French immigration problems and the reason why he does not want to return to his motherland, Iran, he has been living at Charles de Janeiro airport in Paris for nearly 20 years. in essence, this incident has nothing to do with service orientation, but it reminds me of a question about SoA recently mentioned in a seminar: do services need to be differentiated?

Among all the core principles of SOA, the most basic is the loose coupling between service providers and consumers. the core flexibility and reuse advantages of SOA depend on the ability of service providers and consumers to operate independently within the terms and conditions of the service contract used to describe interactions. For a specific SOA, it is critical that you do not add unnecessary requirements or restrictions to the capabilities and actions, because either service provider or consumer can change over time.

The principle of no difference is essential for the need for loose coupling. After all, a service must provide interfaces for software through message transmission. There is no representation of a service instance similar to an object instance. On the contrary, the service simply stops there and communicates with each of its visitors. More specifically, since SOA includes the interoperability between independent entities through service coupling, we only need to transmit messages and data between services. These loosely coupled, heterogeneous, and composite applicationsProgramAll services must be non-differentiated to ensure that they do not expose their system or process information to the outside, thus increasing the coupling of the system, this will lead to a reduction in reusability and availability.

The reason for bringing different service groups together is to implement business processes, which must be different. After all, different instances of a process may be in different States. Therefore, how to use a non-differentiated service to implement a different transaction logic becomes a very important challenge. If the implementation method is incorrect, the benefits of loose coupling brought by the non-differentiated services will be lost.

Maintain differential information in SOA

Wikipedia defines "difference" as follows: such difference retains the information of the past, such as a user record or purchase transaction, the difference reflects all the changes from the start time to the current time of the system. Based on this definition of "difference", there are many definitions about another concept "computing": the transition from one State to another and the conditions for conversion between them. For a process, the difference is very important, because if there is no difference, our system will not have any history to accumulate. In fact, most of the systems we develop are either memory differences or differences. Further, each company needs the previous status to recover from the Update Status of an error. The most important thing is that there is no status record from the previous step, so we can make any reliable transactions because we cannot roll back when a problem occurs.

Therefore, since the difference is so important to an information system, why not include the differential presentation and maintenance functions in SOA? The key to answering this question is to fully understand whether the differential information needs to be shared or independent from each service in a loosely coupled system.

Does loose coupling mean no difference?

Loose coupling makes SOA highly efficient. That is to say, SOA increases flexibility and enables as many services as possible to be reused without interrupting each other. Therefore, it will not impose unnecessary requirements and restrictions on the behaviors and capabilities of service users. In this case, the concept of differences between specific service activities should be maintained within the service rather than exposed to customers who use the service, which will become very meaningful, this is because when the difference requires changes, it is not necessary for all service users to perform such changes. More specifically, because SOA includes cooperation between entities that constitute a service, you only need to transmit messages and data from one service to the next service, the disadvantage is that all services need to save their respective states.

However, even in an SOA environment, in order to obtain information about processes that run across organizations or companies for a long time, we should maintain differentiated values beyond each independent service implementation. In addition, some processes need to retain multiple service sites. For the nature of these processes, but also for security, management, and other purposes, the performance of some differences is also necessary.

Use a service without any difference to maintain a different system

The same problem occurs for non-differentiated web pages. These web pages must save sessions that span multiple web pages, and each web page will not save the status independently. There are basically two ways to save differences on the Web: one is to store a cookie with multiple interactive information in a browser, the other is to track the differences in some way on the server. You can use common network protocols to exchange the stored session information.

Differences in cookie storage are only applicable on the web, because they are in the HTTP structure and HTTP is the most basic web protocol, which is supported by each browser. However, when it comes to services, you need to consider the communication between the system and the system, because it is impossible for all users to be browsers, or, more generally, to support a specific protocol. This allows only messages to save differences in the SOA environment.

In essence, it is possible to save different messages across multiple services. Such storage can be achieved by marking each service message with a certain persistent mark. Such a tag represents a persistent state that spans multi-service interaction activities. A service that performs well will deliver the tag to other services in a hybrid manner without modification, this transfer will be performed through the protocols that manage these services. In this way, there is no difference between individual services, but messages can save the differences required by the components of those special services.

This message-based differential storage method avoids the essence of the problem, that is, how to manage the processes represented by service components. Traditional bpm (business processing management) tools use runtime component engines that represent all running processes. These engines save differences. The advantage of this method is that it provides visibility into running processes and saves the differences of related services.

However, this method has some serious problems: first, the running environment of a core process can only provide differentiated storage for visible services and service components. Once a service request exceeds the boundaries of the system, the process tool will no longer be able to control the process. Second, the vitality of the process depends on the vigor of the Process tool. If the tool crashes and information is lost, there is no way to restore the process instance. However, this may not be the most serious issue, because the running environment of the core process reduces the loose coupling nature, and thus all service providers and users must obey the control of the core tool through the process.

What has been done here is to separate BPM from service-oriented bpm, which is built on the basis of difference management. One way to understand this difference is to try "Remove the server" during the exercise ". What happens to a running process when a core BPM tool is stopped? Because the core tool controls all the process logic, including the Differential Logic, stopping the tool actually means that all processes are terminated, which is often irrecoverable.

To solve these problems, you must use a service-oriented method to save the differences of processes. That is to say, by providing differentiated management through the agreed services, these services aim to save the differences for process instances. Essentially, this method processes messages as events. The differential storage service can audit these events, record logs, and determine the given differences based on the analysis of these records. In this way, the difference is the potential disadvantage of the running system, rather than the necessary information that the running process environment should save. This event-driven, service-oriented method tracks all relevant events and has a separate service set to analyze the event stream and execute specialized processes. These activities are based on the process requirements, policies and service agreements.

What happens when the service set of process management is stopped? Because the message between the service provider and the user contains persistent identifiers, which represent the differences between processes, the process information will not be lost. On the contrary, messages sent to the Process Management Service are put into a queue, waiting for the Service to be restored and processed again. Once the service is restored, you can continue to execute the process logic that is not completed, because messages in the queue can provide all the information it needs about the current process difference.

From the perspective of a designer, it is necessary to consider differences in service-oriented design. Unless it is a differential Management Service and is specially required to do so, differential information is generally not retained. Even in this case, they manage processes that are exposed to differentiated management services. Under no circumstances will a service manage its own differential information, because a service consumer usually knows the internal status of a service to determine whether to send messages to the service. In that case, the loose relationship and encapsulation principles in SOA will be broken.

Effective company designers have realized that, just like allArticleAs described in, a good design changes with the protocol. That is to say, although difference independence is a necessary condition for an independent service to gain flexibility through loose connection, State independence is also a condition for commercial programs to achieve business purposes, therefore, this means is a balance used for their common needs in adopting service-oriented design methods.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.