Merge remote-tracking branch 'LCTT/master'

This commit is contained in:
Xingyu Wang 2020-12-18 07:40:10 +08:00
commit c4805c0f11
5 changed files with 391 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,107 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Explore the exciting features of the Howl text editor)
[#]: via: (https://opensource.com/article/20/12/howl)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
Explore the exciting features of the Howl text editor
======
Howl is a general-purpose text editor with a super-efficient workflow
and plenty of features to keep it fun and interesting.
![Typewriter in the grass][1]
Howl is a general-purpose text editor written in Moonscript and Lua. Its not focused on a specific programming language, and instead features support for many different languages and formats. In fact, it takes inspiration from "traditional" Unix editors like [Emacs][2] and [Vim][3], so it feels familiar to anyone accustomed to that style of editing. Its primarily a text-oriented interface, without dialogue boxes, toolbars, or a menu, and yet, it has many exciting features that make it feel a little like an IDE for authors, regardless of whether you write code or prose.
![Howl][4]
### Install
Howl is developed on Linux and for Linux. However, its written in Lua with some GTK wrapping, both of which are cross-platform, so if youre keen to compile code, you can test Howl on Windows or macOS.
The compile process is relatively simple, provided you have LuaJIT and GTK development libraries installed. In this sample command, `X.Y` represents a version number in tag form:
```
$ git clone --depth 1
branch X.Y
<https://github.com/howl-editor/howl.git>
$ cd howl-X.Y/src
$ make
$ make install
```
You can launch Howl from your application menu or from a terminal.
### Using Howl
Howl is a lightweight editor. It has a fast startup time and a small overall footprint. This is, in part, thanks to LuaJIT, a just-in-time (JIT) compiler for the [Lua programming language][5].
When you first launch it, the Howl interface is a single empty window. The Howl window contains one view by default, but it can contain more. For instance, you can press **Alt+X** to bring up a command-line view in your Howl window.
![Black Howl command line box with cursor][6]
The command line lets you enter editor commands. You use it a lot because Howl has no menu bar and no toolbar. Conveniently, you can press **Tab** for suggested command completion as you type, so its actually much faster than a traditional menu for locating a function, even when you dont know the exact name of the function youre looking for.
To dismiss the command-line view, press **Esc** on your keyboard.
### Opening a file
To open a file in Howl, press **Alt+X** to bring up a command line and then type `open` followed by a **Space**. Howl displays a new temporary view: a view into your file system so you can choose a file to open. You can choose a file by either typing its path or by clicking on the file you want.
### Editing text with Howl
Howls interface is optimized for its primary function: to edit text. It makes composing words, whether in code or in a natural language, sublimely efficient. As you type, regardless of what youre typing, Howl offers predictive completion of the current word. To complete a word as its being suggested, press **Return** or **Enter** on your keyboard.
Everything that happens in the Howl editor view is a function. For instance, when you select a word and press **Ctrl+C** to copy it, you are invoking the `editor-copy` function, which is assigned the **Ctrl+C** key binding. You might be surprised at how many functions are available. For instance, you can copy an entire line of text with the `editor-copy-line` function by typing **Alt+X** to bring up the command-line view and then `editor-copy-line`. If you hadnt already just read about it here, you might have discovered the function on your own the same way I did: open a command-line view, type a keyword, such as "copy," and press **Tab** for relevant suggestions.
When you discover functions through the command-line view, youre also provided with the functions default keyboard shortcut, if there is one.
![Black Howl terminal box with white, gray and pink code][7]
### Saving a file
After youre done writing or programming (or both), you probably want to save your work. You can do that, as you might guess, with the `save` function. Open a command-line view with **Alt+X** and then type `save`, or just press **Ctrl+S** on your keyboard.
### Quit
Howl is such a great editor, you probably wont want to quit. However, sometimes you want to experience the joy of opening Howl to see how quickly it loads, and in order to do that, you have to exit. To exit the application, open a command-line view with **Alt+X** and then type `quit`.
### Extensions and configuration
Howl doesnt have an extension language because its written in Moonscript and Lua, using the same API available for everyone else. Said another way: Howl is its own extension. Should you find the Howl API insufficient, you can code directly in C by using LuaJITs [FFI library][8].
You can configure Howl in a file called `~/.howl/init.moon` (for Moonscript) or `~/.howl/init.lua` (for Lua).
Configurable options in Howl are displayed as configuration variables. You can set these variables interactively from within Howl using the `set` command, or you can define them in your Howl init file. To discover new configuration variables, type the `set` command into Howls command line, and then press the **Spacebar** to see potential completions.
If youre not familiar with Lua, check out my [Lua cheat sheet][9]. Moonscript is arguably even easier if youre not familiar with Lua yet.
### Use this editor
Howl is a pleasure to use and exciting to explore. Its a lean, focused, and efficient editor with lots of features and an extensible design. If youre a fan of text, text editing, Lua, or just plain good application design, start using Howl. You wont `quit` any time soon (but not because you dont know how).
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/12/howl
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/doc-dish-lead.png?itok=h3fCkVmU (Typewriter in the grass)
[2]: https://opensource.com/article/20/2/who-cares-about-emacs
[3]: https://opensource.com/article/20/3/vim-skills
[4]: https://opensource.com/sites/default/files/31-howl.jpg (Howl)
[5]: https://opensource.com/article/20/2/lua-cheat-sheet
[6]: https://opensource.com/sites/default/files/uploads/howl-command-31-howl-opensource.jpg (Black Howl command line box with cursor)
[7]: https://opensource.com/sites/default/files/uploads/howl-tab-31-howl-opensource.jpg (Black Howl terminal box with white, gray and pink code)
[8]: https://luajit.org/ext_ffi.html
[9]: http://opensource.com/article/20/2/lua-cheat-sheet

View File

@ -0,0 +1,13 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to hack Android Auto to display custom content)
[#]: via: (https://opensource.com/article/20/12/android-auto-open-source)
[#]: author: (Tomasz Grobelny https://opensource.com/users/grobelny)
How to hack Android Auto to display custom content
======
Reimplement the Android Auto protocol to cast movies and additional
applications on automotive head unit displays.

View File

@ -0,0 +1,122 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to Install RPM Files on Fedora Linux [Beginners Tutorial])
[#]: via: (https://itsfoss.com/install-rpm-files-fedora/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
How to Install RPM Files on Fedora Linux [Beginners Tutorial]
======
_**This beginner article explains how to install RPM packages on Fedora and Red Hat Linux. It also shows you how to remove those RPM packages afterwards.**_
When you start using Fedora Linux in the Red Hat domain, sooner or later, youll come across .rpm files. Like .exe files in Windows and .deb files in Ubuntu and Debian, .rpm files enable you to quickly install a software from it on [Fedora][1].
You could find and install plenty of software from the software center, specially [if you enable additional repositories in Fedora][2]. But sometimes youll find software available on their website in RPM format.
Like .exe files in Windows, you **download the .rpm file and double click on it to install it**. Dont worry, Ill show you the detailed steps.
### Installing RPM files on Fedora and Red Hat Linux
Ill be showing you three ways to install RPM files:
* [Install RPM files with software center][3] (GUI method)
* [Install RPM files using DNF command][4] (CLI method)
* [Install RPM files using Yum command][5] (CLI method for Red Hat)
#### Method 1: Use software center
The simplest method is to use the default software center in Fedora. Its really simple. Go to the folder where you downloaded the .rpm file. It is usually the Downloads folder.
Just **double click on the RPM file and it will be opened in the software center**.
Alternatively, you can right click on the file and choose to install it via Software Center.
![Either double click or right click and choose Software Install][6]
When it is opened in the software center, you should see the installation option. Just hit the install button and enter your accounts password when prompted for it.
![Install RPM via Fedora Software Center][7]
Its easy, right?
#### Method 2: Use DNF command to install RPM file
This is the command line method. Fedora uses the new DNF [package manager][8] and you can use it to install downloaded RPM files as well.
Open a terminal and switch to the directory where you have the RPM file downloaded. You can also provide the path to the RPM file. Use the DNF command like this:
```
sudo dnf install rpm_file_name
```
Heres a screenshot where I installed [Google Chrome on Fedora with dnf command][9]:
![Installing RPM files using DNF command][10]
#### Method 3: Install RPM files in Red Hat using Yum command
Unlike Fedora, Red Hat still uses the good old Yum package manager. You wont find the DNF command here, yet.
The process is the same as DNF command. You go to the directory where the RPM file is located or provide its path.
```
sudo yum install path_to_RPM_file
```
Thats it. Nothing fancier.
### How to remove RPM packages
Removing a RPM package isnt a big deal either. And no, you dont need the original rpm file that you used to install the program.
You may find the installed package in the software center and remove application from there.
![Removing RPM Package][11]
Alternatively, you can use the DNF or YUM command with `remove` option.
With DNF, use this command:
```
sudo dnf remove rpm_package_name
```
With Yum, use this command:
```
sudo yum remove rpm_package_name
```
You probably wont remember the exact package name and thats fine. What you can do is to type the first few letters of the package and then hit tab. This is assuming that you have tab completion enabled which usually is.
And thats all you need to do here. Pretty simple, right? Being a beginner, you may struggle with a simple task like this and I hope you feel more confident with Fedora thanks to quick tutorials like this.
--------------------------------------------------------------------------------
via: https://itsfoss.com/install-rpm-files-fedora/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://getfedora.org/
[2]: https://itsfoss.com/fedora-third-party-repos/
[3]: tmp.TvkJtlRJ6T#gui-method
[4]: tmp.TvkJtlRJ6T#use-dnf
[5]: tmp.TvkJtlRJ6T#use-yum
[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/12/installing-rpm-file-fedora.png?resize=800%2C449&ssl=1
[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/12/install-rpm-fedora-software-center.jpg?resize=799%2C193&ssl=1
[8]: https://itsfoss.com/package-manager/
[9]: https://itsfoss.com/install-google-chrome-fedora/
[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/12/install-rpm-using-dnf-install.jpg?resize=800%2C474&ssl=1
[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/12/remove-rpm-package-fedora.jpg?resize=790%2C190&ssl=1

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