Springcloud Study (i): Introduction to micro-services

Source: Internet
Author: User

I. Previously overview 1, what is the structure of the monomer

1), an archive package contains applications that apply all features, which we often call monomer applications.

2), the architectural style of the architecture monomer application, which we call the monolithic architecture, is a more traditional architecture style.

2, the shortcomings of the single structure

L complexity is getting higher

• Technical debt rises gradually

• Deployment speed is slowly becoming slower

• Hindering technological innovation

L cannot scale on demand

3. Evolution of Architecture

L Monolithic Architecture

L SOA

L Micro-Service

L complexity is getting higher

• Technical debt rises gradually

• Deployment speed is slowly becoming slower

• Hindering technological innovation

L cannot scale on demand

Second, micro-service hot? What is why?1 and micro service?

Excerpt from article: http://www.martinfowler.com/articles/microservices.html

In short, the Microservice architectural style was an approach to developing a single application as a suite of small servi CES, each running in it own process and communicating with lightweight mechanisms, often an HTTP resource API. These services is built around business capabilities and independently deployable by fully automated deployment machinery . There is a bare minimum of centralized management of these services, which could be written in different programming Languag ES and use different data storage technologies.

Translation: In short, the development approach of the MicroServices architecture style is to develop a separate application system in a way that develops a small set of services. Each of these small services runs in its own process and often uses a lightweight mechanism such as the HTTP resource API to communicate with each other. These services are built around business functions and can be deployed independently through a fully automated deployment mechanism. These microservices can be written in different languages and can use different data storage technologies. We only have minimal centralized management of these microservices.

Martin Fowler: In short, the development approach of MicroServices architecture style is to develop a separate application system in a way that develops a small set of services. Each of these small services runs in its own process and often uses a lightweight mechanism such as the HTTP resource API to communicate with each other. These services are built around business functions and can be deployed independently through a fully automated deployment mechanism. These microservices can be written in different languages and can use different data storage technologies. We only have minimal centralized management of these microservices.

L From: http://www.martinfowler.com/articles/microservices.html

2. What problems does microservices solve?

Resolves an issue that would redeploy the entire project when a module was updated. The modules of the microservices are separate, one module can be updated separately and the other modules are not affected, and the language used between the modules can be different.

3, micro-service features?

L 1. Each micro-service can run independently in its own process;

L 2. A series of independent micro-services together to build up the entire system;

L 3. Each service for the independent business development, a micro-service generally complete a specific function, such as: Order Management, user management, etc.;

L 4. Micro-services communicate through a number of lightweight communication mechanisms, such as through the rest API or RPC;

L 5. Different languages and data storage technologies can be used;

L 6. Fully automated deployment mechanism.

4. Micro-Service Advantages

1. Easy to develop and maintain

A microservices focus on a specific business function, so his business is clear and the code is small. It is relatively straightforward to develop and maintain a single micro-service. The entire application is built from a number of microservices, so the entire application is also maintained in a controllable state.

2, start faster

The number of individual microservices code is small, so the startup is faster.

3, local modification easy to deploy

The monolithic application also needs to have the modification, must redeploy the entire project, the micro service solves this kind of problem. In general, a microservices modification can only be redeployed by redeploying the modified micro-service.

4, the technology stack is not limited

In the micro-service, we can combine the project business and the characteristics of the team, a reasonable choice of technology stack. For example, some services can use the relational database MySQL, some microservices have the needs of graphics computing, we can use node 4J, and even as needed, some microservices use Java development, some microservices use Nodejs for development.

5, on-demand scaling

We can implement fine-grained scaling as needed. For example, a micro-service in the system encountered a bottleneck, we can combine the business characteristics of the microservices, increase the memory, upgrade the CPU or increase the node.

6. DevOps

DevOps (a combination of English development and operations) is a group of processes, methodologies, and systems that promote communication, collaboration, and integration between development (application/software engineering), technology operations, and QA departments. It comes as the software industry is increasingly aware that development and operations must work closely together to deliver software products and services on time.

5, micro-service architecture challenges

1. High requirements for operation and maintenance

More services means more operational inputs. In the monolithic architecture, it is necessary to ensure the normal operation of an application, while in the micro-service, it is required to ensure the normal operation and collaboration of dozens of or even hundreds of services, which poses a great challenge to the operation and maintenance of the project.

2. The inherent complexity of distribution

A distributed system is built using MicroServices. For a distributed system, system fault tolerance, network delay, distributed transactions and so on have brought us a great challenge.

3. High interface adjustment Cost

The microservices communicate with each other through an interface. If you modify the API for a microservices, it is possible that all microservices that use the interface need to be adjusted.

4. Repetitive Labor

Many services may use the same functionality, which does not break down into a micro-service, which may be developed by each service, leading to duplication of code.

Third, micro-service design principles

0, can be made micro-service, depending on four elements:

    • Small: Micro service small size, 2 pizza team.

    • Standalone: Able to deploy and run independently.

    • Lightweight: Use lightweight communication mechanisms and architectures.

    • Loose: Is loosely coupled between services.

1. Single Duty principle

Each microservices only need to implement their own business logic, such as the order module, it only needs to deal with the order of business logic can be, others do not have to consider.

More lessons Reference Wikipedia: Https://en.wikipedia.org/wiki/SOLID_ (object-oriented_design)

2. Principle of service autonomy

Service autonomy means that each microservices should have an independent business capability, a dependency and a running environment, including a stored database that is independent and has a complete set of processes. We can totally treat it as a project without having to rely on other modules.

3. Lightweight communication principle

First of all, the language of communication is very light, second, the communication method needs to be cross-lingual, cross-platform, the reason for cross-platform, cross-language is to make each micro-service has sufficient independence, can be independent of the technology of the clamp.

4, the interface clear principle

The external interface for each service should be clearly defined and kept as constant as possible.

Springcloud Study (i): Introduction to micro-services

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.