当前位置:网站首页>《性能之巅第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。
边栏推荐
- TS reports an error don't use 'object' as a type The `object` type is currently hard to use
- Task.Run(), Task.Factory.StartNew() 和 New Task() 的行为不一致分析
- Using swiper to make mobile phone rotation map
- It's settled! 2022 Hainan secondary cost engineer examination time is determined! The registration channel has been opened!
- [leetcode] 16. The sum of the nearest three numbers
- 《QT+PCL第九章》点云重建系列2
- MySQL 服务正在启动 MySQL 服务无法启动解决途径
- Returning to the top of the list, the ID is still weak
- Beilianzhuguan joined the dragon lizard community to jointly promote carbon neutralization
- [Cloudera][ImpalaJDBCDriver](500164)Error initialized or created transport for authentication
猜你喜欢
Intelligent operation and maintenance practice: banking business process and single transaction tracking
如何实现时钟信号分频?
《QT+PCL第六章》点云配准icp系列6
Survey of intrusion detection systems:techniques, datasets and challenges
Phpcms background upload picture button cannot be clicked
MySQL service is starting. MySQL service cannot be started. Solution
Filter &(登录拦截)
JS中箭头函数和普通函数的区别
智能运维实战:银行业务流程及单笔交易追踪
idea中新建的XML文件变成普通文件的解决方法.
随机推荐
Markdown编辑器使用基本语法
Summary of empty string judgment in the project
DirectX repair tool v4.1 public beta! [easy to understand]
微信公众号订阅消息 wx-open-subscribe 的实现及闭坑指南
Shopping mall 6.27 to be completed
22-06-26周总结
[Cloudera][ImpalaJDBCDriver](500164)Error initialized or created transport for authentication
使用swiper制作手机端轮播图
solidty-基础篇-基础语法和定义函数
Tableapi & SQL and MySQL data query of Flink
数字化转型:数据可视化赋能销售管理
MySQL 服务正在启动 MySQL 服务无法启动解决途径
Go zero actual combat demo (I)
贝联珠贯加入龙蜥社区,共同促进碳中和
Opencv Learning Notes 6 -- image mosaic
Qt+pcl Chapter 6 point cloud registration ICP Series 2
Survey of intrusion detection systems:techniques, datasets and challenges
异常检测中的浅层模型与深度学习模型综述(A Unifying Review of Deep and Shallow Anomaly Detection)
"Qt+pcl Chapter 6" point cloud registration ICP Series 6
【目标跟踪】|STARK