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 micro service architecture

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "what is the micro-service architecture". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought. Let's study and learn "what is micro-service architecture"!

The microservices architecture describes an approach to developing applications using loosely coupled service collections. Previously, applications were based on a centralized multi-tier architecture. In the age of mainframes and desktops, this approach is very effective. But in cloud computing and mobile devices, the back end must be available to a variety of devices at any time. Bug fixes and features must be delivered quickly without downtime or deployment of the entire application.

Microservices are deployed independently, communicating through webapi or message queuing in response to incoming events. They work together to provide a variety of functions, such as user interface front end, recommendation, logistics, billing, etc.

Microservices typically run in containers. Containers simplify the deployment of microservices, but microservices can run even without containers.

Micro-service is an independent service that encapsulates business scenarios. It contains code and status. Often, microservices even include their own data storage. This makes it independent of versionability, extensibility and deployability. Microservices are loosely coupled and interact with other microservices through well-defined interfaces using protocols such as http. They remain consistent and available in the event of a failure. Microservices can be released independently. Each microservice can be extended on its own without having to extend the entire application.

What are the types of microservices?

In general, there are two types of microservices:

Stateless: no state or can be retrieved from external storage (cache / database). It can be extended without affecting the state. There can be N instances. Examples: web front end, protocol gateway, etc. A stateless service is not a cache or database. It often accesses metadata, there is no instance association, and node loss is not obvious.

State: maintain a tough, authoritative state. For large and super-scale applications, the state remains close to computing. N achieves consistent copies through replication and local persistence. Examples: databases, documents, workflows, user profiles, shopping carts, etc. Stateful service consists of database and cache, and node loss is a noteworthy event. It is sometimes a custom application that holds large amounts of data.

As a variant, one author identified three types: stateless (computing), persistence (storage), and aggregation (orchestration). Aggregate microservices depend on other microservices, so they have network and disk I / O dependencies.

When we think of microservices as hierarchical architectures, we can identify the following types:

Core / atomic services: fine-grained self-contained services. There are no external service dependencies. Mainly business logic. There is usually no Internet phone.

Composite / integrated services: a business function consisting of multiple core services. Including business logic and network calls. Implement routing, translation, orchestration, resiliency, and stability patterns. It usually interfaces with legacy or proprietary systems.

API/Edge services: a selected set of integration services and core services that are provided as the user's managed API. Implement routing, API version control, API security and restrictions.

What is the difference between microservices and API?

API is not a microservice, nor is a microservice an implementation of API. API is an interface. A microservice is a component. The term "micro" refers to components, not the granularity of exposed interfaces. Microservices can be used to expose one or more api. However, not all microservice components expose api.

What is the relationship between micro-service architecture and service-oriented architecture (SOA)?

SOA and micro-service architectures involve different scopes. SOA is related to enterprise service exposure, while micro-service architecture is related to application architecture. Both try to achieve many of the same things (creating business functions as separate components), but on a different scale. They are different in maintainability, granularity, agility and so on. SOA is a very broad term, and microservices are a subset of the usage. Netflix points out that microservices are "fine-grained SOA". Microservices are considered to be "SOA did the right thing".

Some micro-service principles are very different from SOA:

1. Reuse is not the goal: reuse of common components is discouraged because of the dependencies created by common components. It is best to replicate and reuse.

two。 Synchronization is bad: making synchronous calls such as API or web services creates real-time dependencies. Messaging is used between microservices as much as possible.

3. Run-time service discovery: assume that the component is volatile. Therefore, it is often the responsibility of the client to find or even load balance between instances.

4. Data replication technology is adopted: technologies such as event sources can generate multiple independent data "views" to ensure that micro-services are truly decoupled.

What are the important principles to keep in mind when designing a micro-service architecture?

In general, when designing a micro-service architecture, the following principles are good: modeling around the business domain, automation culture, hiding implementation details, highly observable, decentralizing all content, fault isolation, consumer first, and independent deployment.

What are the benefits of using a micro-service architecture?

The advantages span development and operation. In short, we note the following advantages: building and operating services on a large scale, improving resource utilization to reduce costs, fault isolation, continuous innovation, small focused teams, and using any language or framework.

Scalability comes from the modularity supported by microservices. The presence of containers makes it easier to deploy micro-services in a variety of environments. Because of the isolation of services, there is another security advantage: attacks on one service will not affect other services.

Microservices are about code and development. The container is about deployment. The container supports micro-services. Containers provide an isolated environment, so they are ideal for deploying micro-services. However, microservices can be deployed without containers. For example, microservices can be deployed independently on amazonec2. Each microservice can be scaled independently in its own auto-scaling group.

Why shouldn't I use microservices for my applications?

Because applications are distributed across microservices, such distributed systems are more difficult to manage and monitor. Operational complexity increases with the increase in the number of microservices and their instances, especially when they are dynamically created and destroyed. Network calls can be slow and sometimes even fail. Because it is distributed, it is difficult to maintain strong consistency, and the application must ensure ultimate consistency.

Microservices need more time to plan and partition applications. Their design should take failure into account. When you are building a minimum viable product (MVP) or trying to evaluate what works or adds value to the business, a single approach is faster and easier. Use microservices only when your ideas and business value have been proven and need to be expanded.

If you are managing a legacy application, the work of migrating to a microservice can be quite costly. The technology stack may be much larger than a single application. Applications are highly dependent on the network and its performance. Microservices can be tested independently, but it is more difficult to test the entire application.

Thank you for your reading. the above is the content of "what is the micro-service architecture". After the study of this article, I believe you have a deeper understanding of what the micro-service architecture is. The specific use also needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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

Development

Wechat

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

12
Report