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

The ideal and reality of Micro-Service

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

With the increasing popularity of cloud original micro-services, many people are interested in the relevant knowledge content of micro-services. The content of this article is aimed at literacy (meaning rookies can enter). I hope it can be helpful to everyone. If you have any questions, you are welcome to discuss and make progress together. 01 where do microservices come from? -the evolutionary history of service architecture

In the early days of the Internet, 2G was still a buzzword, and people's needs were very simple. A static website told everyone who I was, and a message board enabled people to contact me, so that they could meet the needs of information dissemination and mutual communication. So programmers provide us with such a solution: interface + business processing + data processing, everything can be done through a zip package, which is the era of single architecture of service architecture.

The picture is original by the author.

With the popularity of 3G, more and more people can access the Internet through PC. At this time, the emergence of BBS and portal consulting websites began to attract a large number of viewers. When the beautiful interaction is more eye-catching and interesting information instantly detonates tens of millions of users watching online, the "concurrency" problem arises, so programmers work overtime to divide the system into front-end and back-end, by splitting out reusable middleware, to improve business processing capacity and solve concurrency problems, this is the arrival of the era of hierarchical architecture.

The picture is original by the author.

Later, the Internet entered the Weibo era, almost all netizens have Blog, turn on the phone to browse weibo. At this time, when the hierarchical architecture is faced with more complex service requirements, it becomes more and more shackled in application expansion, service invocation, capacity expansion and so on, so the service architecture has entered the era of service-oriented architecture (SOA). SOA says a lot. Here are a few key words: centralized service governance, ESB (Enterprise Service bus) centralization, communication between services through precisely defined interfaces, lower coupling, higher scalability, higher maintenance costs.

The picture is original by the author.

Over the past few years, e-commerce has launched online promotion activities in various seasons, accompanied by continuous delivery, grayscale release, service current limitation, fault-tolerant protection, link tracking, log monitoring, elastic scaling, and so on. There are also programmers increasingly bald head and deeper and deeper glasses. When the pressure of operation and maintenance has been unable to catch up with the rapid development of business, the era of micro-service is coming. It can be understood that micro-service architecture is also an implementation of SOA architecture distribution. Its advantage is that it is small and decentralized, but the corresponding problem is that you have to manage more and more micro-services. And how to carry out micro-service split and service governance is a litmus test of ability.

Before and after, the iterative updates of the service architecture are all around how users can save costs and improve efficiency to solve the emerging new problems. Micro-service is one of the products of the evolution of service architecture.

02 what is a microservice?

The picture is original by the author.

The most popular definition of microservices was proposed by Martin Fowler and James Lewis in 2014. To quote the pops:

Micro-service is a concept of the architecture layer, through decomposition (business unit), the project is divided into n units, there is no strong dependency (decoupling) with each other, and self-preparation needs dependency conditions, so that it can be run and deployed independently, no longer limited by environment and location. The microservice architecture style is a way to develop a single application using a set of small services, each running in its own process and communicating with each other using lightweight mechanisms, usually using lightweight mechanisms such as HTTP resource API. These services are built around business functions and can be deployed independently through automated deployment mechanisms, which are implemented in different programming languages And different data storage technologies, and maintain a minimum of centralized management.

According to the 2019 Architecture and Design Trends report released by InfoQ, the micro-service architecture has gone through the stage of blind pursuit and gradually matured to the stage of practical landing.

Photo Source: InfoQ's 2019 Architecture and Design Trends report

03 how to choose? What is suitable is the best.

Before we choose, let's see what we can choose from.

1. Classification of micro-service framework

At present, there are many micro-service frameworks in the market, each of which has its own advantages. What are the common micro-service frameworks?

According to the classification of common micro-service framework, it is mainly divided into four categories at present.

Component classes-users can load and use them on demand. Common ones are Kubernetes, Eureka/Consul/etcd, ZipKin/Jagger and so on. Integration class-the advantage of integration class is that it simplifies the development of distributed system infrastructure, providing service discovery registration, configuration center, message bus, load balancing, data monitoring and so on. The common ones are Spring Cloud, Dubbo and so on. Grid class-the common ones are Istio, Linkerd, Kong Mesh, etc. No service category-at present, it is mainly used by large factories, such as Knative, OpenFaaS, Kubeless, Fission and so on.

According to the current mainstream ecosystem, there are three major ecosystems:

Spring Cloud family (https://www.) ) Dubbo family (http://) cloud native family (https://www.) )

Here specially provides the official address for everyone to study, this article will not discuss in detail, each family needs to stay up late to lose a handful of hair, practice and study in order to master.

In a word, the core of micro-service is service governance, and service governance needs a good micro-service framework, otherwise micro-service may be a disaster! But as a user, it is best to choose what suits your actual situation.

2. Choose the micro-service framework that suits you.

So how do we choose a micro-service framework? It depends on business characteristics and technical capabilities. Choose the direction first, and then study the technical details. The following ideas about direction selection are for your reference:

If your business module is integrated with service governance, relying on a specific development language and framework, adjusting rules and policies through configuration, and relying on business launch to upgrade the function of service governance, then you may be more suitable for integrated service governance. You can choose the way that suits you in Spring Cloud and Dubbo ecology.

If your business module is separate from service governance, independent of the development language, independent of the development framework, configuring runtime rules and policies through dynamic adjustment, and service governance function upgrade independent of the business module, then you may be more suitable for service governance in the way of service grid. You can choose the way that suits you in the cloud native family, such as trying Istio.

3. When will microservices be introduced?

Microservices are not everything. In other words, microservices are not right for you.

1) Sky time

At the beginning of the business operation, if you are a single business system architecture, if the business volume is small and the complexity is not high, if you pursue fast response, develop services, save costs and improve efficiency, then you may not really need micro-services. For example, if you just want to use CMS to build a set of company websites, you may not really need the knife of microservices. As your business enters the expansion period, your system architecture begins to move towards a service-oriented architecture, the business is expanding, the complexity of the business system is increasing, but the efficiency is declining. Then you can start to think about business split and use micro-services.

2) geographical location

If we want to carry out micro-service transformation, we also need to have certain resource conditions, such as physical machine resources and network resources. For example: suppose an e-commerce platform, the status quo is shown in the figure. If the business framework is not so complex, consider not using a micro-service architecture. If you need to make microservice modifications, you should at least be prepared to plan the following resources:

Hardware resources: host / container, database software resources: registry, split services, load balancing, gateways, caching, monitoring software human resources: at least architects are required to build micro-services, front-end, back-end, and testing. The role of operation and maintenance can be replaced by R & D + micro-service platform.

3) people and

If you want to enjoy the advantages of micro-services, you need to accept the challenges brought by micro-services. For example:

Although the service boundary of micro-service is limited, each team can maintain and evolve its own services independently, but when the services are expanded to dozens or even hundreds, we need to consider the complexity of distribution. If different services can be deployed and extended independently, it is a challenge to maintain the compatibility of different versions and versions. If different services can adopt different technology stacks and interact with each other according to the agreed communication protocol, then a series of complex issues such as authentication / authentication / certificate management between services, such as how to maintain consistency after sharing and separating data, are the challenges we need to face.

In short, the use of micro-services also requires the harmony of time, land and people, and the process of use should not be achieved overnight. Service governance is a great challenge.

Is your business suitable for microservices? I collected some of the simplest questions for quick self-test:

04 implementation method of micro-service

In a nutshell, four steps:

In fact, there may be a "pit" in every step, which is full of knowledge and can be divided into independent chapters. Therefore, this article will not be carried out in detail, and we will write related articles in detail later.

However, Demo can quickly help us find out. Here I chose JD.com 's micro-service platform to do the experience.

Why is it a public cloud product on cloud?

Because the micro-service system is too complex and huge, if you build it yourself, one person can't handle the work of a team.

It is also because it is a managed service on the "cloud", with less operation and maintenance, more WYSIWYG components, open source, more availability zones, easy and fast start-up, and low learning and use costs.

Briefly summarize my learning path:

1. Experience the high availability registry on the "cloud"

If you already have a mature micro-service project, you are currently in the process of going to the cloud, and you want to enjoy the multi-availability zone deployment of the registry brought by "cloud" to maximize the ability to ensure the high availability of the cluster. Then you can directly use the namespace registry function of the microservice platform. At present, the micro-service frameworks supported by JDSF include: SpringCloud, Dubbo, JSF. The general steps to use are as follows:

For an example of getting started, see: https:// distributed-service-framework/basic-example https:// distributed-service-framework/basic-example https:// distributed-service-framework/demo-deploy-k8s https:// distributed-service-framework/gw_vpc

Well, does microservice look less abstract, so difficult, and so crazy?! More content will be broken down next time.

Welcome to click "JD.com Zhaoyun" to learn more wonderful content!

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