烂翻译系列之面向.NET开发人员的Dapr——分布式世界

The world is distributed

分布式世界

Just ask any 'cool kid':Modern, distributed systems are in, and monolithic apps are out!

随便问一个酷小子,他们都会说:现代、分布式系统时间已经到来,单体应用已经成为过去式!

But, it's not just "cool kids." Progressive IT Leaders, corporate architects, and astute developers are echoing these same thoughts as they explore and evaluate modern distributed applications. Many have bought in. They're designing new and replatforming existing enterprise applications following the principles, patterns, and practices of distributed microservice applications.

但并不只是 "酷小子"。 卓越的IT领袖、企业架构师和精明的开发人员在探索和评估现代分布式应用程序时,会响应这些想法(产生共鸣)。 许多人都认同接受。 他们正在按照分布式微服务应用程序的原理、模式和实践设计新的和重构现有企业应用程序。

But, this evolution raises many questions...

What exactly is a distributed application?

Why are they gaining popularity?

What are the costs?

And, importantly, what are the tradeoffs?

但是演进引发了许多问题 .。。

究竟什么是分布式应用程序?

为什么他们会获得欢迎?

要付出哪些成本(代价)?

重要的是,需要做哪些折衷?

To start, let's rewind and look at the past 15 years. During this period, we typically constructed applications as a single, monolithic unit. Figure 1-1 shows the architecture.

 首先,让我们倒带,看看过去15年。 在此期间,我们通常将应用程序构建成单体应用。 图1-1 显示了此体系结构。

Figure 1-1. Monolithic architecture.

图 1-1。 单体应用体系结构。

Note how the modules for Ordering, Identity, and Marketing execute in a single-server process. Application data is stored in a shared database. Business functionality is exposed via HTML and RESTful interfaces.

注意用于订单、标识和营销的模块在单服务器进程中的执行方式。 应用程序数据存储在共享数据库中。 业务功能通过 HTML 和 RESTful 接口公开。

In many ways, monolithic apps arestraightforward. They're straightforward to:

Build

Test

Deploy

Troubleshoot

Scale vertically (scale up)

在许多方面,单体应用程序简单明了。 它们能直截了当地:

构建

测试

部署

疑难解答

垂直缩放 (向上扩展)

However, monolithic architectures can present significant challenges.

但单体结构可能会带来重大挑战。

Over time, you may reach a point where you begin to lose control...

The monolith has become so overwhelmingly complicated that no single person understands it.

You fear making changes as each brings unintended and costly side effects.

New features/fixes become time-consuming and expensive to implement.

Even the smallest change requires full deployment of the entire application - expensive and risky.

One unstable component can crash the entire system.

Adding new technologies and frameworks aren't an option.

Implementing agile delivery methodologies are difficult.

Architectural erosion sets in as the code base deteriorates with never-ending "special cases."

Eventually the consultants come in and tell you to rewrite it.

随着时间的推移,你可能会在某个时间点开始失控...

单体架构已变得非常复杂,没有人能理解(看懂)它。

您担心每个更改都会带来意想不到且代价高昂的副作用。

新功能/修补程序的实现非常耗时且成本高昂。

即使是最小的更改,也需要完全部署整个应用程序-成本高昂且风险巨大。

一个不稳定的组件可能会破坏整个系统。

添加新的技术和框架不太自由方便。

实现敏捷交付非常困难。

随着代码库的恶化,体系结构也被腐蚀,充斥着无止境的 "特殊情况"。

最终,顾问会介入,并告诉你重构它。

IT practitioners call this conditionthe Fear Cycle. If you've been in the technology business for any length of time, good chance you've experienced it. It's stressful and exhausts your IT budget. Instead of building new and innovative solutions, most of your budget is spent maintaining legacy apps.

IT 从业人员称此限制条件为恐怖循环。 如果你已在技术业务中花费了很长时间,很可能经历过这种情况。 倍感压力并耗尽您的 IT 预算。 大多数预算都用来维护旧应用,而不是构建新的创新性解决方案。

Instead of fear, businesses requirespeed and agility. They seek an architectural style with which they can rapidly respond to market conditions. They need to instantaneously update and individually scale small areas of a live application.

企业要求速度与灵活性,而不是担心。 他们会寻找一种架构样式,使其能够快速响应市场状况。 他们需要即时更新和单独缩放实时应用程序的某个小区域。

An early attempt to gain speed and agility came in the form ofService Oriented Architecture, orSOA. In this model, service consumers and service providers collaborated via middleware messaging components, often referred to as anEnterprise Service Bus, orESB. Figure 1-2 shows the architecture.

最早在面向服务的体系结构或SOA的基础上,尝试获得速度和灵活性。 在此模型中,服务使用者和服务提供商通过中间件消息传送组件进行协作,通常称为企业服务总线,或ESB。 图1-2 显示了此体系结构。

Figure 1-2. SOA architecture.

图 1-2。 SOA 体系结构。

With SOA, centralized service providers registered with the ESB. Business logic would be built into the ESB to integrate providers and consumers. Service consumers could then find and communicate with these providers using the ESB.

对于 SOA,集中式服务提供者向 ESB 注册。 将业务逻辑内置于 ESB 中以集成提供者和使用者。 然后,服务使用者可以使用 ESB 查找这些提供者并与其通信。

Despite the promises of SOA, implementing this approach often increased complexity and introduced bottlenecks. Maintenance costs became high and ESB middleware expensive. Services tended to be large. They often shared dependencies and data storage. In the end, SOAs often resulted in a 'distributed monolithic' structure with centralized services that were resistant to change.

尽管有 SOA 的保证,但实现此途径通常会增加复杂性并引入瓶颈。 维护成本变得很高,ESB 中间件成本高昂。 服务倾向大。 它们通常共享依赖和数据存储。 最终,Soa 通常会产生一个带有集中服务的 "分布式单体" 结构,这些服务很难更改。

Nowadays, many organizations have realized speed and agility by adopting a distributed microservice architectural approach to building systems. Figure 1-3 shows the same system built using distributed techniques and practices.

如今,许多组织通过采用分布式微服务体系结构方法构建系统来实现速度和灵活性。 图1-3 显示了使用分布式技术和实践构建的同一系统。

Figure 1-3. Distributed architecture.

图 1-3。 分布式体系结构。

Note how the same application is decomposed across a set of distributed services. Each is self-contained and encapsulates its own code, data, and dependencies. Each is deployed in a software container and managed by a container orchestrator. Instead of a single database shared by multiple services, each service owns a private database. Other services can't access this database directly and can only get to data that is exposed through the public API of the service that owns it. Note how some services require a full relational database, but others, a NoSQL datastore. The basket service stores its state in a distributed key/value cache. Note how inbound traffic routes through an API Gateway service. It's responsible for directing calls to services and enforcing cross-cutting concerns. Most importantly, the application takes full advantage of the scalability, availability, and resiliency features found in modern cloud platforms.

注意如何将同一应用分解为一系列分布式服务。 每个都是自包含的,并封装自己的代码、数据和依赖项。 每个部署在软件容器中并由容器编排器管理。 每个服务都拥有一个专用数据库,而不是由多个服务共享的单个数据库。 其他服务不能直接访问此数据库,只能通过拥有它的服务的公共 API 获取数据。 请注意,某些服务需要关系数据库,而另一些则是 NoSQL 数据存储。 购物篮服务将其状态存储在分布式键/值缓存中。 请注意入站通讯如何通过 API 网关服务路由。 它负责将调用定向到服务并强制横切关注点。 最重要的是,应用程序充分利用了现代云平台中的可伸缩性、可用性和复原功能。

But, while distributed services can provide agility and speed, they present a different set of challenges. Consider the following...

How can distributed services discover each other and communicate synchronously?

How can they implement asynchronous messaging?

How can they maintain contextual information across a transaction?

How can they become resilient to failure?

How can they scale to meet fluctuating demand?

How are they monitored and observed?

但是,尽管分布式服务可提供灵活性和速度,但它们却引入了不同的挑战。 请考虑以下事项...

分布式服务如何相互发现并进行同步通信?

如何实现异步消息传送?

如何在事务中维护上下文信息?

如何才能灵活应对故障?

如何缩放以满足不断变化的需求?

如何监视和观察它们?

For each of these challenges, multiple products are often available. But, shielding your application from product differences and keeping code maintainable and portable become a challenge.

对于上述每种挑战,多种产品可供使用。 但是,保护应用程序不受产品差异影响,保持代码的可维护性和可移植性将成为一项挑战。

This book introduces Dapr. Dapr is a distributed application runtime. It directly addresses many of the challenges found that come along with distributed applications. Looking ahead, Dapr has the potential to have a profound impact on distributed application development.

本书介绍了 Dapr。 Dapr 是分布式应用程序运行时。 它直接解决了分布式应用程序附带的许多挑战。 展望未来,Dapr 有可能对分布式应用程序开发产生深远影响。

Summary

总结

In this chapter, we discussed the adoption of distributed applications. We contrasted a monolithic system approach with that of distributed services. We pointed out many of the common challenges when considering a distributed approach.

在本章中,我们讨论了分布式应用程序的采用。 我们对比了单体系统方法与分布式服务方法。 考虑分布式方法时,我们指出了许多常见的难题。

Now, sit back, relax, and let us introduce you the new world of Dapr.

现在,坐下来,放松,让我们向您介绍Dapr的新世界。

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 194,390评论 5 459
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 81,821评论 2 371
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 141,632评论 0 319
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 52,170评论 1 263
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 61,033评论 4 355
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 46,098评论 1 272
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 36,511评论 3 381
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 35,204评论 0 253
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 39,479评论 1 290
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 34,572评论 2 309
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 36,341评论 1 326
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 32,213评论 3 312
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 37,576评论 3 298
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 28,893评论 0 17
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,171评论 1 250
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 41,486评论 2 341
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 40,676评论 2 335

推荐阅读更多精彩内容