A paper read story between Spring Boot, micro-service architecture and big data management

Micro Services Architecture

The birth of micro service is not accidental, it is the rapid development of the Internet, the rapid changes in technology and traditional architecture can not adapt to the birth of rapid change driven by multiple factors and other products. Internet era, there are two types of products are usually characteristics: rapid changes in demand and a large user community, in this case, how to proceed from the perspective of system architecture to build flexible, easy to expand the system to respond quickly to changes in demand; the same time, with the increase user, how to ensure system scalability, high availability, system architecture faces a challenge.

If you follow before the traditional development model, the development of a large-scale and full-system has been difficult to meet the market demand for technology, and this time the idea of ​​divide and rule was put out, so we have developed from a single architecture to a distributed architecture, and from distributed SOA architecture to develop infrastructure, services continue to be split and break down, getting smaller and smaller size, until the birth of micro-services architecture.

Micro-service architecture heritage SOA architecture, but one of the most essential difference is that the service is a real micro-distributed, decentralized. All the "Reflections" includes routing logic, analysis or the like placed inside the service message, a unified remove the ESB, light communication between services, is more thorough than SOA split. Micro Services Architecture emphasis is on the business system needs a thorough assembly technology and services, the original single business system can be split into multiple independent development, design, operation, and operation and maintenance of small applications through between these small applications completion of the service interaction and integration.

About 2009, Netflix completely redefined its application development and operation model, the first step in beginning the exploration of micro-service until March 2014 Martin Fowler wrote an article  Microservices  in a more user-friendly form as we define what is a micro-service architecture. Martin Fowler describes the idea of micro-services architecture in the text, that the micro-service architecture is an architectural pattern, it advocates a single application into a set of smaller services, co-ordination between services, complement each other, providing the ultimate value to the user .

Each service runs in its separate process, lightweight communication mechanism to communicate with each other (usually HTTP-based RESTful API) between services and service adoption. Each service around the specific business to build, and can be independently deployed into a production environment, production-like environment and so on. In addition, you should try to avoid a unified, centralized service management mechanism, for a specific service should be based on the business context, select the appropriate language tools for their building.

Micro-services architecture and data governance

With micro-services architecture landed, it was discovered that although micro-services architecture to improve the development model, but it also introduces some issues, a problem in which all the problems, the most important is about to face is the problem of data. In the micro-service architecture, we emphasize the complete assembly and service of each micro services can be deployed independently and production, in fact, it means a lot of micro-services have their own separate database.

Entire business data is scattered after each sub-service will bring two of the most obvious problems: 1, a complete business management system for data query, such as paging query, such as multi-criteria query, the data is split on how to integrate? 2, how to further analysis of the data mining? These requirements may need to analyze the whole amount of data, and does not affect the analysis of the current business.

From a technical program is concerned, we generally have two options to deal with these problems, the first one is the online processing of data, the second is off-line data processing.

Online data processing program is in accordance with standard interfaces to micro-services, data which need to go back-end system call interface to a micro-services provided to obtain. Back-end management platform to different micro-service system based on the needs of the front end to get the data, and then return the data after the data processing is returned. This approach has two drawbacks: 1) on the one hand micro data service side need to provide data interface, on the one hand of the user data need to write a method call, and the caller need to write a lot of code for data processing; 2) in each It will affect the normal traffic processing capability and services while the micro-micro retrieved service data.

Offline processing data solutions, is the quasi-real-time synchronization of business data to another database, data integration processing in the process of synchronization in order to meet the business-side demand for data, after data synchronization over, and provide another service interface Professional responsible for external output data. This program has two characteristics: 1) data synchronization program is the key, there are a lot of technology selection, how to choose the technical solution to meet the company's business; 2) off-line data processing had no effect on normal micro-services business processing.

In my previous work, two programs are implemented through individuals prefer the second option.

MongoDB and data analysis

MongoDB developers call it the most friendly database, de-emphasizing traditional relational database rows and columns, the entire table can be seen as a Json document, MongoDB also considered Nosql most like Nosql database relational database, retained similar relational database database (dataBase), collection (collection), document Object (document).

MongoDB is one of the most popular non-relational databases, MongoDB database ranked fifth in the latest rankings, ranked first in all of the non-relational databases, it is very widely used in domestic and foreign Internet companies.

The biggest feature is support for MongoDB query language is very powerful, its syntax is somewhat similar to the object-oriented query language, most of the functionality can be achieved almost single-table queries similar to a relational database, but also support for data indexing. MongoDB is implemented on high availability and load balancing to read and write is very simple and friendly, MongoDB comes with the concept of a replica set, by appropriate design of the replica set and drivers, it can achieve very high availability, read and write load balancing.

MongoDB These characteristics are very convenient for high-performance data queries, MongoDB supports the concept of Aggregate and Mapreduce use of divide and rule to handle large-scale data analysis. Spring Boot support for MongoDB is very friendly, very convenient to use Spring Boot MongoDB queries and processing operations, Spring Boot Package also provides support for the use of MongoDB.

MongoDB 4.0 will be officially announced support for ACID transactions, future MongoDB imagination of even greater! Therefore MongDB + Spring Boot is one of the ideal micro-service architecture for data analysis.

Come talk Spring Boot

Spring Boot is a new framework provided by Pivotal team, which is designed to simplify the development process as well as the initial build new Spring applications. The framework uses a particular manner be configured so that the developer is no longer necessary to define the configuration of the template. Using Spring Boot can greatly simplify the development mode, all you want to integrate the common framework, it has a corresponding component support.

Spring Boot Spring-based development, Spirng Boot itself does not provide the core features and extended functionality of the Spring framework, but for quick, agile develop a new generation of applications based on the Spring Framework. That is, it is not intended to replace the Spring approach, but the Spring framework and closely integrated tools for lifting Spring developer experience. At the same time it integrates a large number of popular third-party library configuration (such as Redis, MongoDB, Jpa, RabbitMQ, Quartz, etc.), Spring Boot application of these third-party libraries almost zero configuration out of the box, most of the Spring Boot application only need a very small amount of configuration code, developers can focus more on business logic.

Spring Boot once launched on the sought after by the open source community, Spring Boot official offers many Starters easily integrate third-party products, many mainstream frameworks have also been active integration, such as Mybatis. Spring Spring Boot official attaches great importance to the development of, a key recommendation in the Spring introduced the official website home page, is one of the projects currently focus on the development of Spring official.

Spring Boot itself is developing very fast, since the release Spring Boot 1.0 2014 April version update very frequently, when I use in 2016 is 1.3.X, and now Spring Boot has released Spring Boot 2.0, Spring Boot 2.0 Integration a lot of the latest technology and excellent new features, and for Spring Boot 1.0's API has been greatly optimized. Spring Boot once launched quickly become a popular technique, this conclusion can be seen from the following figure:

)

The picture shows the 2014 to the 2018 Spring Boot Baidu Index, can be seen in Spring Boot 2.0's launch triggered a search peak.

Spring Boot and micro Services Architecture

With the continuous development of Spring, more and more involved in the field, the project to integrate development needs with a wide variety of documents, and slowly become less simple-to-use, contrary to the original idea, and even called the configuration hell. Spring Boot It is abstracted in such a background development framework, aim to make it easier for everyone to use Spring, easier to integrate a variety of commonly used middleware, open source software; on the other hand, when the birth of Spring Boot, is in the micro-service concept is slowly brewing, Spring Boot R & D combines the concept of micro-services architecture to achieve a technical support in the field of micro-Java services architecture landing.

Spring Boot as a new framework, Spring from a large family, so Spring has all the features it has, and easier to use; Spring Boot to the agreed greater than the core idea of ​​the configuration, the default setting to help us carry out a lot, most of the Spring Boot Spring application requires very little configuration only. Spring Boot developed a number of application integration package to support the vast majority of open source software, let us at a low cost to integrate other mainstream open source software.

Spring Boot characteristics :

  • Guide page using Spring project to build a project in a few seconds
  • Convenient external output of various forms of services, such as REST API, WebSocket, Web, Streaming, Tasks
  • Very simple security policy integration
  • Support for relational databases and non-relational databases
  • Supports embedded runtime container, such as Tomcat, Jetty
  • Powerful development kit, support for hot start
  • Automatic management relies
  • Comes Application Monitoring
  • It supports a variety of IED, such as IntelliJ IDEA, NetBeans

These features Spring Boot is very easy and quick to build stand-alone micro-services. So we use Spring Boot development projects, we will bring the traditional development of very large degree of convenience, it can be said if you've used Spring Boot worked on the project, will no longer willing to go the way of previous development project.

In summary, the use of Spring Boot can bring improvements in the following areas at least to us :

  • Spring Boot coding becomes simple, Spring Boot provides a wealth of solutions that rapidly integrate a variety of solutions to enhance the development efficiency.
  • Spring Boot make configuration simple, Spring Boot provides a wealth of Starters, integration with major open source products often requires only a simple configuration can be.
  • Spring Boot change the deployment of simple, Spring Boot itself is built starting container only needs a command to start the project, combined with Jenkins, Docker automated operation and maintenance is very easy to implement.
  • Spring Boot the monitor becomes simple, Spring Boot own monitoring component, using Actuator easily monitor the status of the service.

Summary, Spring Boot Java is the best field of micro-service architecture floor technology, not one.

Disputes between the three

Understand the complete micro Services Architecture, Spring Boot, after the big data governance, we find such an interesting thing: micro-services architecture is an architectural idea, is the inevitable result of continuous development of architecture, have to build flexible, scalable, rapid application, scalability, high availability and other characteristics; micro-service architecture thinking of the launch of the technology have higher requirements, Spring Boot born out in this context, Spring Boot birth name of the door, from the outset, a relatively high standing starting point, and after several years of development, improve the ecological enough, Spring Boot has deservedly become the most popular areas of Java technology.

Under the micro-service architecture, data is divided into N independent micro-services, how to respond to the market, business inquiries for large amounts of data, the analysis becomes very urgent, use Spring Boot and MongoDB can easily solve this problem by technical means N split into micro data synchronization services to MongoDB clusters, data cleansing during synchronized to meet the company's business needs. Spring Boot support for MongoDB is very friendly, on the one hand to generate a lot of pre-Spring Data technology commonly used method easy to use, on the other hand Spring Boot encapsulates the correlation function of distributed computing, allows us a more concise way to achieve statistical inquiry.

Spring Boot Java is the best floor area of ​​micro-service architecture technologies, Spring Boot + MongoDB program is one of the best data management under the micro-service architecture.

Guess you like

Origin juejin.im/post/5d394caee51d45109725ff64