open-courses
  • 公开课笔记
  • CMU 15-445/645 Database Systems
    • Relational Data Model
    • Advanced SQL
    • Database Storage
    • Buffer Pools
    • Hash Tables
    • Tree Indexes
    • Index Concurrency Control
    • Query Processing
    • Sorting&Aggregations
    • Join Algorithms
    • Query Optimization
    • Parallel Execution
    • Embedded Database Logic
    • Concurrency Control Theory
    • Two Phase Locking
    • Timestamp Ordering Concurrency Control
    • Multi-Version Concurrency Control
    • Logging Schemes
    • Database Recovery
    • Introduction to Distributed Databases
    • Distributed OLTP Databases
    • Distributed OLAP Databases
  • UCB - CS162
    • OS intro
    • Introduction to the Process
    • Processes, Fork, I/O, Files
    • I/O Continued, Sockets, Networking
    • Concurrency: Processes & Threads
    • Cooperating Threads, Synchronization
    • Semaphores, Condition Variables, Readers/Writers
    • Scheduling
    • Resource Contention & Deadlock
    • Address Translation, Caching
    • File System (18,19,20)
    • Distributed Systems, Networking, TCP/IP, RPC (21,22)
    • Distributed Storage, Key-Value Stores, Security (23)
    • Security & Cloud Computing (24)
    • Topic: Ensuring Data Reaches Disk
  • MIT - 6.006
    • Sequence and Set Interface
    • Data Structure for Dynamic Sequence Interface
    • Computation Complexity
    • Algorithms and Computation
    • Structure Of Computation
    • Graph & Search
    • Tree & Search
    • Weighted Shortest Paths
    • String Matching, Karp-Rabin
    • Priority Queue Interface & Implementation
    • Dictionary Problem & Implementation
    • Sorting
    • Dynamic Programming
    • Backtracking
    • Self-Balancing Tree
  • MIT - 6.824
    • 2PC & 3PC
    • Introduction and MapReduce
    • RPC and Threads
    • Primary/Backup Replication
    • Lab: Primary/Backup Key/Value Service
    • Google File System (GFS)
    • Raft
    • Lab: Raft - Leader Election
    • Lab: Raft - Log Replication
  • Stanford-CS107
    • 原始数据类型及相互转化
    • 指鹿为马
    • 泛型函数
    • 泛型栈
    • 运行时内存结构
    • 从 C 到汇编
    • 函数的活动记录
    • C 与 C++ 代码生成
    • 编译的预处理过程
    • 编译的链接过程
    • 函数的活动记录续、并发
    • 从顺序到并发和并行
    • 信号量与多线程 1
    • 信号量与多线程 2
    • 复杂多线程问题
    • 函数式编程 - Scheme 1
    • 函数式编程 - Scheme 2
    • 函数式编程 - Scheme 3
    • 函数式编程 - Scheme 4
    • 函数式编程 - Scheme 5
    • Python 基础
  • MIT - 6.001 - SICP
    • 什么是程序
    • 程序抽象
    • 替代模型
    • 时间/空间复杂度
    • 数据抽象
    • 高阶函数
    • Symbol
    • 数据驱动编程与防御式编程
    • 数据抽象中的效率与可读性
    • 数据修改
    • 环境模型
    • 面向对象-消息传递
    • 面向对象 - Scheme 实现
    • 构建 Scheme 解释器
    • Eval-Apply Loop
    • Normal Order (Lazy) Evaluation
    • 通用机
    • 寄存器机器
    • 子程序、栈与递归
    • 在寄存器机器中执行
    • 内存管理
  • MIT - 6.046
    • Randomized Algorithms
    • Skip Lists
  • System Design
    • Twitter
    • Cache Consistency & Coherence
  • DDIA 笔记
    • Replication
    • Transactions
    • The Trouble with Distributed Systems
    • Consistency & Consensus
  • Papers We Love
    • Consistent Hashing and Random Trees (1997)
    • Dynamic Hash Tables (1988)
    • LFU Implementation With O(1) Complexity (2010)
    • Time, Clocks, and the Ordering of Events in a Distributed System (1978)
    • Dapper, a Large-Scale Distributed Systems Tracing Infrastructure (2010)
    • Gorilla: A Fast, Scalable, In-Memory Time Series Database (2015)
  • Release It 笔记
    • Anti-patterns & Patterns in Microservice Architecture
  • Database Design
    • Log Structured Merge (LSM) Tree & Usages in KV Stores
    • Prometheus
Powered by GitBook
On this page
  • Distributed Systems
  • Centralized vs. Distributed Systems
  • Motivation/Issue
  • Networking
  • Protocol
  • 剩余话题概括
  • 参考
  1. UCB - CS162

Distributed Systems, Networking, TCP/IP, RPC (21,22)

本节可以理解成是计算机网络原理课程的一个概括

PreviousFile System (18,19,20)NextDistributed Storage, Key-Value Stores, Security (23)

Last updated 5 years ago

Distributed Systems

Centralized vs. Distributed Systems

Centralized System 中,绝大部分功能都在一台物理机器上完成。最开始连客户端也在同一台机器上,后来逐渐演化成 C/S 模型。

Distributed System 中,不同计算机通过合作的方式完成一项任务。早期以同机房下的多台机器组成的集群形式为主,后来逐渐演化为 peer-to-peer/wide-spread collaboration。

Motivation/Issue

Why do we want distributed systems?

  • 造许多简单的计算机与造一台复杂计算机相比,前者成本低且难度小

  • 容易逐渐扩容和缩容

  • 用户可以对部分机器拥有完全控制权

  • 方便更多的用户通过网络合作

The promise of distributed systems

  • Higher availability:一台机器挂了,用另一台

  • Better durability:复制数据

  • More security:更小的粒度上进行安全控制

理想很丰满,现实很骨感。现实是:

  • Worse availability:availability 有赖于所有正在运行的机器,任何服务挂了都有可能导致服务不可用。Lamport 曾说:“a distributed system is one where I can't do work because some machine I've never heard of isn't working!”

  • Worse reliability:机器崩溃可能导致数据丢失

  • Worse security:世界上任何人都可以入侵到系统中

除此之外,随着机器数量增加,正确、合理地调度所有机器 (coordination) 来共同完成任务变得异常困难。

What would be easy in a centralized system becomes a lot more difficult

Goals & Requirements

如果只用一个词概括 Distributed System 的目标,那就是 Transparency。

The ability of the system to mask its complexity behind a simple interface

这里的 transparency 又包括:

  • Location:无需知道资源的位置

  • Migration:资源在用户无感知的情况下可能被合理移动

  • Replication:无需知道资源有多少份副本

  • Concurrency:无需关心有多少用户正在使用资源

  • Parallelism:系统可以通过将大任务拆分成小任务,再通过并行的方式加速任务运行

  • Fault Tolerance:系统中出现少量问题用户无感知

Networking

Protocol

Distributed system 中,分布在不同机器上的不同进程间需要通过某种方式来交流,我们可以用人类之间交流使用的不同的语言来类比。在计算机范畴中,我们将这些方式称为 protocol。Protocol 包括两部分:

  • Syntax:信息的识别和构成,包括格式、信息展示的顺序等等

  • Semantics:信息的含义

对应语言,Syntax 就是语法,Semantics 就是语义。通常, protocol 可以使用状态机 (state machine) 来表示。

剩余话题概括

这里忽略网络部分的剩余讨论,该部分内容与网络原理、分布式系统等课程内容有交叉,话题包括:

  • Client/Server vs. Peer-to-Peer

  • Network Protocols

    • Broadcast (Aloha network)

    • Carrier Sense, Multiple Access/Collision Detection (CSMA/CD)

    • Point-to-point

    • The Internet Protocol (IP)

      • Address Subnets

      • Address Ranges

      • Hierarchical Networking

      • Routing/Routing Tables

      • DNS

  • Network Layering

  • TCP/IP

    • ordering

    • reliable delivery (exactly once)

    • congestion avoidance

    • sequence number

  • Sockets

  • Distributed Decision Making

    • General's Paradox

    • Byzantine General's Problem

  • RPC & Microkernel operating systems

参考

lecture note ,

2PC
21
22
centralized
Distributed