translated

translated
This commit is contained in:
zxp 2020-12-17 14:20:14 +08:00
parent 96296646d5
commit 46808f5c33
2 changed files with 149 additions and 147 deletions

View File

@ -1,147 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (zhangxiangping)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (The state of the art of microservices in 2020)
[#]: via: (https://www.linux.com/news/the-state-of-the-art-of-microservices-in-2020/)
[#]: author: (Linux.com Editorial Staff https://www.linux.com/author/linuxdotcom/)
The state of the art of microservices in 2020
======
### _“The microservice architectural style is an approach to developing a_ _**single application**_ _as a suite of_ _**small services**_*, each running in its* _**own process and communicating with lightweight mechanisms**_*, often an HTTP resource API. These services are* _**built around business capabilities**_ _and_ _**independently deployable**_ _by_ _**fully automated deployment machinery**_*. There is a bare minimum of centralized management of these services, which may be written in* _**different programming languages**_ _and_ _**use different data storage technologies.**__“_
### James Lewis and Martin Fowler (2014) [6]
## Introduction
It is expected that in 2020, the global cloud microservices market will grow at a rate of 22.5%, with the US market projected to maintain a growth rate of 27.4% [5]. The tendency is that developers will move away from locally hosted applications and shift into the cloud. Consequently, this will help businesses minimize downtime, optimize resources, and reduce infrastructure costs. Experts also predict that by 2022, 90% of all applications will be developed using microservices architecture [5]. This article will help you to learn what microservices are and how companies have been using it nowadays. 
## What are microservices?
Microservices have been widely used around the world. But what are microservices? Microservice is an architectural pattern in which the application is based on many small interconnected services. They are based on the **single responsibility principle**, which according to Robert C. Martin is “gathering things that change for the same reason, and separate those things that change for different reasons” [2]. The microservices architecture is also extended to the **loosely coupled services** that can be **developed, deployed, and maintained independently** [2]. 
## Moving away from monolithic architectures
Microservices are often compared to traditional monolithic software architecture. In a monolithic architecture, a software is designed to be self-contained, i.e., the programs components are interconnected and interdependent rather than loosely coupled. In a tightly-coupled architecture (monolithic), each component and its associated components must be present in order for the code to be executed or compiled [7]. Additionally, if any component needs to be updated, the whole application needs to be rewritten.
Thats not the case for applications using the microservices architecture. Since each module is independent, it can be changed without affecting other parts of the program. Consequently, reducing the risk that a change made to one component will create unanticipated changes in other components. 
Companies might run in trouble if they cannot scale a monolithic architecture if their architecture is difficult to upgrade or the maintenance is too complex and costly [4]. Breaking down a complex task into smaller components that work independently from each other is the solution to this problem.
![Monolithic vs. microservices architecture. Image extracted from \[3\].][1]
## How developers around the world build their microservices
Microservices are well known for improving _scalability_ and _performance_. However, are those the main reasons that developers around the world build their microservices? The State of Microservices 2020 research project [1] has found out how developers worldwide build their microservices and what they think about it. The report was created with the help of 660 microservice experts from Europe, North America, Central and South America, the Middle East, South-East Asia, Australia, and New Zealand. The table below presents the average rating on questions related to the maturity of microservices [1]. 
**Category** | **Average rating (out of 5)**
---|---
Setting up a new project | 3.8
Maintenance and debugging | 3.4
Efficiency of work | 3.9
Solving scalability issues | 4.3
Solving performance issues | 3.9
Teamwork | 3.9
 
As observed on the table, most experts are happy with microservices for solving scalability issues. On the contrary, maintenance and debugging seem to be a challenge for them.
According to their architectures leading technologies, most experts reported that they use Javascript/Typescript (almost ⅔ of microservices are built on those languages). In the second place, they mostly use Java.
Although there are plenty of options to choose to deploy microservices, most experts use Amazon Web Services (49%), followed by their own server. Additionally, 62% prefer AWS Lambda as a serverless solution.
Most microservices used by the experts use HTTP for communication, followed by events and gRPC. Additionally, most experts use RabbitMQ for message-brokers, followed by Kafka and Redis.
Also, most people work with microservices continuous integration (CI). In the report, 87% of the respondents use CI solutions such as GitLab CI, Jenkins, or GitHub Actions.
The most popular debugging solution among 86% of the respondents was logging, in which 27% of the respondents ONLY use logs. 
Finally, most people think that microservice architecture will become either a standard for more complex systems or backend development.
## Successful use cases of Microservices
Many companies have changed from a monolithic architecture to microservices. 
### Amazon
In 2001, development delays, coding challenges, and service interdependencies didnt allow Amazon to address its growing user bases scalability requirements. With the need to refactor their monolithic architecture from scratch, Amazon broke its monolithic applications into small, independent, and service-specific applications [3][9].
In 2001, Amazon decided to change to microservices, which was years before the term came into fashion. This change led Amazon to develop several solutions to support microservices architectures, such as Amazon AWS. With the rapid growth and adaptation to microservices, Amazon became the most valuable company globally, valued by market cap at $1.433 trillion on July 1st, 2020 [8].
### Netflix
Netflix started its movie-streaming service in 2007, and by 2008 it was suffering scaling challenges. They experienced a major database corruption, and for three days, they could not ship DVDs to their members [10]. This was the starting point when they realized the need to move away from single points of failure (e.g., relational databases) towards a more scalable and reliable distributed system in the cloud. In 2009, Netflix started to refactor its monolithic architecture into microservices. They began by migrating its non-customer-facing, movie-coding platform to run on the cloud as an independent microservices [11]. Changing to microservices allowed Netflix to overcome its scaling challenges and service outages. Despite that, it allowed them to reduce costs by having cloud costs per streaming instead of costs with a data center [10]. Today, Netflix streams approximately 250 million hours of content daily to over 139 million subscribers in 190 countries [11].
### Uber
After launching Uber, they struggled to develop and launch new features, fix bugs, and rapidly integrate new changes. Thus, they decided to change to microservices, and they broke the application structure into cloud-based microservices. In other words, Uber created one microservice for each function, such as passenger management and trip management. Moving to microservices brought Uber many benefits, such as having a clear idea of each service ownership. This boosted speed and quality, facilitating fast scaling by allowing teams to focus only on the services they needed to scale, updating virtual services without disrupting other services, and achieving more reliable fault tolerance [11].
## Its all about scalability!
A good example of how to provide scalability is by looking at China. With its vast number of inhabitants, China had to adapt by creating and testing new solutions to solve new challenges at scale. Statistics show that China serves roughly 900 million Internet users nowadays [14]. During the 2019 Singles Day (the equivalent of Black Friday in China), the peak transaction of Alibabas various shopping platforms was 544,00 transactions per second. The total amount of data processed on Alibaba Cloud was around 970 petabytes [15]. So, whats the implication of these numbers of users in technology?
Many technologies have emerged from the need to address scalability. For example, [Tars][2] was created in 2008 by Tencent and [contributed to the Linux Foundation in 2018][3]. Its being used at scale and enhanced for ten years [12]. Tars is open source, and many organizations are significantly contributing and extending the frameworks features and value [12]. Tars supports multiple programming languages, including C++, Golang, Java, Node.js, PHP, and Python; and it can quickly build systems and automatically generate code, allowing the developer to focus on the business logic to improve operational efficiency effectively. Tars has been widely used in Tencents QQ, WeChat social network, financial services, edge computing, automotive, video, online games, maps, application market, security, and many other core businesses. [In March of 2020, the Tars project transitioned into the TARS Foundation][4], an open source microservice foundation to support the rapid growth of contributions and membership for a community focused on building an open microservices platform [12].
**Be sure to check out the Linux Foundations new free training course,** [Building Microservice Platforms with TARS][5]
*About the authors: *
_Isabella Ferreira is an Advocate at TARS Foundation,_ a cloud-native open-source microservice foundation under the Linux Foundation*. *
*Mark Shan is Chairman at Tencent Open Source Alliance and also Board Chair at TARS Foundation. *
**References:**
[1] <https://tsh.io/state-of-microservices/#ebook>
[2]<https://medium.com/hashmapinc/the-what-why-and-how-of-a-microservices-architecture-4179579423a9>
[3] <https://www.plutora.com/blog/understanding-microservices>
[4] <https://www.leanix.net/en/blog/a-brief-history-of-microservices>
[5] <https://www.charterglobal.com/five-microservices-trends-in-2020/>
[6] <https://martinfowler.com/articles/microservices.html#footnote-etymology>
[7] <https://whatis.techtarget.com/definition/monolithic-architecture>
[8] <https://ycharts.com/companies/AMZN/market_cap>
[9] <https://thenewstack.io/led-amazon-microservices-architecture/>
[10] <https://media.netflix.com/en/company-blog/completing-the-netflix-cloud-migration>
[11] <https://blog.dreamfactory.com/microservices-examples/>
[12] <https://www.linuxfoundation.org/blog/2020/03/the-tars-foundation-the-formation-of-a-microservices-ecosystem/>
[13] <https://medium.com/microservices-architecture/top-10-microservices-framework-for-2020-eefb5e66d1a2>
[14] <https://www.statista.com/statistics/265140/number-of-internet-users-in-china/>
[15] <https://interconnected.blog/china-scale-technology-sandbox/>
#### _This Linux Foundation Platinum Sponsor content was contributed by Tencent._
--------------------------------------------------------------------------------
via: https://www.linux.com/news/the-state-of-the-art-of-microservices-in-2020/
作者:[Linux.com Editorial Staff][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/zxp93)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.linux.com/author/linuxdotcom/
[b]: https://github.com/lujun9972
[1]: https://www.linux.com/wp-content/uploads/2020/11/microservices_diagram_a.png
[2]: https://tarscloud.org/foundation/index
[3]: https://www.linuxfoundation.org/press-release/2018/06/tars-and-tseer-form-open-source-project-communities-under-the-linux-foundation-to-expand-adoption-and-pace-of-development/
[4]: https://www.linuxfoundation.org/blog/2020/03/the-tars-foundation-the-formation-of-a-microservices-ecosystem/
[5]: https://www.edx.org/course/building-microservice-platforms-with-tars

View File

@ -0,0 +1,149 @@
[#]: collector: (lujun9972)
[#]: translator: (zhangxiangping)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (The state of the art of microservices in 2020)
[#]: via: (https://www.linux.com/news/the-state-of-the-art-of-microservices-in-2020/)
[#]: author: (Linux.com Editorial Staff https://www.linux.com/author/linuxdotcom/)
The state of the art of microservices in 2020
2020年微服务现状
======
### _“微服务架构风格是一种将_ _**单个应用程序**_ _开发为一套_ _**小服务**_*的方法,每个服务都在* _**自己的进程中运行,并使用轻量级的通信机制进行通信**_*通常是HTTP类型的API。这些服务是基于_**业务能力**_构建的并且是可以通过**完全自动化部署机制**进行**独立部署**。目前对这些服务的集中管理非常有限,这些服务可以用* _**不同的编程语言**_ _编写也能使用_ _**不同的数据存储技术。**__ ”_
### James Lewis and Martin Fowler (2014) [6]
## 简介
预计在2020年全球云微服务市场将以22.5%的速度增长其中美国市场预计将保持27.4%的增长率[5]。目前的趋势是开发人员将会把本地托管的应用程序转移到云端进行托管。这将有助于企业最大限度地减少停机时间、优化资源并降低基础设施成本。同时专家们还预测到了2022年90%的应用程序将会使用微服务架构进行开发[5]。本文将帮助您了解什么是微服务,以及目前的公司如何使用它。
## 什么是微服务?
微服务已经在全球范围内广泛地被使用了。但是,微服务到底是什么?微服务是一种基于许多小型、互联服务的体系结构模式。它们基于**单一责任原则**。根据罗伯特·C·马丁的说法“将因相同原因而改变的事物聚集起来将因不同原因而改变的事物分离开来”[2]。微服务架构也被扩展到了**松耦合服务**中,也可以**独立地开发、部署和维护**[2]。
## 远离单一体系结构
微服务通常和传统的单一体系的软件架构做对比。在单一体系架构中,一个软件是被设计为自包含的,也就是说,这个程序中的各个组件都是互相连通和互相依赖的,而不是松散耦合的。在一个紧耦合的架构中(单一体系),为了执行或编译代码,每个组件和它相关联的组件必须按照指定的顺序组合起来[7]。当其中有一个组件需要更新时,整个应用都要被重写。
而这个现象在使用微服务体系结构的应用中就不会出现。因为每一个模块都是独立的,每个模块都可以更新修改而不影响程序的其他部分。因此,降低了对更改一个组件会对其他组件造成影响的风险。
如果公司的架构很难升级或者维护过于复杂和昂贵,那么他们就不能扩展一个单一的体系结构的应用,他们可能会遇到麻烦[4]。把一个复杂的任务分解成彼此独立工作的小组件就是解决这个问题的方法。
![单一体系架构 vs. 微服务架构 (图片来自 \[3\].][1]
## 开发者如何构建属于自己的微服务
微服务以提高_可扩展性_和_性能_而闻名。然而这些是世界各地的开发者开发属于他们自己的微服务的主要原因吗微服务2020研究现状[1]发现了全球开发者如何构建他们的微服务以及他们对微服务的看法。这份报告是在来自欧洲、北美、中南美洲、中东、东南亚、澳大利亚和新西兰的660名微服务专家的帮助下完成的。下表列出了微服务成熟度相关问题的平均评分[1]
**分类** | **平均得分满分为5分**
---|---
创建新项目 | 3.8
维护与调试 | 3.4
工作效率 | 3.9
解决可扩展性问题 | 4.3
解决性能问题 | 3.9
团队合作 | 3.9
从上表可知,大部分专家都更愿意使用微服务来解决可扩展性问题。与之相反的是,维护与调试对他们来说似乎是一个挑战。
从他们所使用的架构技术来说大部分专家使用Javascript/Typescript(大约⅔的微服务使用这些语言构建的)。其次使用的是Java。
尽管有很多部署微服务的选择但大多数专家使用Amazon Web服务49%其次是他们自己的服务器。另外有62%的人更喜欢AWS Lambda作为无服务器解决方案。
这些人所使用的大多数微服务都使用HTTP进行通信其次是events和gRPC。此外大多数专家将RabbitMQ用于消息代理其次是Kafka和Redis。
而且大多数人使用微服务持续集成CI。在报告中87%的受访者使用诸如GitLab CI、Jenkins或GitHub Actions等CI解决方案。
在86%的受访者中最受欢迎的调试解决方案是日志其中27%的受访者只使用日志
最后,大多数人认为微服务架构将成为更复杂系统或后端开发的标准。
## 微服务的成功案例
许多公司已经从单一的体系结构转向微服务架构。
### Amazon
在2001年开发延迟、编码挑战和服务相互依赖性使得Amazon无法满足其不断增长的用户群的可扩展性需求。由于需要从头开始重构他们的单一体系结构Amazon将其单一体系架构应用程序拆分为小型的、独立的、指定服务的应用程序[3][9]。
2001年在微服务这个词开始流行之前的几年,亚马逊决定改用微服务。这一变化使得Amazon开发了好几种支持微服务架构的解决方案比如amazonaws。随着对微服务的快速增长和适应亚马逊成为全球市值最高的公司截至2020年7月1日亚马逊市值为1.433万亿美元[8]。
### Netflix
Netflix于2007年开始提供电影流媒体服务到了2008年它也面临着规模扩张的挑战。期间他们经历了一次严重的数据库损坏在三天之内他们不能将dvd发送给他们的会员[10]。这一事故使他们意识到需要将单点故障如关系数据库转向云中更可伸缩和更可靠的分布式系统。于是2009年Netflix开始将其单一架构的应用重构为微服务。他们首先将其非面向客户的电影编码平台迁移到云端作为独立的微服务运行[11]。在该用改用微服务之后使Netflix能够解决扩展性挑战和服务中断的问题。并且它还允许他们通过云的方式处理每串流式数据而不是数据中心的模式来降低成本[10]。今天Netflix每天向190个国家的1.39亿订户发送约2.5亿小时的内容[11]。
### Uber
在推出Uber之后他们努力开发和发布新功能修复bug并迅速整合新的变化。因此他们决定改用微服务并将应用程序结构拆分为基于云的微服务。换句话说Uber为每个功能创建了一个微服务比如乘客管理和出行管理。转向微服务给Uber带来了很多好处比如对每项服务的所有权都有一个清晰的概念。这提高了服务访问的速度和质量通过允许团队只关注他们需要扩展的服务在更新虚拟服务的同时而不中断其他服务实现了更可靠的容错从而促进了快速扩展[11]。
## 一切都和可扩展性有关!
关于如何提供可伸缩性的一个很好的例子是看看中国。中国人口众多必须通过创造和试验新的解决方案来适应大规模的新挑战。统计数据显示中国目前为大约9亿互联网用户提供服务[14]。2019年“双十一”期间相当于国外的黑色星期五阿里巴巴旗下各购物平台的交易峰值为每秒544000笔交易。阿里云处理的数据总量约为970兆字节[15]。那么,这些数量的用户在技术上意味着什么呢?
为了解决可伸缩性问题,许多技术应运而生。例如,[Tars][2]由腾讯于2008年创建[2018年贡献给Linux基金会][3]。它也在被大规模使用并在10年内得到了很大的提升[12]。Tars是开源的许多组织都在大力贡献和扩展框架的特性和价值[12]。TARS支持多种编程语言包括C++、Golang、java、node.js、PHP和Python它可以快速构建系统并自动生成代码使开发人员能够专注于业务逻辑从而有效地提高操作效率。Tars已广泛应用于腾讯的QQ、微信社交网络、金融服务、边缘计算、汽车、视频、网络游戏、地图、应用市场、安全等诸多核心业务。[在2020三月TARS项目转变为TARS基金会][4],一个开源微服务基金会,在建立开放式微服务平台的社区方面中,致力于提升社区贡献和成员的快速增长[12]。
**一定要看看Linux基金会新的免费培训课程**, [用TARS构建微服务平台][5]
*关于作者:*
*_Isabella Ferreira_是TARS基金会的一个倡导者也是*cloud-native open-source microservice foundation under the Linux Foundation*的倡导者。*.*
*markshan是腾讯开源联盟的主席也是TARS基金会的董事会主席。*
**References:**
[1] <https://tsh.io/state-of-microservices/#ebook>
[2]<https://medium.com/hashmapinc/the-what-why-and-how-of-a-microservices-architecture-4179579423a9>
[3] <https://www.plutora.com/blog/understanding-microservices>
[4] <https://www.leanix.net/en/blog/a-brief-history-of-microservices>
[5] <https://www.charterglobal.com/five-microservices-trends-in-2020/>
[6] <https://martinfowler.com/articles/microservices.html#footnote-etymology>
[7] <https://whatis.techtarget.com/definition/monolithic-architecture>
[8] <https://ycharts.com/companies/AMZN/market_cap>
[9] <https://thenewstack.io/led-amazon-microservices-architecture/>
[10] <https://media.netflix.com/en/company-blog/completing-the-netflix-cloud-migration>
[11] <https://blog.dreamfactory.com/microservices-examples/>
[12] <https://www.linuxfoundation.org/blog/2020/03/the-tars-foundation-the-formation-of-a-microservices-ecosystem/>
[13] <https://medium.com/microservices-architecture/top-10-microservices-framework-for-2020-eefb5e66d1a2>
[14] <https://www.statista.com/statistics/265140/number-of-internet-users-in-china/>
[15] <https://interconnected.blog/china-scale-technology-sandbox/>
#### _This Linux Foundation Platinum Sponsor content was contributed by Tencent._
--------------------------------------------------------------------------------
via: https://www.linux.com/news/the-state-of-the-art-of-microservices-in-2020/
作者:[Linux.com Editorial Staff][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/zxp93)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.linux.com/author/linuxdotcom/
[b]: https://github.com/lujun9972
[1]: https://www.linux.com/wp-content/uploads/2020/11/microservices_diagram_a.png
[2]: https://tarscloud.org/foundation/index
[3]: https://www.linuxfoundation.org/press-release/2018/06/tars-and-tseer-form-open-source-project-communities-under-the-linux-foundation-to-expand-adoption-and-pace-of-development/
[4]: https://www.linuxfoundation.org/blog/2020/03/the-tars-foundation-the-formation-of-a-microservices-ecosystem/
[5]: https://www.edx.org/course/building-microservice-platforms-with-tars