Reprinted from http://blog.csdn.net/silencecarrot/article/details/52468521< /h2>
1, SOA
SOA (service-oriented software architecture, Service Oriented Architecture), is a software design pattern, mainly used for interoperability between different application components through a certain protocol. For example, a typical communication network protocol. Therefore, SOA is independent of any manufacturer, product, or technology.
SOA has two Level definition:
- From the application point of view: SOA is An application framework that focuses on daily business applications and divides them into separate business functions and processes, and the so-called Service.
- Defined from the basic principles of software: SOA is a component model that connects different functional units (services) of an application through well-defined interfaces and contracts between these services.
- Convert references and resources into objects;
< li style="margin:0px 0px 0px 40px;padding:0px;list-style:decimal;">program these services to standard services to form resource sharing;
- User interface layer-the application/service interface accessed by the end user or application program of these GUI;
- business processLayer—-Business use case service in application;
- Service layer —- Services are merged together to provide unified real-time services;
- Service component layer-components used to build services, such as function libraries, technical libraries, technical interfaces, etc.;
- Operating system—-This layer contains data model, enterprise data warehouse, technology platform, etc.;
2, SAOP
The Simple Object Access Protocol is a protocol specification for exchanging data. It is a lightweight, simple, and based on XML( span>Standard General Markup Language) protocol, which is designed to exchange structured and solidified information on the WEB.
Expansion:
SOAP、
3, REST
Representation State Transfer. Its purpose is to observe the entire network from the perspective of resources. The resources distributed everywhere are determined by the URI, and the client application obtains the representation of the resource through the URI. Obtaining these representations caused these applications to transform their state. With the continuous acquisition of the representation of resources, the client application is constantly changing its state.
Take a chestnut:
< span style="margin:0px;padding:0px;color:rgb(51,51,51);font-family:arial,'Song Ti', sans-serif;line-height:24px;text-indent:28px;" >Marcus is a farmer, he has 4 cows, 12 chickens and 3 cows. He now simulates a REST API, and I am the client. If I wanted to use REST to request the current farm state, I would just ask: “State?” Marcus would answer: “4 pigs, 12 chickens, 3 cows”.
This is the simplest example of REST. Marcus uses tokens to transmit farm status. The characterizing sentence is very simple: “4 pigs, 12 chickens, 3 cows”.
< /span>Look down again to see how I can tell Marcus to add 2 cows using REST?
< /span>According to common sense, you can say something like this: Marcus, please add 2 more cows to the farm. Is this the REST way? Could it be that the state is transmitted through such representations? no! This is a remote procedure call, the process is to add 2 cows to the farm.
< /span>Marcus responded angrily: “400, Bad Request”, what do you mean?
< /span>So, let’s do it again. How do we do it in a REST way? How to re-characterize it? It should be 4 pigs, 12 chickens, and 3 cows. Okay, let us re-characterize again…
Me: “Marcus,… 4 pigs, 12 chickens, 5 cows!”
Marcus:” OK”.
< /span>Me: “Marcus, what’s the status now?”
Marcus: “4 pigs, 12 chickens, 5 cows”.
< /span>I: “Good!”
See? It’s that simple.
Why is RPC not good enough?
From a logical point of view, why would prefer REST rather than RPC (Remote Procedure Call , Remote procedure call), because it greatly reduces the complexity of our communication, by using representation as the only way of communication. There is no need to discuss the process (add a cow? Add an animal type? Double the number of chickens or sell all pigs?) We only need to discuss the characterization and use this characterization to achieve the goal we want. It’s very simple, no NS? I don’t want the communication with Marcus to fail, because our understanding process will be different, so we only need to know the final state. But this is just one of the many problems that create RPC. If you use RPC, you need to design some programs to be embedded in a certain structure. This structure needs to store parameters, error codes, return values, etc.
4, RPC
RPC (Remote Procedure Call Protocol)——Remote Procedure Call Protocol, which is a protocol for requesting services from remote computer programs through the network without understanding the underlying network technology. The RPC protocol assumes the existence of certain transmission protocols, such as TCP or UDP, to carry information and data between communication programs. In the OSI network communication model, RPC spans the transport layer and the application layer. RPC makes it easier to develop applications including network distributed multi-programs.
RPC adopts a client/server model. The requestor is a client, and the service provider is a server. First, the client calling process sends a call message with process parameters to the service process, and then waits for the response message. On the server side, the process stays asleep until the call information arrives. When a call message arrives, the server obtains the process parameters, calculates the result, sends a reply message, and then waits for the next call message. Finally, the client calling process receives the reply message, obtains the process result, and then the call execution continues.
RPC working principle:
< span style="color:rgb(69,69,69);font-family:'PingFang SC','Microsoft YaHei', SimHei, Arial, SimSun;font-size:16px;">
div>
Note:
dobbo is a kind of RPC framework. It is an RPC developed by alibaba engineers for java. It has high performance and simple usage:
1. The interface called remotely needs to be registered in zookeeper;
2. The services that need to be called remotely declare the interfaces they need in zookeeper;
3. Zookeeper will notify the required service of the registered interface;
< span style="margin:0px;padding:0px;white-space:pre;"> SOA for The steps to realize corporate resource sharing and break the “information island” are as follows:
- Convert references and resources into objects;
- Program these services to standard services to form resource sharing;
Based on SOA solutions, SOA architecture can be divided into five levels:
- User interface layer-the application/service interface accessed by end users or applications of these GUIs;
- Business processLayer —- business in application Use case service;
- Service layer-services are merged together to provide unified real-time services; li>
- Service component layer-components used to build services, such as function libraries, technical libraries, technical interfaces, etc.; span>
- Operating system—-This layer contains data model, enterprise data warehouse, technology platform, etc.;
Because SOA does not depend on any technology, SOAP, RPC, REST It is a different implementation of SOA.
When running, a client RPC call to the server, its internal operation roughly has the following ten steps:
1. Call the client handle; execute transfer parameters
2. Call the local system kernel to send network messages
3 The message is sent to the remote host
4. The server handles the message and obtains the parameters
5. Execute the remote process
Note:
dobbo is a kind of RPC framework. It is an RPC developed by alibaba engineers for java. It has high performance and simple usage:
1. The interface called remotely needs to be registered in zookeeper;
2. The services that need to be called remotely declare the interfaces they need in zookeeper;
3. Zookeeper notifies the registered interface to the required service;
6. The process of execution returns the result to the server handle
< p>7. The server handle returns the result and calls the remote system kernel
8. The message is sent back to the local host
9. The client handle is received by the kernel
10 .The client receives the data returned by the handle
WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 2497 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC