I created an empty file called "tempfile" by running:
[root@ec2-fx1 tmp]# touch tempfile
I checked the ext3 filesystem status by running:
[root@ec2-fx1 tmp]# stat tempfile
File: `tempfile'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 801h/2049d Inode: 340709 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2008-01-05 07:54:38.000000000 -0500
Modify: 2008-01-05 07:54:38.000000000 -0500
Change: 2008-01-05 07:54:38.000000000 -0500
Notice the line marked in blue. It indicates the file's access time, known also as atime.
A few moments later, I attempted to read that empty file by running:
[root@ec2-fx1 tmp]# cat tempfile
When I ran stat again, this is what was shown:
[root@ec2-fx1 tmp]# stat tempfile
File: `tempfile'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 801h/2049d Inode: 340709 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2008-01-05 07:55:53.000000000 -0500
Modify: 2008-01-05 07:54:38.000000000 -0500
Change: 2008-01-05 07:54:38.000000000 -0500
Oh oh, reading a file results in writing to disk. Yeah, but that can't be much, right? Wrong! For 100,000 http requests, your webserver will cause (at least) 100,000 disk io writes. Multiply that by io-wait penalty and (possibly) raid mirror lag. A lot!
No worries, ext3 has a mount flag to disable this feature. Luckily there are two ways to remove this annoyance. One is at boot time (when kernel mounts the filesystem,) and the second is via command line.
To disable this feature for the next boot, edit your /etc/fstab and append ",noatime" to the 4th field of the ext3 mounting point of your choice. Change will not take effect until filesystem is mounted on the next reboot.
You can also disable this right now by running (e.g. for root file system):
mount / -o remount,noatimeHappy Serving!
0 comments:
Post a Comment