当前位置:网站首页>Reading notes of top performance version 2 (V) -- file system monitoring

Reading notes of top performance version 2 (V) -- file system monitoring

2022-07-01 15:27:00 jrglinux

《System Performance: Enterprise and the Cloud, 2nd Edition (2020)》 Reading notes and brief notes

8. file system file systems

8.2 Model

8.2.1 File system caching

 Insert picture description here

A cache hit , Read from main memory ;

Cache miss , Read from disk ;

8.3 Concept

8.3.1 File system latency

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. contain :

  • Time spent on the file system itself
  • disk I/O Subsystem time
  • Disk waiting for physical I/O Time
8.3.2 cache caching

The file system uses main memory (RAM) To do caching , To improve performance , In this way, the application can start from RAM Read and write in , Not physical disks , Less logical I/O latency.

8.3.3 Random and sequential I/O

 Insert picture description here

8.3.4 Prefetch prefetch

A large number of file sequences I/O when , Maybe the amount of data is too large to be put into the cache , In this way, the cache hit rate is low , Affect performance .

Prefetching is to check the current and previous I/O File offset for , It can detect whether the current load is a sequential read load , And make predictions , Issue a read command to the disk before the application requests it , To populate the file system cache .
 Insert picture description here

8.3.5 read-ahead read-ahead

Namely prefetch,Linux System call is added in readadhead(2) Allow the application to display the warm-up file system cache .

8.3.6 Write back cache 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 Write synchronously

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. Synchronous write is better than asynchronous write ( Write back cache ) Much slower .

8.3.8 bare I/O And direct I/O(raw and direct)

bare I/O: Bypass the file system , Send directly to disk address . For example, database software .

direct I/O: allow app Bypass the cache and use the file system , It's kind of similar Write synchronously ( But the lack of O_SYNC The guarantee provided by the option ).

8.3.9 Non blocking I/O

open() Pass in O_NONBLOCK perhaps O_NDELY Option uses non blocking I/O.

8.3.10 Memory mapped files memory-mapped files

For some applications and loads , Map the file to the process address space , And directly read the memory address , Can improve the file system I/O performance .

system call mmap() establish ,munmap() The destruction . Mapping can be done with madvise() adjustment .

8.4 framework

8.4.1 I/O Stack

 Insert picture description here

8.4.2 VFS

VFS (the virtual file system interface) provides a common interface for different file system types.
 Insert picture description here

8.4.3 File system caching

 Insert picture description here

buffer cache 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 Page caching 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 Directory 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 cacheinode cache 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 File system type
FFSfast file system (FFS)
ext3
ext4
XFSXFS is supported by most Linux distributions and can be used for the root file system.
ZFScombining the file system with the volume manager and including numerous enterprise features, making it an attractive choice for file servers (filers).
btrfsThe 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 volumes and pools

 Insert picture description here

The file system has always been built on a disk, which is a disk partition , Volumes and pools enable file systems to be built on multiple disks , And you can use different RAID Strategy .

Volume combines multiple disks into a virtual disk , Build a file system on this . Volume management software :Logical volume manager,LVM.

原网站

版权声明
本文为[jrglinux]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/182/202207011522413108.html