雲端原生應用程式呢?What about Cloud-Native applications?

儘管雲原生應用程式不是本指南的主要重點,但瞭解此現代化成熟度級別並將其與雲優化應用程式區分開來很有説明。Although Cloud-Native applications are not the main focus of this guide, it's helpful to have an understanding of this modernization maturity level, and to distinguish it from Cloud-Optimized applications.

圖 4-3 將雲原生應用定位在應用程式現代化成熟度級別中:Figure 4-3 positions Cloud-Native apps in the application modernization maturity levels:

顯示如何定位雲原生應用程式圖。

圖 4-3。Figure 4-3. 定位雲原生應用程式Positioning Cloud-Native applications

雲原生現代化成熟度級別通常需要新的開發投資。The Cloud-Native modernization maturity level usually requires new development investments. 遷移到雲原生級別通常是出於業務需求,通過創建可獨立部署和擴展的自主子系統(微服務),使應用程式盡可能現代化,從而大幅提升大型應用程式中的規模從應用程式的其他領域,同時降低成本的長期,並提高那些自主應用部件的演進敏捷性,這些部件提供了顯著的競爭優勢。Moving to the Cloud-Native level typically is driven by business need to modernize applications as much as possible to drastically improve scale in large applications by creating autonomous subsystems (microservices) that can be deployed and scale independently from other areas of the application while lowering costs in the long term and increase evolution agility of those autonomous app’s parts that provide significant compete advantages.

雲原生應用程式的主要支柱基於微服務體系結構方法,這些方法可以隨著敏捷性和擴展而發展到在部署到本地或雲的單一體系結構中難以達到的限制環境。The main pillars of Cloud-Native applications are based on microservices architecture approaches, which can evolve with agility and scale to limits that would be difficult to achieve in a monolithic architecture, deployed to either on-premises or cloud environment.

圖 4-4 顯示了雲原生模型的主要特徵。Figure 4-4 shows the main characteristics of the Cloud-Native model.

圖表列出了主要的雲原生特徵。

圖 4-4。Figure 4-4. 雲原生特徵Cloud-Native characteristics

此外,您還可以通過添加其他服務(如人工智慧 (AI)、機器學習 (ML) 和 IoT 來擴展基本的現代 Web 應用和雲原生應用。In addition, you can extend basic modern web apps and cloud-native apps by adding other services, like artificial intelligence (AI), machine learning (ML), and IoT. 您可以使用這些服務中的任何一種來擴展任何可能的雲優化方法。You might use any of these services to extend any of the possible Cloud-Optimized approaches.

雲原生級別應用程式的根本區別在於應用程式體系結構。The fundamental difference in applications at the Cloud-Native level is in the application architecture. 根據定義,雲原生應用程式是基於微服務的應用程式。Cloud-native applications are, by definition, apps that are based on microservices. 與整體 Web 應用程式或傳統的 N-Tier 應用程式相比,雲原生應用需要特殊的體系結構、技術和平臺。Cloud-native apps require special architectures, technologies, and platforms, compared to a monolithic web application or traditional N-Tier application.

雲原生應用程式詳細資訊Cloud-native applications details

對於大型和任務關鍵型應用程式,雲原生是更高級或更成熟的狀態。Cloud-Native is a more advanced or mature state for large and mission-critical applications. 雲原生應用程式通常需要從頭開始創建的體系結構和設計,而不是通過對現有應用程式進行現代化。Cloud-Native applications usually require architecture and design that are created from scratch instead of by modernizing existing applications. 雲原生應用程式和更簡單的雲優化 Web 應用之間的主要區別是建議在雲原生方法中使用微服務體系結構。The key difference between a Cloud-Native application and a simpler Cloud-Optimized web app is the recommendation to use microservices architectures in a cloud-native approach. 雲優化應用也可以是單一 Web 應用或 N 層應用。Cloud-Optimized apps can also be monolithic web apps or N-Tier apps.

十二因數應用(與微服務方法密切相關的模式集合)也被視為雲原生應用程式體系結構的要求。The Twelve-Factor App (a collection of patterns that are closely related to microservices approaches) is also considered a requirement for cloud-native application architectures.

雲原生計算基礎 (CNCF)是雲原生原則的主要推動者。The Cloud Native Computing Foundation (CNCF) is a primary promoter of cloud-native principles. 微軟是CNCF的成員Microsoft is a member of the CNCF.

有關如何設計和開發雲原生應用程式的詳細指南,請閱讀以下免費電子書:For detailed guidance on how to design and develop cloud-native applications, read the following free e-books:

如果將完整應用程式遷移到雲原生模型時,需要考慮的最重要因素是必須重新構建為基於微服務的體系結構。The most important factor to consider if you migrate a full application to the cloud-native model is that you must rearchitect to a microservices-based architecture. 這顯然需要對開發進行重大投資,因為涉及大量的重構過程。This clearly requires a significant investment in development because of the large refactoring process involved. 此選項通常針對需要新級別的可擴充性和長期敏捷性的任務關鍵型應用程式選擇。This option usually is chosen for mission-critical applications that need new levels of scalability and long-term agility. 但是,您可以通過為幾個新方案添加微服務,並最終將應用程式完全重構為微服務,從而開始向雲原生方向發展。But, you could start moving toward cloud-native by adding microservices for just a few new scenarios, and eventually refactor the application fully as microservices. 這是一種增量方法,是某些方案的最佳選擇。This is an incremental approach that is the best option for some scenarios.

微服務呢?What about microservices?

當您為組織考慮雲原生應用程式時,瞭解微服務及其工作方式非常重要。Understanding microservices and how they work is important when you are considering cloud-native applications for your organization.

微服務體系結構是一種高級方法,可用於從頭開始創建的應用程式,或者當您將現有應用程式發展到雲原生應用程式時。The microservices architecture is an advanced approach that you can use for applications that are created from scratch or when you evolve existing applications toward cloud-native applications. 您可以首先向現有應用程式添加一些微服務,以瞭解新的微服務範例。You can start by adding a few microservices to existing applications to learn about the new microservices paradigms. 但顯然,您需要構建和編碼,尤其是對於這種類型的體系結構方法。But clearly, you need to architect and code, especially for this type of architectural approach.

但是,對於任何新的或現代的應用程式來說,微服務並不是強制性的。However, microservices are not mandatory for any new or modern application. 微服務不是"靈丹妙藥",它們不是創建每個應用程式的單一最佳方法。Microservices are not a "magic bullet," and they aren't the single, best way to create every application. 使用微服務的方式和時間取決於需要構建的應用程式類型。How and when you use microservices depends on the type of application that you need to build.

微服務體系結構正在成為分散式、大型或複雜任務關鍵型應用程式的首選方法,這些應用程式基於多個獨立子系統,以自治服務的形式存在。The microservices architecture is becoming the preferred approach for distributed and large or complex mission-critical applications that are based on multiple, independent subsystems in the form of autonomous services. 在基於微服務的體系結構中,應用程式構建為可獨立開發、測試、版本控制、部署和縮放的服務集合。In a microservices-based architecture, an application is built as a collection of services that can be independently developed, tested, versioned, deployed, and scaled. 這可以包括每個微服務的任何相關的自主資料庫。This can include any related, autonomous database per microservice.

有關可以使用 .NET Core 實現的微服務體系結構的詳細資訊,請參閱可下載的 PDF 電子書.NET 微服務:容器化 .NET 應用程式的體系結構For a detailed look at a microservices architecture that you can implement by using .NET Core, see the downloadable PDF e-book .NET microservices: Architecture for containerized .NET applications. 指南也可線上獲取。The guide also is available online.

但是,即使在微服務提供與功能無關的強大部署、強大的子系統邊界和技術多樣性的情況下,它們也會帶來許多新的挑戰。But even in scenarios in which microservices offer powerful capabilities-independent deployment, strong subsystem boundaries, and technology diversity-they also raise many new challenges. 這些挑戰與分散式應用程式開發有關,例如零碎和獨立的資料模型;實現微服務之間的彈性通信;需要最終一致性;和操作複雜性。The challenges are related to distributed application development, such as fragmented and independent data models; achieving resilient communication between microservices; the need for eventual consistency; and operational complexity. 與傳統的單片應用相比,微服務引入了更高的複雜性。Microservices introduce a higher level of complexity compared to traditional monolithic applications.

由於微服務體系結構的複雜性,只有特定的方案和某些應用程式類型適用于基於微服務的應用程式。Because of the complexity of a microservices architecture, only specific scenarios and certain application types are suitable for microservice-based applications. 其中包括具有多個不斷發展的子系統的大型複雜應用程式。These include large and complex applications that have multiple, evolving subsystems. 在這些情況下,值得投資更複雜的軟體體系結構,提高長期敏捷性和更高效的應用程式維護。In these cases, it's worth investing in a more complex software architecture, for increased long-term agility and more efficient application maintenance. 但對於不太複雜的方案,最好繼續採用整體應用程式方法或更簡單的 N-Tier 方法。But for less complex scenarios, it might be better to continue with a monolithic application approach or simpler N-Tier approaches.

最後,即使存在重複這個概念的風險,您也不應該將應用程式中的微服務視為"全功能化或根本不"。As a final note, even at the risk of being repetitive about this concept, you shouldn't look at using microservices in your applications as "all-in or nothing at all." 您可以通過添加基於微服務的新小方案來擴展和演變現有的整體應用程式。You can extend and evolve existing monolithic applications by adding new, small scenarios based on microservices. 無需從頭開始使用微服務體系結構方法。You don't need to start from scratch to start working with a microservices architecture approach. 事實上,我們建議您通過添加新方案,從使用現有的單片或 N-Tier 應用程式演變而來。In fact, we recommend that you evolve from using an existing monolithic or N-Tier application by adding new scenarios. 最終,您可以將應用程式分解為自治元件或微服務。Eventually, you can break down the application into autonomous components or microservices. 您可以逐步逐步地開始朝著微服務方向發展整體應用程式。You can start evolving your monolithic applications in a microservices direction, step by step.

在任何情況下,本指南的其餘部分將主要側重于"無基於微服務的應用",因為本指南主要針對通常具有整體或 N-Tier 體系結構的現有應用的現代化。In any case, the rest of this present guidance focuses most of all on "no microservices-based apps" because this guidance is mainly targeting the modernization of existing apps that usually have monolithic or N-Tier architectures.