Return to the essence of architecture, a new understanding of micro-services

The first part: the birth of micro-services, as well as the evolution of the policy is applied

Reporter: In recent years, micro-services architecture design approach is proposed and to practice and landing in a growing number of enterprises, but for micro just getting started with the service of people who still do not know from what began to understand. Can you combine the history of software architecture, development and characteristics of the micro-talk service.

Liang Xin: a micro-serving nature of an architectural style, if you want to understand the micro-services, I think you need to understand the context of the development of the entire infrastructure.

Software architecture, always in constant evolution. If the time back to twenty years ago, when the field of R & D enterprise mainly respected or C / S mode, PB, Delphi software development such mainstream enterprise application development.

Over time, we found that there are some shortcomings standardized client, for example, I have a thousand terminals, each terminal upgrade version requires upgrade, which is very troublesome. Then, enterprise Internet application development began to learn to use the browser as a client, you can avoid this problem. Therefore, the browser-based B / S structure was beginning to pop up.

At the beginning is ASP, and later appeared JSP, because Ja.va pre-compiled model, so performance has been a very large increase, followed by J2EE-based architecture Ja.va language becomes more and more popular. Thus, the architecture has undergone a transition from the traditional C / S mode to the B / S Mode.

B / S architecture basically initial monomer architecture, each system more independent, often requires no interaction between them, even if there are some interaction, but also most of the data level. That stage ETL tool developed rapidly, in order to solve this problem of data silos.

As more and more enterprise applications, the mutual relationship between the system more and more closely, demand access to real-time interaction between the system more and more. This time the engineers found that, no matter what language development software, basic support language called XML, then proposed a real-time interaction technology solutions: for remote calls between enterprise applications through XML language. Thus, SOA concept has been put forward, WebService became popular.

When the second wave of the Internet wave coming, a lot of companies to adapt to a more flexible business development, based on the HTTP protocol with Restful and replace the original architectural style heavy WebService, simple and clear JSON instead of the XML. SOA architecture while often using the service bus technology, no doubt to the system architecture adds an unusually troublesome bottleneck. If a registration and discovery mechanism for direct calls between service process is more suitable for the development of enterprise applications. This is the historical context of micro-services architecture from the technical point of.

In the definition of "micro-service design" Micro Services There are two basic principles: & loose coupling high cohesion. That is "the result of the same factors that change things together, to be separated due to different factors change things district." As for the size of the micro-services division and there is no uniform standard, quite literally, you think it's about the same size, At the same time in line with the principle of "high cohesion and loose coupling &" on it.

There are a lot of micro-service benefits, roughly name a few.

  • Heterogeneous: micro-services can help us to easily use different technologies, and understand the benefits of these new technologies. Try new techniques typically associated with risk, but if the service cut very small, there are some points so that you can choose a minimal risk of service using new technology and reducing the risk always.
  • Flexibility: It is clear that micro-services can be a good deal service is unavailable and functionality to be downgraded, since it can form a number of nodes.
  • Isolation: micro-services architecture system is decomposed into separate operating unit to the system a better isolation, independent micro-services easier to locate and isolate problems when an exception occurs, isolation is the basis of scalable services.
  • Extended: large single service as a whole can only be extended, even if there are performance problems in the system, only a small part of the module, also needs to be extended to the entire system. The micro-service architecture can scale performance levels needed for different modules based on.
  • Easy to deploy: micro-services architecture, the deployment of each service is independent, so that you can more quickly deploy a specific part of the code. Service problems more easily and quickly rolled back, while the agile delivery and deployment brings better business demand response experience.
  • Flexible: In the micro-service architecture, the system will open many interfaces for external use, when circumstances change, you can build applications in different ways. Application of the monomer into a plurality of micro-services, can be achieved with a reusable object may be combined.

Reporter: It is reported that you had previously published an article "Why companies need to establish a unified development framework?", Do you think the company is to establish a unified development framework to solve the problem?

Liang Xin: This is a benevolent see benevolence and the wise see wisdom of the problem, the starting point of each person is different, and some people may need to advocate unity, while others may exclude unity, combined with my experience and practical point of view, I think the company is the need to establish a unified development framework.

In recent years, development of the Internet to subvert the many traditional industries, many new companies have sprung up to take out their business grew very fast, companies are also growing. This is due to the rapid development of China's rapid economic growth and the Internet. But this rapid development process can not be ignored is accompanied by drawbacks:

  • A drawbacks: self-reproduction

In the company's rapid development process, such a chain will often appear. New piece of business -> recruit a Senior Technical Staff -> colleagues around the formation of a technical team -> The basic responsibility of the business team only, then form a closed loop. When the need to interact with other business, often their own decision as technical director. This creates a state of self-reproduction.

  • Two drawbacks: control barriers

With the rapid development of business scale, the team soon formed a department, team decision-makers often from their own interests to consider, want to minimize dependence on foreign sector, whether it is technology selection, specification builds, component selection, operation environment capable of self-control.

  • Malpractice III: cliff effect

When such technology atmosphere, once formed, the impact on individual employees individual projects will become very large. A product often one or two key employees leave because of unsustainable, and finally had to develop new products.

  • Malpractice Four: waste of resources

When each team are trying to build their own complete development process. Research center of technology, product development, operation and maintenance management will be a lot of waste of resources occurs.

  • Five drawbacks: difficult to assess

How to measure a Sichuan Shandong cuisine chef and a cook who is better? When each team is a closed loop, using different technology stack, different technology components, different ways of maintaining and norms, has been unable to determine a team's performance from the output efficiency, KPI indicators it is very difficult to set up.

The establishment of a company-wide unified development platform can effectively address these problems. Technically speaking, if you can form a unified company-level development platform, it will bring great benefits in the actual production process.

  • First, to avoid repetitive research techniques, saving labor costs. Under the project to build a set of platform-based development framework, the technology derives from common problems, to a dedicated team responsible for processing, the project team put energy into the business.
  • Secondly, standardized technical specifications, improved product quality project. To thousands of people face to do the project, rather than thousands of thousand faces. With a unified development platform, the technology stack, technology components, technical implementation, even in the code specifications, standardized technology can form the output mode, standardized effect brought about not only the rapid increase development efficiency, as well as products significantly improved quality.
  • Again, technology can be precipitated, to enhance the company's overall technical ability to avoid a person's ability to project into a decision. Advances in technology comes from continuous technological accumulation and precipitation, to establish a unified framework for the development of company-level (platform), the project team developed its own project based on the platform, no longer need to focus on the underlying technology, we only need to focus on business. Moreover, the focus on the platform of his colleagues in order to better meet the technical requirements of the project team, continuous improvement of the platform, so as to achieve the goal of technology accumulation and precipitation.
  • Finally, it can be measured in R & D inputs and outputs of the R & D team for effective management and assessment. Once established based on a standardized technical specifications of the same development platform, code to achieve business functions can be relatively effective evaluation and consideration, the difference can be avoided because the technology and the emergence of problems. This KPI development and appraisal is a huge help.

I make such a thought from the previous year, by more than a year of efforts, the company has already some results. Our unified development platform targeted at the technical level, its main purpose is implemented as a related product development and project a unified company uses the technology architecture and development tools, to effectively improve the unified technical support to form a continuous accumulation of technology tools to enhance the technical staff utilization and reduce dependence on personnel, and ultimately enhance the scale, streamlined productivity software.

Reporter: Recently "Spring Boot", "Spring Cloud" and other words are always mentioned, the new framework program collection What are the advantages compared to the traditional micro-services framework? Combine your experience, what do you think the future development trend of micro-services might be?

Liang Xin: I am an early internal company research Spring Cloud technology stack, it is also a member of Cloud Spring Chinese community. Spring Cloud in 2017 became the most popular micro-services development framework. However, there is a need dialectical view of the problem of. "Does not mean the use of Spring Cloud framework to achieve the micro-service architecture, with the advantages of micro Services Architecture", the correct understanding should be "use Spring Cloud framework to develop micro-services architecture system, the system has the advantages of micro Services Architecture."

Spring Cloud reason from other frameworks has emerged as the hottest of the frame, thanks to the integrity of its own system. This comparison Spring Cloud, Dubbo and ServiceComb can intuitively understood by the following FIG.

Return to the essence of architecture, a new understanding of micro-services

In addition, Spring in China has a broad mass base, I also quite respected this "agreement is greater than the configured" development ideas, do not need to rely solely on standard things.

I can not make improper comments on the future direction of the micro-services architecture. Based on the moment, I think the Spring Cloud + Docker container of the technology is a good choice for micro-services architecture. I am more recognized a very interesting argument is that "genetic architecture", meaning: architecture from the beginning of the birth is to be changed, so the easier the better change your architecture. I think the architecture of the future will be to develop this road.

Building our unified development platform is based on Spring Cloud technology stack.

Reporter: This year in the software development industry is a hot topic "in Taiwan", it was suggested at the architectural level to do micro service units, how do you think?

Liang Xin: Last year, a variety show with the fire of the word, "dish it." Program, there are a "dry dryly, Ma Ma Lai Lai, is not round, disk him!." Later, when it comes to what to what the disk, no matter what it is, can not hold in your hand, it wants anyway disk. Does not sound particularly evil, then there will be "all things Jieke disk" this piece. This in itself is only a ridicule argument, I did not really see what was on the plate. It is interesting that anything can be seriously re-think deep down, you will also make some seemingly absurd mistakes?

This year the hottest technology turns a noun is "in Taiwan," apply here becomes "all things Jieke in Taiwan," a term set everywhere, I think a lot of companies should avoid blindly follow the trend, so that "in Taiwan" has become a noun trap.

The face of a new technology or trend, we must first understand its origin and fundamental. Sources in Taiwan need to go back to Ali. 2015 Alibaba Group launched a strategy in Taiwan, the goal is to build a large Internet data in line with the times, innovative, flexible 'medium and large units, small reception' mechanism, that is, as the front desk front-line business will be more agile, more quickly to changing market applicable, and the station operational data collection capabilities, product technical capacity of the entire group, the formation of strong support for each of the front-office.

Why is that Ali Group to establish a 'medium-sized Taiwan, a small reception' of the structure? "Road transformation of enterprise IT infrastructure - Alibaba in Taiwan strategic thinking and practical framework," a book describes this in detail. Ali shared the history of the business division of talking, at first, only a Taobao Ali Division, and later set up a Lynx division, this time Taobao technical team while supporting these two segments. At that time Taobao and Tmall electricity supplier system like ours, like many large companies are divided into two separate chimney system, the two systems are included in the commodity trading, payment, evaluation, logistics and other functions. For these reasons, Ali Group has set up a shared services division, before its members, mainly from Taobao technical team, while two electricity supplier business done combing and precipitation, the two platforms in common, common business functions precipitation to share division, to avoid redundant construction and maintenance.

As a country with 10 years of programming experience of veterans, a question I often think about is the law of development of the system, through its shape comprehend its meaning, reviewing the development framework, I think it can be concluded that: "fast." Of course, this fast is a prerequisite, such as accuracy, resource constraints, to be in a stable, fast seek to minimize the resource consumption of the case.

"Fast" can be broken down again, from a development point of view, write code faster, faster development, functional testing faster, faster deployment environment, start and stop the service to be fast; from the production point of view, running speed faster, faster still under high concurrency and so on.

Micro-service architecture so popular, because the demolition of small service, and can be highly multiplexed, do not often write and modify the code, save a lot of time; receptacle technology is so popular, because the container technology can make the production and testing environment consistent environment and save a lot of time deployment environment, reducing the possibility of error, also free to increase container node, enhance business processing capabilities to ensure fast response under high concurrency. Distributed architecture, too, is actually a micro-service architecture evolution distributed architecture. Remain the same, is the pursuit of "fast."

Back "in Taiwan," the subject, the goal of building the station is to avoid duplicate construction and maintenance, rapid response to demand. Background and platform system is relatively stable, generally not prone to change, but also from the viewpoint of stability, should try to reduce the number of back-end systems and platform updates, because the front-end system applicable to the user's needs are constantly changing, so that the foreground and background in the butt when it created a demand for change a constant contradiction, then we want to build a platform in the middle between the two front-end to back-end reusable stuff in on this intermediate platform, re-packaged combination of external services, which It is in line with "fast" idea.

This is the source and root in Taiwan, the Taiwan construction business before, we must first understand them, if you want to see the building in line with the thinking stage "to avoid redundant construction and maintenance" is consistent with the principle of "fast".

The second part: micro-service applications in business critical issues need to be addressed

Reporter: After this letter should open micro-task scheduling service platform SIA-TASK, this platform is widely used, open source in the interior CreditEase technical team is also supported by many developers. Can you tell us about the design ideas of the platform and the core functions? (Design and development of this platform wants to solve the problem)

Liang Xin: Speaking in front of the stage, in fact, I think "in Taiwan" is just a name only, provided that they meet "to avoid redundant construction and maintenance" and two principles "fast", what can be, such as our micro-services management platform SIA-TASK, is a lot like the system in Taiwan.

Before the introduction of SIA-TASK design ideas, let me introduce its background. Whether or Internet applications, enterprise applications, are filled with a large number of batch jobs. Task scheduling systems often need some help developers solve the problem. With the gradual evolution of the micro-service architecture, and gradually evolved into a distributed architecture monomer, micro-services architecture. Many original scheduling platform can not meet the needs of the business system, so there are some distributed task-based management platform. These platforms have their own characteristics, but also have shortcomings, such as not support task scheduling, coupled with high service, does not support cross-platform, which does not meet the needs of next-generation micro-service architecture, so we developed a micro-task scheduling service platform (SIA-TASK).

SIA-TASK SpringBoot used as an architectural system selection, based on the secondary development Zookeeper Quartz and support the corresponding function, SIA-TASK logic architecture is shown below:

Return to the essence of architecture, a new understanding of micro-services

SIA-TASK task management platform for one-stop solution, fit the current micro-services architecture model, with cross-platform, orchestration, high availability, non-invasive, consistency, asynchronous parallel, dynamic expansion, real-time monitoring and so on.

Understand the task scheduling platform, we need to understand the task scheduling. Roughly divided into three tasks, task performed periodically; fixed time interval but not concurrent task execution; but concurrent tasks performed every predetermined time. There may also be the order of the relationship between tasks, such as: serial, parallel, and other branches.

When we task scheduling, some of the following problems often occur.

  • Forgotten, a project run batch job, run the project off the assembly line batch process continues, until a log of the disk space is used only to find;
  • A single point, run batch processes has been a project of a single point, after machine failure, the process stops running;
  • Dependence, run batch processes A and B have a project dependencies can be set only two tasks stagger, if A delay occurs, the need for manual data processing error.

We were designing the SIA-TASK, the platform and the project team will run separated. SIA-TASK includes five modules, task execution, that is the real business logic need to run batch operations, belong to the project team, the project task group will perform at startup is exposed as a service, the service registered to the registry to the task; tasks registry to get a job, and stores it in a persistent database storage, and orchestrated, arranged into a dependent relationship of tasks; the last task to get the mission control center has choreographed choreography centers need to perform tasks, remote call.

Throughout the process, task scheduling, orchestration, execution and project groups are separated, the project team need only concern business logic code scheduling, and the rest are performed in SIA-TASK platform, equivalent to each project task atoms technology, and it has become a micro-services.

Only the business logic to stay in the team, scheduling, orchestration, execution categorized into the platform, all the necessary code to handle everything by configuring of the way, also in line with Taiwan in "avoid duplication of maintenance" thinking.

SIA-TASK is now open source, the specific design and functionality, and deployment operations can be viewed at GitHub, address:  https://github.com/siaorg/sia-task

Reporter: micro-services task scheduling platform (SIA-TASK) which applies to the scene?

Liang Xin: SIA-TASK-based remote scheduling, real business HTTP protocol support high concurrent scheduling process is certainly not ideal. If the business is highly concurrent, tens of thousands per second need to wake up scenes tasks are less suitable for use SIA-TASK. In addition, all other scenes can be used almost SIA-TASK.

Guess you like

Origin blog.51cto.com/14159827/2431079