Micro-service architecture description, pale micro Services Architecture

A monomer Architecture
1. Architecture monomers
       monomers architecture is also called a monomer or a monomer system application, a system is that all the functions in a manner module is coupled architecture application. Understand the simple way is to the entire application, including applications, databases and so on in the same server. Distributed applications is to be understood that the data and to separate on different servers, and so on and performance optimization in different directions for operation from the application and database simple angle.

2. monomers architectural features
after packaged into a single unit (called a jar introduced into a package or a package war) deployed application, the application to run by means of a process


 

Monomers architecture advantages and disadvantages of
the advantages of
the project manageable

Simple deployment

Disadvantage of
high cost of test

Scalability difference

Poor reliability

Iteration difficult

The degree of cross-linguistic difference

Teamwork difficult

Second, micro-service architecture
1. What is Micro Services
       Micro Services is an architectural style, a large, complex software applications, by one or more micro-services composed of various micro-service system can be deployed independently of each micro service inter are loosely coupled, each micro serve just focused on one task and complete the task well done. A complex software system, were resolved inhuman, but after passing through the split, the complex applications become more efficient.

2. architectural style
       called architectural style is a design pattern of the project. And our common programming model has the following four ways. Later for a detailed comparison of the advantages and disadvantages of each mode.

Common architectural style

       The client and server: comprises a C / S and B / S are two, and B / S are special.

       Component-based architecture model (EJB)

       Layered architecture (MVC)

       Service-Oriented Architecture (SOA)

3. Micro Features
       (1) The system is composed of a plurality of service

       (2) Each service can be deployed individually independent

       (3) between each of the services are loosely coupled. Internal services are highly cohesive, external coupling is low, and it is more in line with the principles of software design, high cohesion is the relationship within each service is very close, only concerned with the completion of a function between each service.

4. The advantages of the micro and services disadvantages
       advantages
       test easy

       Scalability strong

       Reliability

       Cross-language degree will be more flexible

       Teamwork is easy

       The system is easy iteration

       Shortcoming
       operation and maintenance costs are too high, a larger number of deployment

       Interface is compatible with multi-version

       The complexity of distributed systems

       Distributed Transaction

Third, the difference between MVC, RPC, SOA, micro Services Architecture
       1.MVC architecture
       in fact, in essence, MVC is a design pattern should be counted, counted as a single architecture. More representative of the technology: Struts2,, SpringMVC, Spring, Mybatis, Hibernate and so on.

       2.RPC architecture
       RPC (Remote Procedure Call), Remote Procedure Call, which is a request to a remote computer over a network without the need to understand the underlying network protocol technology. On behalf of technology, Thrift, Hessian, etc.

      SOA architecture
       SOA (Service oriented Architecture) Service-Oriented Architecture

       ESB (Enterparise Servce Bus): enterprise service bus, service agency. The main provider of interactive services between a service.

       ESB includes features such as: load balancing, flow control, encryption processing, service monitoring, exception handling, monitoring, warning and so on.

       Representative technology: Mule, WSO2, etc.

       Micro Services Architecture

       Micro service is a lightweight service management program, on behalf of technology: SpringCloud, dubbo etc.

Fourth, how to design micro-services and design principles
       1.AKF split principle

       2. The principle of separation of the front end of the rear end

       3. No state service

       4.RestFul prevailing style

1.AKF split principle
       industry for scalable system architecture is designed with a simple concept, we can solve the problem by adding capacity and availability of the machine. That is, a machine that is not enough then use two machines.

       The concept of "cloud computing" concept insanely popular in today's society, has been widely recognized system for the rapid growth of a scale, we discuss the most problems is the question of capacity and performance. But as time progresses, the growth in the size of the system, in addition to face the problem of performance and capacity, but also need to face the problems caused by the growing complexity of functions and modules bring an increased number of systems, as well as changes in the business to provide differentiated service issue. Many system redesign time and did not fully take into account this problem, resulting in reconfigurable systems become the norm, thus affecting the ability to deliver services, but also a waste of human and financial resources! In this regard, "Scalability Art," a book put forward a more scalable model --AKF system scalability cubic meters. Cube in the direction of three coordinate axes respectively XYZ.

 

       Y-axis (Function)

       Y axis expansion will add an enormous amount of overall application into multiple services. Each service implements a set of related functions, such as order management, customer management. In engineering common scenario is service oriented architecture (SOA), such as for an e-commerce platform, we can be split into different services, such a framework consisting of the following:

 

 

       But by looking at the chart, easy to find, when an increase in the number of services, the service began to call the relationship has become complicated. Add a new feature to the system, the number of services to be invoked becomes uncontrollable, which led to confusion on service management. Therefore, under normal circumstances, we need a mechanism for service registration, forming a service gateway to the service management, system architecture design will become as shown in the following figure:

 

 

       X-axis (horizontal expansion)

       Extended X-axis is oriented in front of the simple idea is the same, by the absolute equality of service and data replication service, capacity and availability to solve a problem. In fact, the use of multiple instances of micro-services, plus do load balancing cluster mode.

       In order to enhance the availability and capacity of a single service, each service is divided X-axis extended.

 

 

       Z-axis (data partitioning)

       Generally refers to the Z-axis expansion based on the unique needs of the user or requester, the system is divided, and divided out of such subsystems are isolated but is intact. Production of automobile factories to Example: Ford Motor Company for the development of China business, or take advantage of China's cheap labor in China to establish a complete sub-factories, like the US factories, responsible for complete car production, which is the Z-axis expansion.

       Common Z-axis expansion engineering program has the following two:

Unit architecture
in distributed service design, a cell (Cell) is to meet a self-contained closed-loop partition all business operations. When it comes to our example above, the Y-axis expansion of SOA architecture, the client selects the service end node is generally random, but, if this plus Z-axis expansion, then select the service node will no longer random, while each unit is self-contained, as FIG.

 

       Data partition

       In order to consider the safety performance data, we will be a complete data set according to a certain dimension divided into different subsets. A partition (Shard), is a subset of the overall data set. For example by the user to divide the tail number, the end portion of the same user number can be considered a partition, partition data generally includes the following data dividing manner

       Traffic types such as data type

       Period data range, for example, a user ID

       User activity data such as heat, heat merchandise

       Product example as described in sub-reader, commodity inventory

2. The principle of separation of the front end of the rear end


       What is the front end of the trailing edge separating it! Originally isolated front and rear ends in the general concept. Under this cooperation will start from the jsp technology, meticulous division of labor in order to put a bigger cake, the best engineers in the fields without touching other areas of knowledge of the situation, it may be increasingly efficient. Maintenance also become more and more simple. Jsp template technology, a combination of HTML and Java code, making the front end and back-end legacy MVC development in the gluey In this technique, the work is to do the front page, the back-end turn into a template, go find problems in the front-end solutions the front end and can not read java code, separating the front and rear end goal is to break these embarrassing situation.

       Before and after the end of the separation principle is simple in terms of separation of front-end and back-end code, we recommend the use of physical separation model is the best way to deploy further promote a more thorough separation, if it continues to direct use server-side template technology, such as the jsp java, js, html, css piled into a page, a little bit more complex pages there is no way maintained.

 

 

This separation method has several advantages

Separating the front and rear side technology, can be carried out by the respective specialists to optimize their respective fields, so front-end user experience optimization better
split mode, front end interface clearer, leaving the interface model, Introduction to back-end interfaces and clear, and more easy to maintain
front-end multi-channel integration scenarios easier to implement, without changing the back-end server, unified data model and can support multiple front ends, such as micro-channel front-end H5, PC front-end, Android front-end, IOS front-end
3. no state service


       For stateless services, first introduced what is the status: If a data needs to be shared by multiple services, in order to complete a transaction, and then this data is called the state. Further dependence of this state is referred to as a service data service state, otherwise known as stateless service

       Well, this does not mean that the principle of non-state service exists in the service in the micro-state is not allowed to express the true meaning is to change the state to put all business services for stateless computing class service, then the corresponding state data is migrated to the corresponding stateful data services.

       Scene Description: For example, we previously established in local memory data cache, Session cache, and now micro-service architecture, you should migrate to a distributed data stored in the cache, so that business service becomes a stateless compute nodes . After migration, can be done on-demand dynamic stretching, dynamic add or delete nodes do not need to consider how to cache data synchronization service micro applications at runtime.

4.RestFul communication style


       As a principle, it was supposed to be a "stateless communication principles" direct communication style recommended here RestFul a preferred practice, because he has a lot of advantages:

Stateless protocol HTTP, have natural advantages, a strong expansion capability, for example, requires security, there is an existing and proven solutions to HTTPS
JSON serialization packets, lightweight simple, man and machine can read, learn low cost, Search engine friendly
language-independent, the major popular languages provide a mature RestFul API framework, the relative number of other eco-RPC framework more complete.

Guess you like

Origin www.cnblogs.com/5566s/p/11892719.html