Skip to Content
构建可扩展分布式系统:方法与实践
book

构建可扩展分布式系统:方法与实践

by Ian Gorton
May 2024
Intermediate
278 pages
5h 24m
Chinese
China Machine Press
Content preview from 构建可扩展分布式系统:方法与实践
应用服务
|
103
5.5
总结和延伸阅读
服务是可扩展软件系统的核心。它们将契约定义为一个
API
,向客户端声明它们的能力。
服务运行在一个应用服务器容器环境中,服务器容器托管了服务代码,并将传入的
API
请求路由到适当的处理逻辑。应用服务器高度依赖于编程语言,但通常都会提供多线程
编程模型,允许服务同时处理许多请求。如果容器线程池中的线程都被使用,应用服务
器则会将请求排到队列中,直到有线程可用。
随着服务请求负载的增长,我们可以利用负载均衡器进行水平扩展,以便在多个实例之
间分配请求。这种架构还提供了高可用性,因为多服务配置意味着应用程序可以容忍单
个实例的故障。服务实例由负载均衡器用池的方式进行管理,负载均衡器利用负载分配
策略为每个请求选择目标服务副本。无状态服务允许负载均衡器简单地将请求重新发送
到响应目标,从而轻松实现扩展并简化故障场景。尽管大多数负载均衡器采用被称为粘
性会话的特性来支持有状态服务,但有状态服务会使得负载均衡和处理故障更加复杂。
因此,不建议在高度可扩展的系统中采用有状态服务。
API
设计是一个非常复杂且有争议的话题。
Thoughtworks
博客(
https://oreil.
ly/qCl1B
)上提供了一份针对基本
API
设计和资源建模的优秀概述。
Java
企业版(
JEE
)是一种成熟且被广泛部署的服务器端技术,它在不同范围提供了高
度抽象的规范,可用于构建丰富而强大的服务。
Oracle
教程(
https://oreil.ly/IGW1N
)是
了解这个平台的绝佳起点。
很多关于负载均衡器的知识和信息都隐藏在技术供应商提供的文档中 ...
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

What Successful Brick-and-Mortar Retailers Get Right

What Successful Brick-and-Mortar Retailers Get Right

Rob Angell
What Successful Project Managers Do

What Successful Project Managers Do

W. Scott Cameron, Jeffrey S. Russell, Edward J. Hoffman, Alexander Laufer
Three Essentials for Agentic AI Security

Three Essentials for Agentic AI Security

Paolo Dal Cin, Daniel Kendzior, Yusof Seedat, Renato Marinho

Publisher Resources

ISBN: 9787111750697