当前位置:网站首页>《性能之巅第2版》阅读笔记(五)--file-system监测
《性能之巅第2版》阅读笔记(五)--file-system监测
2022-07-01 15:23:00 【jrglinux】
《System Performance: Enterprise and the Cloud, 2nd Edition (2020)》阅读笔记简要记录
8. 文件系统file systems
8.2 模型
8.2.1 文件系统缓存

缓存命中,从主存中读取;
缓存未命中,从磁盘读取;
8.3 概念
8.3.1 文件系统延时
File system latency is the primary metric of file system performance, measured as the time from a logical file system request to its completion.It includes time spent in the file system and disk I/O subsystem, and waiting on disk devices—the physical I/O.包含:
- 花在文件系统本身的时间
- 磁盘I/O子系统时间
- 磁盘等待物理I/O时间
8.3.2 缓存caching
文件系统使用主存(RAM)来做缓存,以提高性能,这样应用程序可以从RAM中进行读写,而不是物理磁盘,减少了logical I/O latency。
8.3.3 随机与顺序I/O

8.3.4 预取prefetch
大量文件顺序I/O时,可能数据量太大放不进缓存,这样缓存命中率偏低,影响性能。
预取是检查当前和上一个I/O的文件偏移量,可以检测出当前是否是顺序读负载,并且做出预测,在应用程序请求前向磁盘发出读命令,以填充文件系统缓存。
8.3.5 预读read-ahead
就是prefetch,Linux中新增了系统调用readadhead(2)允许应用显示预热文件系统缓存。
8.3.6 回写缓存write-back caching
Write-back caching is commonly used by file systems to improve write performance. It works by treating writes as completed after the transfer to main memory, and writing them to disk sometime later, asynchronously.
8.3.7 同步写
A synchronous write completes only when fully written to persistent storage (e.g., disk devices), which includes writing any file system metadata changes that are necessary. 同步写比异步写(写回缓存)要慢的多。
8.3.8 裸I/O和直接I/O(raw and direct)
裸I/O:绕过文件系统,直接发给磁盘地址。比如数据库软件。
直接I/O:允许app绕过缓存使用文件系统,有点类似同步写(但缺少O_SYNC选项提供的保证)。
8.3.9 非阻塞I/O
open()调用时传入O_NONBLOCK或者O_NDELY选项使用非阻塞I/O。
8.3.10 内存映射文件memory-mapped files
对于某些应用程序和负载,通过吧文件映射到进程地址空间,并直接读取内存地址,可以提高文件系统I/O性能。
系统调用mmap()创建,munmap()销毁。映射可以用madvise()调整。
8.4 架构
8.4.1 I/O栈

8.4.2 VFS
VFS (the virtual file system interface) provides a common interface for different file system types.
8.4.3 文件系统缓存

| buffer cache | 缓冲区高速缓存 | Linux used a buffer cache at the block device interface to cache disk device blocks. The size of the buffer cache is dynamic and is observable from /proc. |
| page cache | 页缓存 | It cached virtual memory pages, including mapped file system pages, improving the performance of file and directory I/O. It was more efficient for file access than the buffer cache, which required translation from file offset to disk offset for each lookup. |
| dentry cache | 目录缓存 | The dentry cache (Dcache) remembers mappings from directory entry (struct dentry) to VFS inode, similar to an earlier Unix directory name lookup cache (DNLC). |
| inode cache | inode缓存 | This cache contains VFS inodes (struct inodes), each describing properties of a file system object, many of which are returned via the stat(2) system call. |
8.4.5 文件系统类型
| FFS | fast file system (FFS) |
| ext3 | |
| ext4 | |
| XFS | XFS is supported by most Linux distributions and can be used for the root file system. |
| ZFS | combining the file system with the volume manager and including numerous enterprise features, making it an attractive choice for file servers (filers). |
| btrfs | The B-tree file system (btrfs) is based on copy-on-write B-trees. This is a modern file system and volume manager combined architecture, similar to ZFS, and is expected to eventually offer a similar feature set. |
8.4.6 卷和池volumes and pools

文件系统一直以来建立在一块磁盘后者一个磁盘分区上,卷和池可以使文件系统建立在多块磁盘上,并可以使用不同的RAID策略。
卷把多块磁盘组合成一块虚拟磁盘,在此之上建立文件系统。卷管理软件:Logical volume manager,LVM。
边栏推荐
- Markdown编辑器使用基本语法
- Qt+pcl Chapter 9 point cloud reconstruction Series 2
- Implementation of deploying redis sentry in k8s
- 【天线】【3】CST一些快捷键
- Can I choose to open an account on Great Wall Securities? Is it safe?
- 《QT+PCL第六章》点云配准icp系列3
- Tableapi & SQL and Kafka message insertion in Flink
- 三十之前一定要明白的职场潜规则
- 【锁】Redis锁 处理并发 原子性
- 数据产品经理需要掌握哪些数据能力?
猜你喜欢

leetcode:329. Longest increasing path in matrix

竣达技术丨室内空气环境监测终端 pm2.5、温湿度TVOC等多参数监测

《QT+PCL第六章》点云配准icp系列2

Opencv learning notes 5 -- document scanning +ocr character recognition

【目标跟踪】|STARK
Implementation of deploying redis sentry in k8s

微信公众号订阅消息 wx-open-subscribe 的实现及闭坑指南

MySQL service is starting. MySQL service cannot be started. Solution

skywalking 6.4 分布式链路跟踪 使用笔记

IDEA全局搜索快捷键(ctrl+shift+F)失效修复
随机推荐
三十之前一定要明白的职场潜规则
What is the relationship between network speed, broadband, bandwidth and traffic?
Using swiper to make mobile phone rotation map
微信小程序03-文字一左一右显示,行内块元素居中
Skywalking 6.4 distributed link tracking usage notes
The markdown editor uses basic syntax
深度分析数据在内存中的存储形式
Summary of empty string judgment in the project
[lock] redis lock handles concurrency atomicity
TS报错 Don‘t use `object` as a type. The `object` type is currently hard to use
go-zero实战demo(一)
Flink 系例 之 TableAPI & SQL 与 MYSQL 数据查询
Flink 系例 之 TableAPI & SQL 与 MYSQL 插入数据
Wechat applet 03 - text is displayed from left to right, and the block elements in the line are centered
贝联珠贯加入龙蜥社区,共同促进碳中和
榨汁机UL982测试项目有哪些
Raytheon technology rushes to the Beijing stock exchange and plans to raise 540million yuan
这3款在线PS工具,得试试
[advanced ROS] lesson 5 TF coordinate transformation in ROS
Beilianzhuguan joined the dragon lizard community to jointly promote carbon neutralization