SpringCloud of micro-Services Overview

SpringCloud of micro-services and SpringCloud

First, micro Services Architecture

With the rapid development of Internet, cloud computing has also been booming in recent years, the company's IT infrastructure environment and I also gradually change occurs, the application architecture from the past monomer has developed into widespread micro-services architecture. Micro Services is an architectural style, give application software development has brought great convenience, but micro-services implementation and landing will be facing great challenges, requiring a complete micro-service solutions. Therefore SpringCloud came into being.

1.1 application development framework

Applications are run independently of the program code, provide a relatively comprehensive business functions. Currently, there are three software architecture architecture categories, namely business architecture, application architecture, technical architecture. The relationship between them is business architecture decisions application architecture, technical architecture support application architecture. Development of architecture from single architecture, distributed architecture, SOA architecture and then micro-service architecture. As shown below.

Here Insert Picture Description

Single application architecture

Monomers architecture in the Java space can be understood as a Java Web applications, including a presentation layer, business layer, data access layer. And then from the Controller to Service Dao layer, "a pole poke in the end," there is no application split, after the completion of the development into a super-large-scale deployment of War. Simple logic monomers shown in the lower hierarchical level architecture shown in FIG.

Here Insert Picture Description

Monomers architecture advantages:

  • Ease of Development: Developers using the current development tools in a short time you can develop a single application.
  • Easy to test: there is no need to rely on other interfaces, tests can save a lot of time.
  • Ease of Deployment: you only need to deploy directory in the operating environment.

Monomers architecture Disadvantages:

  • Flexibility is not enough: if there are any changes to the program, change is not just a point, but from top to bottom to modify, test the entire program must wait until after the deployment in order to see results. In the development process may need to wait for other developers to complete deployment after development is complete, reduce the flexibility of the team.
  • Degrade system performance: could have direct access to the database but now more than a layer. Even if it contains only one feature point, to write the code on the thin individual layers.
  • System slow start: a process that contains all the business logic, too much involved in the start-up module, resulting in system startup time prolonged.
  • System expansion is rather poor: adding new things when you can not increase for a single point, to increase globally. Indeed affect the whole body.

Distributed Architecture

What is the traditional distributed architecture distributed architecture? Briefly, in accordance with the vertical slicing operations, applications are monomers each architecture, each API call. Shown below in FIG.

Service-oriented architecture SOA

Service-oriented architecture is a software architecture, the different components of their applications to provide services or consumer services to other components via a communication protocol on the network, it is also a distributed architecture. Simple, SOA is the establishment of different services are different services, data exchange between services can be coarse-grained service interface by classification, so that improved reusable loosely coupled services, but also to the business logic becomes combined, and each service you can make a reasonable distributed deployment based on usage, so that services become standardized, high-performance, high-availability.

Here Insert Picture Description

SOA architecture has two main roles: service provider (Provider) and service consumers (Consumer). Ali Dubbo is a typical implementation of open source SOA.

The advantages of SOA

  • The split module, the communication using the interface, to reduce the coupling between modules.
  • To split the project into several sub-projects, different teams responsible for different sub-projects.
  • Only need to add a subproject increased functionality, call interface to other systems.
  • The flexibility to deploy distributed

SOA architecture drawback: the interaction between the system require the use of remote communication, interface development increased workload.

1.2 micro Services Architecture

Micro Services Architecture is the next step in a way to continue the development of SOA architecture. The concept of micro-services originated from an article by Martin Fowler "Microservices". Overall, the service is a micro-architectural style, for a large and complex business systems, its business functions can be split into multiple independent micro-services, it is among the various micro loosely coupled services through a variety of remote protocol for synchronous / asynchronous communication, each micro may each be independently deployed services, expansion / contraction, and volume up / downgrading. Here the comparison made micro technical service selection, as follows.

Here Insert Picture Description

1.3 micro-service solutions

Now very popular micro-service architecture, building services and micro-systems will lead to more clear business division and scalability. While supporting micro-services technology stack is varied. Here are two implementations of micro-services solutions.

基于 Spring Cloud的微服务解决方案
Spring Cloud的技术选型是中立的,因此可以随需更换搭配使用,基于 Spring Cloud的微
服务落地解决方案可以分为三种.

Here Insert Picture Description
基于 Dubbo实现微服务解决方案

2012年,阿里巴巴在 Github上开源了基于Java的分布式服务治理框架 Dubbo,但是Dubb未来的定位并不是要成为一个微服务的全面解决方案,而是专注于RPC领域,成为微服务生态体系中的一个重要组件。至于微服务化衍生出的服务治理需求, Dubbo正在积极适配开源解决方案,并且已经启动独立的开源项目予以支持,比如最近宣布的开源的 Nacos,加之今年6月springCloud Alibaba也正式毕业,所以我们又多了一种微服务的解决方案。

二、中间件

2.1 什么是中间件

中间件与操作系统、数据库并列为传统基础软件的三驾马车。其中,中间件也是难度极高的软件工程。传统中间件的概念,诞生于上一个“分布式”计算的年代,也就是小规模局域网中的服务器/客户端计算模式,在操作系统之上、应用软件之下的“中间层”软件。
随着互联网的快速发展,以及云计算的出现,企业的IT架构正在发生深刻的变革。在这个过程中,软件向大规模互联网云服务演化,无论是操作系统还是数据库都发生了深刻的化,中间件也在这个过程不断演进和扩大自己的边界。中间件向下屏蔽异构的硬件、软件网络等计算资源,向上提供应用开发、运行、维护等全生命周期的统一计算环境与管理,属于承上启下的中间连接层,对企业来说有着极其重要的价值。中间件本质上可以归属为技术架构,常见的中间件分别是服务治理中间件(例如: Dubbo等RPC框架)配置中心、全链路监控、分布式事务、分布式定时任务、消息中间件、API网关、分布式缓存、数据库中间件等。

2.2 Spring Cloud中的中间件

Here Insert Picture Description

三、SpringCloud生态增强

3.1 SpringCloud分布式事务

微服务倡导将复杂的单体应用拆分为若干个功能简单合的服务,这样可以降低开发难度,增强扩展性,便于敏捷开发。当前微服务被越来越多的开发者推崇,很多互联网行业巨头、开源社区等都开始了徵服务的讨论和实践。很多中小型互联网公司,由于经验、技术实力等问题,想要让微服务落地还比较困难。如著名架构师 Chris richardson所言,目前存在的主要困难有如下几方面.

  • 单体应用拆分为分布式系统后,进程间的通信机制和故障处理措施变得更加复杂
  • 系统微服务化后,一个看似简单的功能,内部可能需要调用多个服务并操作多个数据库实现,服务调用的分布式事务问题变得非常突出
  • 微服务数量众多,其测试、部署、监控等都变得更加困难
  • 随着RPC框架的成熟,第一个问题已经逐渐得到解决。例如HSF、 Dubbo可以支持多
    种通信协议, Spring Cloud可以非常好地支持 RESTful调用

对于第三个问题,随着 Docker、 Devops技术的发展以及各公有云PAAS平台自动化运维工具的推出,微服务的测试、部署与运维变得越来越容易。而对于第二个问题,现在还没有个通用方案可以很好地解决微服务产生的事务问题。分布式事务问题已经成为微服务落地最大阻碍,也是最具挑战性的一个技术难题。我们后续会介绍 企业级的Spring Cloud与分布式事务的各种解决方案及分析。

3.2 SpringCloud和领域驱动

Many Spring Cloud components, is more like a set of middleware system is based on our realization of micro-services architecture. SpringCloud infrastructure as micro-services architecture, developers can quickly help companies build a micro-service architecture. Spring Cloud framework level to solve the problem, but for how business development, business structure how governance and how architecture preservation, how to solve the complex problem of application architecture, but also methodology to guide practice. So Spring Cloud and complementary areas of driving is very important in the process of landing in the micro-services architecture. Spring Cloud distributed architecture to address issues such as management domain driven methodology and architecture preserved, the two go hand in hand, I escort for the enterprise architecture transformation and micro-services reform. Halo-driven design framework in Chapter 25 of this book will detail areas. Halo framework for seamless integration currently supports Spring Cloud Finchley version, follow-up will also explain how to use prCloud and field drive to manage business architecture and code preserved by case approach.

3.3 SpringCloud和gRpc

By Spring Cloud to build micro-service applications, most developers use the services provided by the calling component Feign official for internal communications service calls, HTTP clients such declarative use very simple, elegant and convenient. However, to achieve low-level calls to go Feign or HTTP protocol with respect to Dubbo, gRPC like frame down RPC RPC protocol can be invoked by the HTTP between the service, the performance is relatively poor. So if we can achieve high performance integrated service calls between other RPC framework by SpringCloud, the answer is yes. Follow-up will be the case for you on the way how to integrate Google open-source framework gRPC in the Spring Cloud.

Published 158 original articles · won praise 147 · views 270 000 +

Guess you like

Origin blog.csdn.net/weixin_39723544/article/details/100417607