Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the basic concept of microservice?

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the relevant knowledge of what is the basic concept of micro-service, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this article on the basic concept of micro-service. Let's take a look.

The Evolution of the basic Conceptual Architecture of Micro Services

Why is there a microservice?

If you go back to 10 years ago, one day Zhang San joined an e-commerce enterprise-and Xixi Mall.

The company is a startup with few people and few users of the company's website. The company has only one engineer.

The project architecture is relatively simple.

1. Monolithic architecture

Unexpectedly, the business of the company is getting better and better, the number of users of the website is getting larger and larger, and the problem of single architecture is exposed. with the increase in the number of visitors, the project often goes down.

Problem: simple architecture and difficult to resist high concurrency

So, hire people. Upgrade and optimize the and Xixi Mall.

Analyze the direction of the upgrade:

Database and application code should be placed on different servers

Increase application load capacity [cluster]

So load balancing is added.

two。 Load balancing

Distributed: a system performs system functions through the cooperation of multiple servers

Cluster: the same system is placed on multiple servers and multiple copies of the same content are copied on each server.

Load balancing problem

Cost

Session

After the increase of load balancing, the application server is no longer the bottleneck of the system, but can flexibly increase the number of application server clusters as the number of visits increases.

With the continuous increase of business, the amount of data is also increasing, and there is a performance bottleneck in the database.

Recruit people

With the efforts of a number of colleagues, the project is further optimized-read-write separation.

3. Separation of reading and writing

The above structure looks perfect, but with the continuous increase of the business volume of Xixi Mall, new problems have been exposed.

Question:

Product search using database fuzzy query is not good, inaccurate, slow [full-text retrieval]

Fuzzy matching of book query

The frequency of data access in different modules is different (the heat is different), the home page data access volume is relatively large, and the order data access volume is much smaller. All the data is fetched from the database, affecting the access speed of the home page [cache]

Recruit people

4. Full-text retrieval cache

All my colleagues began to optimize the project together, the product search was done using full-text search technology ES, and the cache (Redis cluster) was introduced, so the architecture became this sub-sub.

With the continuous growth of Xixi Mall, the company ushered in venture capital, venture capital 200 million, so the mall developed faster, new problems appeared.

Question:

The coupling between different business modules is too high, one module goes wrong and the whole server is down.

Maintenance is difficult. If there are 200 application server clusters, then the launch of the project means that 200 servers need to be deployed.

For example, the code that modified the order to redeploy the order module means that all servers need to be redeployed

Redundancy, some modules do not need to be deployed on all servers

Recruitment: a team of 100 people will optimize and upgrade the project to SOA, which will be divided into different applications according to different business modules.

This is the distributed architecture.

5. Service

So the company entered a vigorous service era, but there are several problems that need to be solved, as follows

Each module is a separate project that can be started independently, which is called the service module becomes the project, and then we call it the service home module-"Home service."

This is service-oriented, this is micro-service, micro-service is: special distributed architecture.

With a large number of visits to the home page, you can deploy five.

With a small number of visitors to the order, you can deploy only one.

Question:

How do I call between services? For example: the order service needs to invoke the data of the commodity service, how to invoke it?

How to load balance? Load balancing between services? How to load balance when app accesses the backend?

How is the service managed? For example: if the merchandise service is down, how to notify the order service immediately? If the order service is not notified, the requests sent by the order service will be blocked, resulting in order downtime, chain failure and the collapse of the whole project.

Exception handling between services?

.

Each of the above problems needs to be solved by a new technology, and the new technology introduced is micro-service technology, SpringCloud (a set of technologies).

How to solve these problems needs to use some new technologies, which are the so-called micro-service technology (SpringCloud).

Based on the above problems, the whole Huoxi Mall team worked frantically to find some technologies (SpringCloud) to solve the above problems respectively. The architecture diagram is as follows:

So far, and Xixi Mall has become a micro-service architecture.

The main content of service-oriented micro-service is to split different application services according to business modules, and to solve the problems encountered after the split.

What is a microservice?

Each service can run independently in its own process, and each service can be deployed and started independently.

A series of independent micro-services work together to build the whole system.

Each service is developed as an independent business, and a micro-service only focuses on a specific function, such as order management, user management [split by service]

Micro services communicate with each other through some lightweight communication mechanisms, such as Restful API (HTTP) to call [how order services invoke commodity services]

Can be developed using different programming languages and data storage technologies

Official website link: https://www.martinfowler.com/articles/microservices.html

What is SpringCloud?

The one-stop solution under SpringCloud= distributed micro-service architecture is a collection of various micro-service architecture landing technologies, commonly known as micro-service family bucket. Spring Cloud is a set of development tools with multiple sub-projects, a collection of many open source frameworks, he uses the convenience of Spring Boot development to achieve many functions, such as service registration, service discovery, load balancing and so on.

Service management needs a technology.

Service invocation requires a technology

Load balancing needs a technology

.

How did these technologies come from?

Find it yourself, the integration between technologies can not be done without a certain technical strength.

SpringCloud,SpringCloud officially found a set of technology to solve the problem of micro-service, encapsulated and integrated, so that users can use it directly, and do not need to care about the problem of technology integration.

Developing micro services is equivalent to buying a computer.

The technology of assembling and finding your own micro-services is equivalent to assembling your own computer.

Buying a brand machine and using SpringCloud is equivalent to directly buying a Lenovo computer, CPU graphics card and so on.

What does SpringBoot have to do with SpringCloud?

Using load balancing requires a lot of configuration, write configuration

Write your own configuration

SpringBoot automatic configuration

SpringCloud uses SpringBoot as the underlying layer to simplify distributed development through the automatic configuration of SpringBoot.

This is the end of the article on "what is the basic concept of microservice". Thank you for reading! I believe you all have a certain understanding of the knowledge of "what is the basic concept of microservice". If you want to learn more, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report