Ext2 v.s. Ext3 v.s. EXT4 Performance Competition

Source: Internet
Author: User
Tags commit

Turn from: http://www.kuqin.com/linux/20090202/33777.html

Linux Kernel formally supports the new file system EXT4 since 2.6.28. EXT4 is an improved version of EXT3 that modifies some of the important data structures in EXT3, not just as Ext3 to Ext2, but only adds a log function. EXT4 can provide better performance and reliability, as well as richer functionality:
1. Compatible with EXT3. By executing several commands, you can migrate from Ext3 online to EXT4 without reformatting the disk or reinstalling the system. The original EXT3 data structure is still retained, EXT4 action on new data, of course, the entire file system so that the EXT4 is supported by a larger capacity.

2. Larger file systems and larger files. EXT4 supports 1EB (1,048,576TB, 1EB=1024PB, 1PB=1024TB) file systems, as well as 16TB files, compared to the maximum 16TB file system and maximum 2TB files currently supported by EXT3.

3. An unlimited number of subdirectories. EXT3 currently supports only 32,000 subdirectories, while EXT4 supports an unlimited number of subdirectories.

4. Extents. EXT3 uses indirect block mapping, which is extremely inefficient when manipulating large files. For example, a 100MB size file, in the EXT3 to create 25,600 blocks (each block size of 4KB) mapping table. And EXT4 introduced the popular extents concept in modern file system, each extent is a set of successive blocks of data, the above file is expressed as "the file data is stored in the next 25,600 blocks", improve a lot of efficiency.

5. Multi-block distribution. When the data is written to the Ext3 file system, the EXT3 data block allocator can allocate only one 4KB block at a time, and a 100MB file will call 25,600 times the data block allocator, while EXT4 multiple splitter "Multiblock allocator" (Mballoc Supports the allocation of multiple blocks of data at one time.

6. Delayed distribution. EXT3 's data block allocation strategy is distributed as soon as possible, the strategy of EXT4 and other modern file operating systems is to delay allocation as much as possible until the file is written in cache to begin allocating blocks of data and writing to disk, thus optimizing the allocation of chunks of the entire file, which can significantly improve performance with the first two features.

7. Fast fsck. It is slow to perform the first step of fsck, because it checks all the inode, now EXT4 adds a list of unused inode to the Inode table for each group, and the fsck EXT4 file system can skip over them and check out the inode that is in use.

8. Log check. Logging is the most commonly used section and can easily lead to disk hardware failures, while recovering data from corrupted logs can result in more data corruption. The EXT4 log check feature makes it easy to determine whether log data is corrupted, and it merges the EXT3 two-stage logging mechanism into one phase, improving performance while increasing security.

9. "No Log" (no journaling) mode. The log has some overhead, and EXT4 allows logging to be turned off so that some users with special needs can improve performance.

10. Online defragmentation. Although deferred allocations, multiple-block allocations, and extents can effectively reduce file system fragmentation, fragmentation is inevitable. EXT4 supports online defragmentation and will provide e4defrag tools for defragmenting individual files or entire file systems.

One . Inode related characteristics. EXT4 supports larger inode sizes, which are 128 bytes larger than the default inode size of EXT3, EXT4 the default inode size is 256 bytes in order to accommodate more extended attributes (such as nanosecond timestamp or inode version) in the Inode. EXT4 also supports fast extended properties (fast extended attributes) and Inode retention (inodes reservation).

12. Persistent pre-distribution (persistent preallocation). Peer-to-peer software to ensure that the download file has enough space to store, often in advance to create an empty file with the same size as the downloaded file, so that in the next few hours or days of insufficient disk space cause download failure. EXT4 implements persistent prefetching at the file system level and provides the appropriate APIs (Posix_fallocate () in libc) that are more efficient than the application software itself.

13. Enable barrier by default. The disk is equipped with an internal cache to readjust the write order of bulk data and optimize write performance, so the file system must write a commit record after the log data has been written to disk, and if the commit record is written first and the log is potentially corrupted, data integrity is affected. EXT4 barrier is enabled by default, the data after barrier can be written only when all the data before barrier is written to disk. (This attribute can be disabled by the "mount-o barrier=0" command.) )


EXT4 with the Linux kernel 2.6.28 officially released for several weeks, has been struggling to find the test disk, just a few years ago Intel sent a few SSD test samples, these two days in passing SSD also measured. The Linux kernel version used for the test is 2.6.28.2 and the test tool is IOzone 3.318.

The IOzone Test command is:
Time/opt/iozone/bin/iozone-a-S 4g-q 256-y 4 >|/root/ext4-iozone-stdout.txt
The description of the above order is as follows:
Auto Mode
File size set to 4194304 KB
Using Maximum record Size 256 KB
Using Minimum record Size 4 KB
Command Line used:/opt/iozone/bin/iozone-a-S 4g-q 256-y 4
Output is in kbytes/sec
Time resolution = 0.000001 seconds.
Processor Cache size set to 1024 Kbytes.
Processor Cache line size set to bytes.
The File stride size set to/* record size.
In addition to showing that the Intel SSD is incredibly fast to read and write, the test results show that all aspects of EXT4 performance are more than the previous generation Ext3, and even in most cases, a lot faster than the EXT2 without the log function:

Reclen Write rewrite Read Reread Random Read Random Write BKWD Read Record rewrite Stride Read fwrite Frewrite fread Freread
Ext2

Real 28m12.718s
User 0m10.725s
SYS 5m8.265s
4 218,680 216,596 630,248 245,802 88,700 138,065 106,112 1,882,623 73,538 214,175 218,364 566,570 247,381
8 215,308 218,690 556,064 246,260 154,680 150,052 188,397 2,462,367 130,896 217,157 216,647 583,808 248,397
16 216,457 216,843 575,046 245,701 258,660 158,750 306,842 2,654,320 220,939 216,061 218,140 598,174 246,581
32 217,925 214,289 537,976 243,081 394,013 167,002 464,240 2,397,831 340,775 217,434 219,353 583,463 246,341
64 215,460 219,256 527,919 244,362 503,227 162,917 609,546 2,546,079 456,243 216,875 217,692 571,707 244,264
128 219,081 216,173 540,831 242,526 609,750 161,442 721,701 2,656,729 551,122 217,780 217,427 579,271 242,291
256 216,091 217,631 565,111 245,157 654,274 173,955 870,547 2,574,261 634,835 216,638 219,693 563,735 247,101
Ext3

Real 27m42.449s
User 0m11.529s
sys 7m17.049s
4

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.