What is SOA, SCA and microservices?

This is the back-end small class of the monastery. Each article is shared from

[background introduction] [knowledge analysis] [common problems] [solutions] [coding practice] [extended thinking] [more discussion] [References]

Eight aspects of in-depth analysis of back-end knowledge / skills. This article shares:

[what is SOA, SCA and microservice?]

Hello, I'm Zhu Xingxing, a student of the 8th session of Shanghai Branch of it Academy. I'm an honest, pure and kind java programmer. Today, I'd like to share with you the knowledge points in deep thinking on task 9 of the Academy's official website - what is SOA, SCA and microservice?

(1) Background:

Architecture evolution

Single application architecture

*When the website traffic is very small, only one application is needed to deploy all functions together to reduce the deployment nodes and costs.

*At this time, the data access framework (ORM) used to simplify the workload of addition, deletion, modification and query is the key.

*There is no splitting at the code level. All business logic is packaged into a binary compiled file in one project, which is used for deployment and provides business capabilities.

Vertical application architecture

*When the number of visits increases gradually, the acceleration brought by a single application increases and the machine decreases. The application is divided into several unrelated applications to improve efficiency.

*At this point, the web framework (MVC) for accelerating front-end page development is the key.

*The whole system is composed of several modules, and each module is composed of this different part. In this way, we disassembled the whole system into many smaller parts.

Distributed service architecture

*When there are more and more vertical applications, the interaction between applications is inevitable. Extract the core business as an independent service, and gradually form a stable service center, so that the front-end applications can respond to the changing market demand more quickly.

*At this time, the distributed service framework (RPC) for improving business reuse and integration is the key.

Flow computing architecture

*When there are more and more services, problems such as capacity evaluation and waste of small service resources gradually appear. At this time, it is necessary to add a dispatching center to manage the cluster capacity in real time based on the access pressure and improve the cluster utilization.

*At this time, the resource scheduling and Governance Center (SOA) for improving machine utilization is the key.

(2) Knowledge analysis:

SOA (Service Oriented Architecture)

Baidu Encyclopedia: it is a component model, It integrates the different functional units of the application (called services) are connected through well-defined interfaces and contracts between these services. The interface is defined in a neutral way. It should be independent of the hardware platform, operating system and programming language that implement the services. This makes the services built in various such systems interact in a unified and common way.

The project is relatively small. There is only one system and placed on one server.

As the data becomes larger and larger, the databases of multiple modules need to be placed on the corresponding server, and each module calls its own subsystem.

With the further improvement of the complexity of our system, we have to further improve the performance of the system. We divide multiple modules into multiple subsystems, and multiple subsystems call each other directly.

Mutual interaction and mutual call are very messy, so SOA architecture is used. SOA can help us sort out the relationship between services, provide a unified standard, and only interact with the data bus, so that the system becomes unified.

Enterprise data bus: the enterprise data bus is not the integration of multiple sub modules. It acts as a data channel here. The data bus does not care about the business. The data bus adjusts the service according to the given address and protocol. The upper end does not care where the service is and what it is, but only looks for the data bus.

Each system registers with the data bus according to the unified standard. When each subsystem calls other subsystems, we don't care. If we find other subsystems, we only find the data bus, and then find other subsystems according to the unified standard. Therefore, the data bus acts as a passer-by here.

Different components and their workflow in SOA

Shopping mall case:

SCA

SOA has two sets of standards in the Java field: one is JBI (not recognized by BEA and IBM) launched by sun, and the other is SCA and SDO standards launched by companies such as IBM and bea.

SCA: service component architecture is a brand-new idea of software architecture.

In SCA, the most important concept is service, which is independent of specific technology. Therefore, SCA will not call it Java component architecture or web service component architecture. The so-called specific technology mainly has two meanings: one is the program language, but the transmission protocol.

Existing components are tightly coupled to transport protocols. For example, EJB components adopt RMI transport protocol, and web service components adopt soap transport protocol. SCA components can freely bind various transport protocols.

SCA is a further sublimation of current component programming. Its goal is to enable service components to freely bind various transport protocols and integrate other components and services.

The biggest difference between SCA and traditional business components is that SCA implements two functions: one is the separation of components and transmission protocols, and the other is the separation of interfaces and implementation languages.

Service component is the most basic functional unit in SCA, which includes four parts: service, component implementation, reference and attribute creation

How to understand SCA?

Like making a car. To produce a car, we need to do a lot of complex work: design, production of engine, production of frame, production of chassis, production of various accessories, assembly and so on.

Automobile manufacturers have separated all the above work into a department or workshop, which is not mixed with each other. Without any independent unit, a complete car cannot be produced. Of course, each independent department can reuse different models. In addition, all departments should have a central leader to command and coordinate.

(3) Frequently asked questions:

What is the difference between microservices and SOA?

(4) Solution:

Microservice is the product of the sublimation and development of SOA. It is a relatively modern fine-grained SOA implementation.

(5) Coding practice:

Service side code of SCA component

The server code consists of three parts:

Service interface, a java interface -- helloservice java。

Service implementation, implementation class of helloservice interface -- helloserviceimpl java。

SCA's service component configuration file -.

HelloService. java

HelloService. java

/**

*Service interface

*/

public interface HelloService {

String getHello(String username);

}

HelloServiceImpl. java

/**

*Service implementation

*/

public class HelloServiceImpl implements HelloService {

public String getHello(String username) {

return "Hello " + username + "! This is a SCA program!";

}

}

Client code for SCA components

/**

*SCA client calls

*/

public class HelloSCAClient {

public static void main(String[] args) {

SCADomain scaDomain = SCADomain. newInstance("

HelloService helloService =

scaDomain. getService(HelloService.class,"HelloServiceComponent");

String msg = helloService. getHello("vcom");

System. out. println(msg);

scaDomain. close();

}

}

(6) Expand thinking:

The expansion thinking beyond the knowledge points is explained by the sharer. These things are the so-called depth and the performance of a person's technical level.

(7) References:

(8) More discussion:

Q1: the origin of microservices?

A1: microservices were first proposed by Martin Fowler and James Lewis in 2014. Microservice architecture style is a way to use a set of small services to develop a single application. Each service runs in its own process and uses lightweight mechanisms to communicate, usually HTTP APIs. These services are built based on business capabilities, These services can be deployed independently through automatic deployment mechanism. These services are implemented in different programming languages and different data storage technologies, and maintain the minimum centralized management.

Q2: what are the basic frameworks for microservices?

A2:Spring Cloud、Dubbo

Q3: how to choose spring cloud and Dubbo?

A3: judging from the attention and activity of spring cloud, it is likely to become a standard framework for microservice architecture in the future.

(9) Thanks:

(10) Conclusion:

That's all for today's sharing. You are welcome to like, forward, leave messages and make bricks~

Ppt link video link

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>