Skip to Content
Dapr学习手册
book

Dapr学习手册

by Haishi Bai, Yaron Schneider
November 2021
Beginner to intermediate
239 pages
4h 15m
Chinese
China Electric Power Press Ltd.
Content preview from Dapr学习手册
服务
49
保存了状态,当重启发生时,这些状态将会丢失。如果你的服务需要很长的
时间来初始化,那么服务的可用性也会受到影响。此外,如果你在本地保存
状态,如通过将文件写入本地驱动器,那么迁移发生时,这些状态也将丢失。
迁移状态总是很麻烦的。因此,许多云工作负载管理系统要求应用程序是无
状态的,这意味着这些应用程序不会将任何本地状态保存到托管环境中。
将应用程序从一个服务器移动到另一个服务器是需要时间的。如果应用程序
可以被分解成更小的片段,那么移动和恢复这些更小的片段就会更有效率。
使用这些较小的服务(有时被称为微服务),正在成为组成应用程序的事实
方式。微服务通常是松耦合的,因为它们应该在其对等服务被移动和重启时
保持功能可用。
如果你的服务必须是有状态的,这意味着它必须保存一些本地状态,则这些
状态需要被复制以确保可用性。在这种情况下,通常使用单个写入器而不是
多个写入器来避免数据冲突。
1.2.2
弹性
当对服务的需求超过托管服务器的容量时,有两种可行的解决方案:可以将
服务迁移到更强大的服务器上,或者部署服务的多个副本以分担工作负载。
后一种方法被称为扩展(
scale out
),是在云中进行扩展的首选方式。因为云
提供商拥有数量庞大的服务器,理论上单个服务可以无限扩展。反过来说,
当工作负载减少时,可以收缩(
scale in
)服务以释放不使用的计算能力。因
为你要为你在云中使用的东西付费,如果你的工作负载有季节性的高负载(如
零售企业)或偶尔的高峰(如新闻企业),这种弹性可以极大的节省成本。
对于简单的
W
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

流畅的Python(第2版)

流畅的Python(第2版)

Luciano Ramalho
数据科学原理

数据科学原理

Posts & Telecom Press, Sinan Ozdemir
Python预测分析实战

Python预测分析实战

Posts & Telecom Press, Alvaro Fuentes
机器学习开发者指南

机器学习开发者指南

Posts & Telecom Press, Rodolfo Bonnin

Publisher Resources

ISBN: 9787519859367