Turn: from single application -> SOA -> micro-services, service management [fusing, current limiting, downgrade, service recovery, fault-tolerant service, monitoring, etc.] ---> RPC ---> next-generation technology [Service Mesh ]

Monolithic applications

Another concept opposed to the micro-service is the traditional "monolithic applications" (Monolithic application), internal monolithic application contains all the required services. And each service function module has a strong coupling, is dependent on each other, it is difficult to split and expansion.

Said do you have written single program, we did not have opinions, right? Let me give you chestnuts, just start writing code that you write helloworld program is the single program, a program that includes all the features, although helloworld function is very simple.

Application advantages monomers

  • Develop simple, functional and all within a single program to facilitate software design and development planning.
  • Easy to deploy, there is no single program to deploy complex distributed cluster environment, reducing deployment difficulty.
  • Easy to test, no complicated relationship between various service calls, internal calls are easy to test.

Disadvantage of monolithic applications

The shortcomings of a single program start is not particularly obvious, the project started less demand, the business logic is simple, cool and sometimes write code, has been cool. From a business nightmare iterative update, the system began to increasingly large, pre-cool is gone, replaced by an iterative software maintenance and update of endless suffering.

Monomers architectureMonomers architecture

Because of monolithic applications like a large container, which placed a number of services, and they are inseparable, which leads to the application when the extension must be "application" as a unit.

When the service module, which has a high load alone is not able to extend this service, you must extend the entire application (that is so overbearing), which may result in additional waste of resources.

In addition, monolithic applications due to the closeness between the services, dependence is too high, which will cause the test, the upgrade has been difficult, and the development curve is likely to rise significantly in the latter, so that development is not easy. In contrast, "micro Services Architecture" can solve this problem.

Micro Services

Micro Services (Microservices) is smaller work and self-service.

2014, Martin Fowler  and  James Lewis  jointly proposed the concept of micro-services, the definition of micro services are provided by small service to a single application constituted their own travel and lightweight handling, service design, by business function to automatic way to deploy, use HTTP API to communicate with other services. At the same time the service will be centrally managed using the smallest size (for example,  Docker ) capabilities, the service can be implemented in different programming languages and database components. "Wikipedia"

For example

Or take the front helloworld program to move chestnuts, imagine that you are helloworld company's CTO (boss still missing person?'Ll write that code), assuming helloworld helloworld version of your company's business around the world, we need to write in different languages, respectively output in English, Japanese, French, Russian ... and now the world's 6,000 languages ​​(strange knowledge added).

Some would say this is not a simple I use switch casethe statement to get away, classmates, I was not seriously example, real-world business more complicated than helloworld. Well, we just assume that by language output is a large and complex work, this time we can use micro-service architecture, the architecture is as follows:

Micro Services ArchitectureMicro Services Architecture

Micro Services and SOA

"Service Oriented Architecture" SOA (Service-Oriented Architecture)  sounds a lot like services and micro, but  SOA early models were used bus, this bus model is a technology stack with strong bindings, such as: J2EE. This results in many companies is difficult legacy systems docking, switching time is too long, cost too much, the stability of convergence of the new system needs some time, finally  SOA looks beautiful, but it has become the enterprise-class luxury, small and medium companies are daunting .

In addition, the implementation SOAwill encounter many problems, such as communication protocols (such as SOAP) choices, how to choose a third-party middleware, how to determine the size of the service, at present, there are some guiding principles on how to divide the system, but many of them They are wrong. SOAIt does not tell you how to divide applications into a single micro-services, so implementation SOAtime will encounter many problems.

Well, resolve them before micro-services framework, you can think of micro-services architecture is SOAa particular method.

Micro Services Architecture

Together for a long minute, in view of the "monolithic applications" have the above disadvantages, a single application is divided into a variety of small, interconnected micro-services, a micro service to complete a relatively simple function, reconciliation remain independent from each other coupling, which is micro-services architecture.

Micro Services advantage

Service with respect to the monomer, micro service has many advantages, here are a few key benefits

Technical heterogeneity

The development of different internal technical services can not match, you can use java to develop helloworld service A, with golang to develop helloworld service B, we no longer have the kind of language is the world's best language debate.Micro Services Architecture - Multi-Technology

Different service most appropriate for the chosen technology and services, the system may be used in different parts of different storage technologies, such as A service can choose to store redis, B you can choose to use the service MySQL storage, which are allowed, services you You decide.

Isolation

A service is not available will not lead to another service is also paralyzed, because each service is independent and autonomous systems. It is impossible, in a single application module paralysis, will cause the entire system is not available, of course, the program can be deployed monomer the same program on different machines in a single backup application, However, there are also above said waste of resources problem.

Scalability

If a single large service performance bottlenecks can only be extended to software as a whole, can really affect the performance of just a small module, we also had to pay the cost of upgrading the entire application. This results in improved micro-services architecture, you can only do upgrades extend to those affecting the performance of the service, so the effect is a good remedy.

Simplify deployment

If your service is a large single service, there are millions of lines of code, even if modify a few lines of code have to recompile the entire application, which is obviously very complicated, and software changes brought uncertainty is very high the impact of software deployment is also very large. In the micro-services architecture, the deployment of each service is independent, if it is a problem only affect a single service, you can quickly roll back versions resolved.

Easy Optimization

Micro-service architecture in the amount of code a single service will not be great, so that when you need to refactor or optimize this part of the service, it will be much easier, after all, the smaller the amount of code means more controllable impact of code changes brought about by .

Micro Services shortcomings

We have been emphasizing the benefits of micro-above services, however, micro Services Architecture is not a panacea, can not solve all the problems, in fact, this is the micro-service application to split into many small single distributed service leads to so-called multi-hand man miscellaneous, bad service problems multiply management came.

In order to address the shortcomings of micro services, seniors have proposed the following concepts.

Service registration and discovery

Call each other to complete the overall service between micro business functions, how to find the correct target service address many micro service, which is called "service discovery" feature.

Common practice is to start when the service providers put their addresses reported to the "service registry," which is the "service registry." Caller to the service "subscription" service change "Notifications", a dynamic service registry to receive a push service address list, which after looking directly to the service he can.

Service DiscoveryService Discovery

Service Monitoring

Operation and maintenance of the monitoring program monomer, better said, large-scale micro-service architecture, operation and maintenance services is a major challenge. Service operation and maintenance personnel need to master a variety of real-time status of the service operation, it is best to have a control panel to see the memory usage of the service, the number of call information, health status.

This requires us to have a comprehensive service monitoring system, including topology, monitor (Metrics), log monitoring (Logging), call trace (Trace), alarm notification, health checks and other preventive measures.

Fault-tolerant service

Any service can not guarantee 100% no problem, the production of complex and changing environment, service is running in a variety of failures (downtime, overload, etc.) inevitably occur, engineers can do is to minimize the impact in the event of failure range to restore normal service as quickly as possible.

Programmers Heaven for this purpose to avoid the need to introduce "fuse, isolation, current limit and downgrade, time-out mechanism," such as "fault-tolerant service" mechanism to ensure continuous service availability.

Security Services

Some services exist sensitive data security issues, "security service" is to secure sensitive service using authentication mechanisms, access to services requires appropriate authentication and authorization, to prevent the risk of data leakage, security is a permanent topic in micro service also has a lot of work to do.

Service Management

Speaking of "governance" are generally a problem only need treatment, we usually say environmental management, pollution control means a micro-service architecture micro-services more and more, said the problem is more apparent to those above, in order to solve the above micro- services architecture defect "service management" appeared.

Those issues should be micro-services company technical team to solve their own words, if not the major companies have mature technical team, it is estimated to be very big head. Fortunately, there are shoulders of giants can stand up to lend us, to help us complete the service management through the introduction of "micro-services framework."

Micro Services Framework

Introduce some of the industry's mature micro-services framework.

Dubbo

Alibaba open source is a high performance Java excellent service framework, so that the application can realize output and input functions and services through the RPC performance, it can be seamlessly integrated with the Spring Framework. Apache Dubbo | dʌbəʊ | is a high performance, lightweight open-source Java RPC framework, which provides three core capabilities: an interface for remote method invocation, intelligent fault tolerance and load balancing, and automatic registration and service discovery. Foreign open source end of 2011, supports only the Java language.

Official website:http://dubbo.apache.org/zh-cn/

Dubbo Chart | Source dubbo.apache.orgDubbo Chart | Source dubbo.apache.org

Tars

Micro-service architecture TAF (Total Application Framework) summarizes the results of years of practice made open source project Tencent internal use. Only supports C ++ language, currently in the internal Tencent also widely used. Foreign revenue in 2017, supports only C ++ language.

Source: https://github.com/TarsCloud/Tars/

TARS Chart | Source github.com/TarsCloudTARS Chart | Source github.com/TarsCloud

"TARS natal goose factory PPT presentation framework has been downloaded, the students do not want to find yourself in trouble, in my public number" back-end technology school "reply" tars "get. "

tomcat

Weibo is a Java open source framework. Motan has been widely used in micro-blog platform, completed nearly 100 billion every day to hundreds of service calls. Foreign revenue in 2016, supports only the Java language.

Official Guide: https://github.com/weibocom/motan/wiki/zh_userguide

Motan framework | Source github.com/weibocom/motanMotan framework | Source github.com/weibocom/motan

gRPC

Google is the development of high-performance, general-purpose open RPC framework, mainly for mobile applications developed by Google and based on HTTP / 2 standard protocol designed based ProtoBuf (Protocol Buffers) sequence of protocol development. In itself it is not distributed, so to achieve functional framework of the above needs further development. 2015 Foreign open source cross-language RPC framework that supports multiple languages.

Chinese Tutorial:https://doc.oschina.net/grpc?t=58008

gRPC Chart | Source www.grpc.iogRPC Chart | Source www.grpc.io

thrift

RPC is the first high-performance framework across the internal systems developed by Facebook language in 2007 contributed to the Apache Foundation, became one of Apache open source projects, like gRPC, Thrift also will have its own interface definition language IDL, code generation through , a variety of programming languages ​​generating a Client-Server and an end code for the SDK, support for multiple languages.

thrift architecture | Source wikimediathrift architecture | Source wikimedia

Micro-services framework and RPC

Many people confuse these two concepts a little, slightly above service framework we said, we then look at the RPC concept.

What is RPC

RPC (Remote Procedure Call)Remote procedure call is a computer communications protocol. Our usual procedure is to call inside the local calling program that RPCallows you to call local functions like the same function to call another program, which will involve the middle between the network communications, and interprocess communication, but you do not need to know the implementation details, RPCthe framework for you block the underlying implementation. RPC is a server - client (Client / Server) mode, the classic is achieved through a "request to send - to accept the response" system of information exchange.

Relationship between the two

RPCAnd the relationship between micro-services framework of my understanding, micro-services frameworks generally include RPCimplementation and a series of "service management" capability, is a software development framework. We can implement this framework on the basis of their own micro-services to facilitate the use of "service management" micro-services capabilities provided by the framework and RPC能力, so micro-services framework, also referred to some people RPC框架.

Next-generation micro-architecture services

Service Mesh(Service grid) is considered to be the next-generation micro-service architecture, Service Meshdid not bring new features to us, it is used to solve other tools have been resolved with the service network calls, current limiting, fuse and surveillance and other issues, but this is Cloud Native a  kubernetes realization in the environment.

Feature

Service Mesh has the following characteristics:

  • The middle layer of communication between applications
  • Lightweight Network Agent
  • No-aware application
  • Retry decoupling applications / overtime, monitoring, tracking and service discovery

Currently two popular  Service Mesh open-source software  [Istio](https://istio.io/) and  [Linkerd](https://linkerd.io/)can be directly kubernetes integrated, which Linkerdhave become 云原生计算基金会 CNCF (Cloud Native Computing Foundation) members.

Why Service Mesh

Why question the existing micro-service architecture should have been resolved by Service Meshthen? This is a good question.

Before answering questions, look down istio.ioon to service meshexplain, I feel very good, excerpt out:

As a service mesh grows in size and complexity, it can become harder to understand and manage. Its requirements can include discovery, load balancing, failure recovery, metrics, and monitoring. A service mesh also often has more complex operational requirements, like A/B testing, canary rollouts, rate limiting, access control, and end-to-end authentication.

makes it easy to create a network of deployed services with load balancing, service-to-service authentication, monitoring, and more, **with few or no code changes in service code. **

Try to sum up: With the increasing complexity of the micro-services increases, management becomes more difficult, micro Services Architecture solves the "network calls, current limiting, fuse and monitoring" and other issues, but most frameworks and open source software existing business is 侵入式, which is the need to integrate the relevant "service management" component in the business services program.

Service MeshThe micro service, as TCP/IPis to the Internet, TCP/IPprovides a connection-oriented, reliable, on the basis of the byte stream communication function, you need not care about the underlying retransmission, parity, flow control, congestion control for network communications .

Use Service Meshyou do not have to worry about the details of "service management" does not need to do special service transformation, by all business functions beyond Service Meshto help you do it. It is like a 轻量级网络代理 yes right applications, transparent, will flow across all applications through it, so control over application traffic can be in the  serivce mesh implementation.

 Service Mesh architecture | Photo: Pattern: Service Mesh  Service Mesh architecture | Photo: Pattern: Service Mesh

Written in the last

In the IT world is not what technology is timeless, is an example of the evolution of the micro-service architecture, from single program to micro-services architecture, then service mesharchitecture, I do not know where the next iteration technical point is when, but I know micro services architecture will definitely update, IT people should establish a lifelong learning habit.
What is more important is to have a passion for technology, heat to embrace change, embrace new technologies, new technology when I saw I was excited, the heart os is 厉害了,还能这么玩!, I hope you have such a passion, not just for wages programming, life would be a lot of fun.
The old rules. Thank you for reading, the article aims to share understanding of knowledge, technical articles I will be repeated confirmation in order to ensure the greatest degree of accuracy, if obvious flaws appear in the text is also welcome that together we learn explored.

Guess you like

Origin www.cnblogs.com/zeenzhou/p/12664182.html