1.design_purpose

什么是分布式系统? 一个分布式系统, 从物理上说是 用户 -network- 多台服务器主机 形成的一个特殊的系统 如果对这个模型进行抽象, 其实就是 单个terminal 和 多个 process 之间的通信, 其中, 这些 process 空间上分离, 通过网络进行通信, 不应该存在明显延迟, 并且命运不同(一台主机挂了不应该影响其他主机) ...

2025-08-30 · 2 min · Yuchen You

1. Database Management System

DBMS (Database Management System) A software package designed to store and manage databases. Often loosely called a database. 传统的数据管理, 往往是结合 csv 格式文件来将数据存储起来, 并且允许通过各种约束条件查找, 但是假设存在一个学生数据库系统, 包括 姓名, 年龄, id, 成绩等字段, 如果原始数据的存储方式是分成两个 文件, 一个存储 姓名到 id 的映射, 另一个存储 id 到成绩的映射, 那么采用传统的 c++ 等语言来查找数据, 会存在很多问题, 例如, atomic 的操作, 很难在确保 performance 的前提下能保证 consistency ...

2025-08-30 · 7 min · Yuchen You

7. Gray Failure the Achilles' Heel of Cloud-Scale Systems

Introduction 这篇文章系统性地提出并定义了云计算系统中的"灰色故障"(Gray Failure)问题, 认为它是当前云基础设施高可用性的一大障碍 gray failure component failures whose manifestations are fairly subtle and thus defy quick and definitive detection 系统某部分发生了轻微但持续的问题, 这些问题不易被传统故障检测机制发现, 但已经影响了应用层的性能和可用性;它不同于"失败即停" (fail-stop) 故障, 后者更易被监测和处理 ...

2025-06-01 · 2 min · Yuchen You

6. Fail Stutter Fault Tolerance

Introduction 背景问题缺陷 Byzantine 模型假设组件可能出现任意错误甚至恶意行为, 过于复杂难以实施; Fail-stop 模型假设组件要么正常工作, 要么完全停止, 虽然简单易用, 但忽视了现代硬件中常见的"性能故障"; 本文特点 Fail-Stutter 模型: a realistic and yet tractable fault model that accounts for both absolute failure and a new range of performance failures common in modern components. ...

2025-05-31 · 6 min · Yuchen You

5. Fail-Slow at Scale

Introduction 这篇论文 Fail-Slow at Scale: Evidence of Hardware Performance Faults in Large Production Systems 由Haryadi S. Gunawi等人发表在第16届USENIX文件与存储技术会议(FAST 2018)上 系统性地揭示了在大规模生产系统中"fail-slow"(故障-缓慢)硬件现象的存在与影响;这类故障指的是硬件仍在运行, 但其性能严重退化, 未达到应有的标准; ...

2025-05-27 · 13 min · Yuchen You

3. Metastable Failures in Distributed Systems

Introduction metastable failures 亚稳态故障 a failure pattern in distributed systems Currently, metastable failures manifest themselves as black swan events(黑天鹅事故) they are outliers(异常事故) because nothing in the past points to their possibility have a severe impact much easier to explain in hindsight(事后) than to predict. Although instances of metastable failures can look different at the surface, deeper analysis shows that they can be understood within the same framework. By reviewing experiences from a decade of operating hyperscale distributed systems, we identify a class of failures that can disrupt them, even when there are no hardware failures, configuration errors, or software bugs. ...

2025-05-22 · 4 min · Yuchen You

4. Metastable Failures in the Wild

Introduction 这篇文章是基于 MetaStable Failures in Distributed Systems 的升级, in the wild 指的是不可控的实际世界 In this work, we study the prevalence(患病率) of such failures in the wild by scouring(冲刷) over publicly available incident reports from many organizations, ranging from hyperscalers to small companies In this paper, we make four contributions that extend the work of Bronson et al. and increase our understanding of metastable failures: A study of metastable failures in the wild that confirms metastable failures are universally observed and comprise a substantial fraction of the most severe outages (Section 2). An improved model that categorizes two types of triggers and two types of amplification mechanisms, which better explains how metastable failures happen (Section 3). An insider view at Twitter of a new type of metastable failure where garbage collection acts as an amplification mechanism (Section 4). Three example applications on which metastable failures are experimentally reproduced, which helps researchers propose and test solutions to metastable failures (Section 5). Metastability in the Wild 这一段主要讲了作者对近年来各大小厂的故障并且进行了原因分析和类型总结概括: ...

2025-05-22 · 5 min · Yuchen You

2. Predictive and Adaptive Failure Mitigation to Avert Production Cloud VM Interruptions

When a failure occurs in production systems, the highest priority is to quickly mitigate(缓解) it. Failure Mitigation (FM) is done in a reactive and ad-hoc way, namely taking some fixed actions only after a severe symptom is observed. Propose a preventive and adaptive failure mitigation service, NARYA, that is integraed in a production cloud, Microsoft Azure’s compute platform Narya predicts imminent(迫在眉睫的) host failures based on multi-layer system signals then decides smart mitigation actions goal: avert(避免) VM failures Narya’s decision engine takes a novel online experimentation approach to continually explore the best mitigation action. enhances the adaptive decision capability through reinforcement learning. Introduction key question ...

2025-05-13 · 6 min · Yuchen You

1. AIOpsLab: A Holistic Framework to Evaluate AI Agents for Enabling Autonomous Clouds

AI for IT Operations (AIOps) aims to automate complex operational tasks, such as fault localization and root cause analysis traditional: ddressing isolated operational tasks LLM and AI agents: enabling end-to-end and multitask automation Target: self-healing cloud systems, a paradigm we term AgentOps AIOpsLab a framework that not only deploys micro-service cloud environments, injects faults, generates workloads, and exports telemetry(遥测得的) data but also orchestrates these components and provides interfaces for interacting with and evaluating agents. The ultimate goal of AIOps(different from AgentOps) is to create autonomous self-healing clouds, where AI-driven approaches can detect, localize, and mitigate faults with minimal human intervention. ...

2025-05-12 · 5 min · Yuchen You

9. 数字取证 Digital-Forensics

数字取证流程(Digital Forensics Process) 四个核心阶段 识别(Identification) 确定存储关键数据的物理/数字对象(如计算机, 硬盘, 移动设备, 外接媒体等); 收集(Collection) 保护证据完整性, 建立链式监管(Chain of Custody), 记录证据哈希(Hash of Image)以验证来源; 分析(Analysis) 检查文件系统, 日志, 内存等, 恢复删除文件(Deleted Files)或残留数据(Slack Space); 报告(Reporting) 形成专家报告, 提供法律证据(Legal Evidence); 数据收集与保存(Data Collection & Preservation) 数据来源 computer other harddrive monitor keyboard and mouse media (dvd, cd, usb) printer digital forensics did not replace traditional (physical) forensic analysis 需要确保数据的原始性, 任何经过操作的数据都不能完全展示当时的情况, 因此需要创建 forensic image (carefully created copy) 来进行保存 Principle for collecting evidence Maintain a chain of custody physically secure items of evidence track possession step by step keep documentation (hash image) to trace evidence to the src Priotize collection by volatility 脆弱的数据首先保存 RAM > disk > external media 2.1 法医镜像(Forensic Image) 定义: 全盘位对位拷贝(Bit-for-Bit Copy), 保留所有数据(包括删除文件, slack/internal fragmentation 空间); 工具: dd if=/path/to/forensic/src of=/path/to/store 需使用 写阻止器(Write-Blocker) 防止修改原始数据; (只允许 read) 从而防止分析的 pc 篡改数据 一般会额外计算一个 hash 来确保数据的完整性 2.2 内存取证(Live-Memory Forensics) 只将 ram 里面的数据进行复制 利用了 thunderbolt (由英特尔(Intel)和苹果(Apple)共同开发的一种高速数据传输接口技术, 它集数据传输, 视频输出和供电于一体) 冷启动攻击(Cold-Boot Attack): 通过物理重启并快速镜像未擦除的RAM数据; 一般情况下电脑重启会擦除 RAM 中的数据 虚拟化快照(VM Snapshot): 同时捕获内存与磁盘状态; 对于不可以重启的OS, 可以考虑 freeze disk+ram (mem chip) 并且移存至其他硬件设备 2.3 移动设备取证(Mobile Device Forensics) 挑战: 可能会被 无线电波 radio 连接进行数据篡改 远程擦除防御: 使用 法拉第袋(Faraday Bag) 屏蔽无线信号; 硬件级加密(Hardware-Backed Security)与取证工具对抗; 3. 存储结构与取证线索(Storage Structure & Clues) 低级别存储(Low-Level Storage) 块(Blocks): 存储设备基本单元(通常4KB); 文件系统(Filesystem): 通过 索引节点(I-Node) 管理文件元数据(Metadata)与块指针; 删除与残留数据 删除文件: 仅移除I-Node, 实际数据保留至被覆盖; 碎片(Fragmentation): 文件扩展导致的数据块分散, 可能暴露历史操作痕迹; 通过读取这些残留数据, 可以获得以前的数据, 这也是为什么可以删除恢复的原因 取证工具与技术(Forensic Tools & Techniques) 取证的起始步 如果当前设备开机了: 不能关机, 直接 image 当前状态 关机会导致部分有用的数据丢失 如果当前设备关机了: 不能开机, 直接用 write-blocker 等设备和额外的存储设备将当前数据转存复制 常用工具 Encase: 商业级取证软件, 支持快速搜索与分析; Autopsy: 开源工具, 提供案例管理与数据恢复功能; 数据隐藏技术(Data Hiding Techniques) 加密(Encryption): 需密钥解密数据(如全盘加密); 混淆(Obfuscation): 修改代码结构以隐藏功能(常见于恶意软件), 使其难以被人类或自动化工具理解或分析; 通过改变代码结构, 插入无关逻辑, 打乱变量名等手段来干扰逆向工程 隐写术(Steganography): 在图像/音频的LSB(Least Significant Bits)中嵌入隐藏信息; 文件的"冗余"或"最低有效位"里嵌入信息;表面上文件看似正常, 但实际包含了隐藏内容 水印(Watermarking): 在文件中添加抗移除标记(用于追踪或反盗版); 在文件中嵌入可追溯的标记或"签名", 即使文件被复制或部分修改, 也能识别其来源或所有者 反取证技术(Anti-Forensic Techniques) 安全删除(Secure Deletion) 挑战: 闪存(Flash)因磨损均衡(Wear-Leveling)难以完全覆盖历史数据; 即使使用"安全擦除"或"覆盖写"等方法, 也可能在某些缓存, 日志, 交换分区, 备份或未覆盖到的磁盘扇区里留下残留 磨损均衡: flash 可用范围会大于 os (一些 os 认为无法写入的内存可以被 flash 访问) 策略: 加密数据后丢弃密钥; 这样没有 erase key 的困难 与其事后再尝试彻底删除数据, 不如在一开始就尽量避免数据被写入存储设备; 例如使用只在内存中运行, 不落盘的应用; 或采用端到端加密并减少日志记录; 或使用一次性匿名账号等方式, 尽量减少数据在系统上留下痕迹 物理销毁介质(如研磨芯片); 全盘加密(Full Disk Encryption, FDE) 实现: protects data at rest by encrypting every sector of a storage partition using a secret key 风险: 冷启动攻击可窃取内存中的解密密钥; 攻击模型: 当物理设备被控制, 攻击者拥有物理权限但是没有key Windows Bitlocker MacOS FileVault similar iOS and Android Features 如何存储密钥? 密钥存储: 通过密码派生函数(KDF)或可信平台模块(TPM)保护密钥; KDF: $key = E_{kdf(p)}(k)$, 其中 p 为用户指定的 PIN, 而 k 表示给硬盘 sector 加密的密钥 缺点: 如果 boot 分区被加密了 OS 无法打开直到用户输入了 pin, OS 不开启则用户用不了 gui; server 没有 interface, os 没有开启则用户无法远程访问之 TPM: 给密钥加密通过一个可以信赖的中间平台 (trusted platform module), 这个平台防篡改, 并且测量 boot-time code, 这个平台只有在 kernel 没有被更改的情况下会发送key 缺点: 启动的时候会将密钥复制到 ram 中, 会被 cold-boot attack 预防数据记录 Tails Linux: 默认只读模式, 避免写入敏感数据; 浏览器无痕模式(Incognito Mode): 不保存历史与缓存;

2025-04-02 · 5 min · Yuchen You

4. 数据链路层

链路层与以太网 性质 基本职能 成帧 Framing: encapsulate network layer data 数据链路层会将来自网络层(第三层)的数据进行分组, 添加头部和尾部信息, 以形成一个个帧(Frame) 链路访问 Link Access: Medium access control (MAC) protocol defines when to transmit frames 在多点接入的介质 (例如共享式以太网, 无线网络等) 中, 多个设备可能需要同时传输数据 需要负责决定什么时候由哪一个设备向链路发送数据 可靠交付 Reliable Delivery: Primarily for mediums with high error rates (wireless) 某些网络环境中可能会受到干扰而导致帧丢失或损坏 数据链路层可以提供重传, 确认等机制, 确保帧能可靠地到达接收方 虽然TCP/IP协议栈中大多由传输层(TCP)来保证可靠性, 但一些链路层协议(如PPP)也会提供基本的可靠性功能 差错检测与纠正 Error detection and correction 帧的尾部通常会包含检错码(例如CRC校验), 用于检测帧在传输过程中是否出错 ...

2025-04-02 · 13 min · Yuchen You

6. File System

文件系统抽象 File System Abstraction attribute Hardware Reality OS abstraction interface heterogeneous uniform storage objects a few (disks) many (files) name structure simple numeric name (id) rich name (symbolic, hierarchical, unified) access speed slow fast crash resilience unreliable reliable 硬件层到 os 的转变方式 Heterogeneity 原因: many i/o devices, each with its own idiosyncrasy Solution: abstraction build a common interface (Application 层和 File System 层之间设置统一接口 POSIX) write device driver for each device Linux src code 70% is drivers Disk interface 硬件接口表现为 linear array of sectors (扇区) 扇区为最小的物理存储单位, 每个扇区为512字节 (typically) write atomically, 要么全部写入要么全部没有写入 4KB in advanced format disk disk 会将逻辑 sector 映射到物理 sector 逻辑 sector: 由 OS 决定 物理 sector: 由 disk 决定 os 不知道 mapping 机械硬盘结构 Disk Geometry/Structure Platter: 磁盘盘片 Data is stored by inducing magnetic changes to it Each platter has 2 sides, each called a surface Spindle: 磁盘主轴 围绕 spindle 旋转 Spindle rotates the platters at a constant speed (unit RPM) Track: 磁道 A circular path on a platter (Concentric circles of sectors) All tracks at the same distance from the spindle form a cylinder 每个 surface 包含上千个 track Cylinder: 柱面 A stack of tracks of fixed radius Heads record and sense data along cylinders (不同层的head指向同一个 xy 坐标位置) Generally only one head active at a time 分区的最小单位 ext2 文件系统分区结构体: struct partition{ u8 drive; // 0x80 u8 head; u8 sector; u8 cylinder; u8 sys_type; //分区类型 5为扩展分区 u8 end_head; u8 end_sector; u8 end_cylinder; u32 start_sector; //起始扇区开始计数的第n个扇区 u32 nr_sectors; //分区中的扇区个数 } 磁盘分区是告诉操作系统"我这块磁盘在此分区可以访问的区域是A柱面到B柱面之间的块", 这样操作系统就知道它可以在所指定的块内进行文件数据的读, 写, 查找等操作;磁盘分区即指定分区的起始与结束柱面 机械硬盘访问 disk 的方式 流程: Seek, Rotate, Transfer Seek: 移动磁头到指定 track 花费时间: 1-10ms 是一个物理运动过程, 很难减少时间 Rotate: 等待 disk 旋转到读写头的位置上 花费时间: 取决于 rpm 转速, 一般 $(rpm/2)^{-1}$ 用来表示平均等待时间 Transfer: 读写数据 最终的 io 操作 非常快, 依赖于 rpm 和 sector density 能达到 100 MB/s 的最大传输速度 优化 i/o 性能 General Strategy Avoid doing I/O (disk is slow) 方法: 使用 write-back cache Reduce overhead (particularly seek time) 放置数据的位置很重要 disk 角度要用更好的 scheduler 来改变内存访问顺序 Amortize overhead over larger requests Disk Scheduling FIFO: 容易出现左右不断摇摆的情况, 读写头路程过大 SSTF (Shortest seek time first): 选取距离目前读写头最近的 track 访问 优点: 减少 seek time 缺点: 会导致 starvation SCAN: 电梯调度算法 Sweep across disk, servicing all requests passed Like SSTF, but next seek must be in same direction Switch directions only if no further requests 优点: 避免 starvation 缺点: 会导致某些 track 无法访问 CSCAN: only sweep in one direction Amortizing Overhead: Efficiency = transfer time / (overhead + transfer time) 为了达到 50% efficiency, 固态硬盘的结构 Solid State Disk (SSD, flash memory) Increasing popular storage medium remembering data by storing charge Low power consumption No mechanical seek time (better random read performance) Better shock resistance (抗冲击性) limited times of overwrite possible limited durability ...

2025-03-26 · 12 min · Yuchen You