当前位置:网站首页>《性能之巅第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。
边栏推荐
- The first technology podcast month will be broadcast soon
- skywalking 6.4 分布式链路跟踪 使用笔记
- Wechat official account subscription message Wx open subscribe implementation and pit closure guide
- Qt+pcl Chapter 9 point cloud reconstruction Series 2
- Solid basic structure and array, private / public function, return value and modifier of function, event
- opencv学习笔记四--银行卡号识别
- openssl客户端编程:一个不起眼的函数导致的SSL会话失败问题
- 微信小程序03-文字一左一右显示,行内块元素居中
- 贝联珠贯加入龙蜥社区,共同促进碳中和
- 数字化转型:数据可视化赋能销售管理
猜你喜欢
[advanced ROS] lesson 5 TF coordinate transformation in ROS
OpenSSL client programming: SSL session failure caused by an insignificant function
Qt+pcl Chapter 6 point cloud registration ICP Series 2
张驰课堂:六西格玛数据的几种类型与区别
Opencv Learning Notes 6 -- image feature [harris+sift]+ feature matching
点云重建方法汇总一(PCL-CGAL)
竣达技术丨多台精密空调微信云监控方案
skywalking 6.4 分布式链路跟踪 使用笔记
MySQL审计插件介绍
【STM32-USB-MSC问题求助】STM32F411CEU6 (WeAct)+w25q64+USB-MSC Flash用SPI2 读出容量只有520KB
随机推荐
Solid basic basic grammar and definition function
采集数据工具推荐,以及采集数据列表详细图解流程
基于价值量化的需求优先级排序方法
张驰课堂:六西格玛数据的几种类型与区别
Redis installation and setting up SSDB master-slave environment under Ubuntu 14.04
Tableapi & SQL and MySQL data query of Flink
[leetcode] 16. The sum of the nearest three numbers
Flink 系例 之 TableAPI & SQL 与 MYSQL 数据查询
微信小程序01-底部导航栏设置
Survey of intrusion detection systems:techniques, datasets and challenges
DirectX repair tool v4.1 public beta! [easy to understand]
重回榜首的大众,ID依然乏力
Summary of week 22-06-26
【天线】【3】CST一些快捷键
An intrusion detection model
《QT+PCL第六章》点云配准icp系列3
Filter &(登录拦截)
ArrayList 扩容详解,扩容原理[通俗易懂]
竣达技术丨多台精密空调微信云监控方案
Tableapi & SQL and MySQL grouping statistics of Flink