Login or Register to Ask a Question and Join Our Community


Difference between buffered disk reads and cached reads?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Difference between buffered disk reads and cached reads?
# 1  
Old 07-13-2011
Difference between buffered disk reads and cached reads?

I was analyzing the Disk read using hdparm utility.

This is what i got as a result.

Code:
# hdparm -t /dev/sda

/dev/sda:
 Timing buffered disk reads:  108 MB in  3.04 seconds =  35.51 MB/sec

Code:
# hdparm -T /dev/sda

/dev/sda:
 Timing cached reads:   3496 MB in  1.99 seconds = 1756.56 MB/sec

I m not sure what does Cache read and buffered disk read mean.

Please share your hdparm output for comparison purpose.
# 2  
Old 07-13-2011
Quote:
-T

Perform timings of cache reads for benchmark and comparison purposes. For meaningful results, this operation should be repeated 2-3 times on an otherwise inactive system (no other active processes) with at least a couple of megabytes of free memory. This displays the speed of reading directly from the Linux buffer cache without disk access. This measurement is essentially an indication of the throughput of the processor, cache, and memory of the system under test. If the -t flag is also specified, then a correction factor based on the outcome of -T will be incorporated into the result reported for the -t operation.


-t

Perform timings of device reads for benchmark and comparison purposes. For meaningful results, this operation should be repeated 2-3 times on an otherwise inactive system (no other active processes) with at least a couple of megabytes of free memory. This displays the speed of reading through the buffer cache to the disk without any prior caching of data. This measurement is an indication of how fast the drive can sustain sequential data reads under Linux, without any filesystem overhead. To ensure accurate measurements, the buffer cache is flushed during the processing of -t using the BLKFLSBUF ioctl. If the -T flag is also specified, then a correction factor based on the outcome of -T will be incorporated into the result reported for the -t operation.
From Wikipedia:

Quote:
The disk buffer is physically distinct from and is used differently than the page cache typically kept by the operating system in the computer's main memory. The disk buffer is controlled by the microcontroller in the hard disk drive, and the page cache is controlled by the computer to which that disk is attached. The disk buffer is usually quite small, from 2 to 32 MiB, and the page cache is generally all unused physical memory. While data in the page cache is reused multiple times, the data in the disk buffer is rarely reused.
This is from my notebook (Windows 7/Cygwin):

internal drive

Code:
zsh-4.3.11[sysadmin]% repeat 3 /usr/sbin/hdparm.exe -Tt /dev/hda

/dev/hda:
 Timing cached reads:   452 MB in  2.00 seconds = 225.44 MB/sec
 Timing buffered disk reads:  232 MB in  3.01 seconds =  77.18 MB/sec

/dev/hda:
 Timing cached reads:   438 MB in  2.00 seconds = 218.89 MB/sec
 Timing buffered disk reads:  234 MB in  3.00 seconds =  77.87 MB/sec

/dev/hda:
 Timing cached reads:   452 MB in  2.00 seconds = 225.89 MB/sec
 Timing buffered disk reads:  228 MB in  3.00 seconds =  75.95 MB/sec

external USB 2 drive:

Code:
zsh-4.3.11[sysadmin]% repeat 3 /usr/sbin/hdparm.exe -Tt /dev/hdb

/dev/hdb:
 Timing cached reads:    54 MB in  2.00 seconds =  26.96 MB/sec
 Timing buffered disk reads:   82 MB in  3.03 seconds =  27.04 MB/sec

/dev/hdb:
 Timing cached reads:    54 MB in  2.00 seconds =  26.96 MB/sec
 Timing buffered disk reads:   78 MB in  3.02 seconds =  25.80 MB/sec

/dev/hdb:
 Timing cached reads:    58 MB in  2.07 seconds =  28.01 MB/sec
 Timing buffered disk reads:   82 MB in  3.08 seconds =  26.65 MB/sec

This is from an Ubuntu on VirtualBox (on the external USB 2 drive):

Code:
zsh-4.3.11[radoulov]%  repeat 3 sudo hdparm -Tt /dev/sda

/dev/sda:
 Timing cached reads:   2670 MB in  1.96 seconds = 1361.20 MB/sec
 Timing buffered disk reads: 180 MB in  3.01 seconds =  59.85 MB/sec

/dev/sda:
 Timing cached reads:   2588 MB in  1.95 seconds = 1327.61 MB/sec
 Timing buffered disk reads: 180 MB in  3.02 seconds =  59.68 MB/sec

/dev/sda:
 Timing cached reads:   2412 MB in  1.96 seconds = 1227.78 MB/sec
 Timing buffered disk reads: 178 MB in  3.03 seconds =  58.74 MB/sec

Too Linux servers:

physical host/internal disk:

Code:
/dev/cciss/c0d0:
 Timing cached reads:   9816 MB in  2.00 seconds = 4912.77 MB/sec
HDIO_DRIVE_CMD(null) (wait for flush complete) failed: Inappropriate ioctl for device
 Timing buffered disk reads:  192 MB in  3.02 seconds =  63.57 MB/sec
HDIO_DRIVE_CMD(null) (wait for flush complete) failed: Inappropriate ioctl for device

virtual host/external storage:

Code:
/dev/sda:
 Timing cached reads:   25920 MB in  2.00 seconds = 12985.58 MB/sec
 Timing buffered disk reads:  986 MB in  3.00 seconds = 328.63 MB/sec

/dev/sda:
 Timing cached reads:   26036 MB in  2.00 seconds = 13043.02 MB/sec
 Timing buffered disk reads:  898 MB in  3.09 seconds = 290.64 MB/sec


Last edited by radoulov; 07-13-2011 at 11:13 AM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell Script that reads a file

I have below script to read a file line by line. How can I ensure that the loop will stop after last line. #!/bin/bash while read -r mod ver tarball; do echo $mod done < taskfile.txt (4 Replies)
Discussion started by: aderamos12
4 Replies

2. UNIX for Dummies Questions & Answers

Sudo reads password from a .cfg file

cleanwork /saswork removes sas orphanded processes in the saswork directory. Subdirectories under sasem are sas94, sas92 and sasworks . I am getting the following error messages: 1. '/usr/bin/sudo -S apt-get update <~/opt/SiM/pos/ps/db_auth.cfg... (4 Replies)
Discussion started by: dellanicholson
4 Replies

3. Shell Programming and Scripting

mapped reads using samtools flagstat options

Hey guys, Does anyone know how to calculate total number of mapped reads for a certain region of a bam file using samtools flagstat? I know to use flagstat for the whole bam file. but for a specific region of it... is there an option? Tnx ---------- Post updated at 12:27 PM ----------... (1 Reply)
Discussion started by: @man
1 Replies

4. Linux

Dealing with a really high amount of reads merged

I'm trying to performance tune the I/O of my web server, which is at 41.1% reads merged (If my math is correct), which seems a tad high to just be going along with the defaults. Will modifying read_ahead_kb affect the value of "reads merged" in diskstats? If not, what's a good way of tracking... (2 Replies)
Discussion started by: thmnetwork
2 Replies

5. Shell Programming and Scripting

While loop in unix reads only first line

Hi, I am in need of help on reading through a file(servernames.dat) which has a list of server names, while it reads each file name it has to connect to that server and run another script, once it has executed the script on one server, it has to go back to the list of servernames to get the next... (5 Replies)
Discussion started by: yohasini
5 Replies

6. Shell Programming and Scripting

Illumina reads remove duplicate...

After I using the search tool, I still can't find a solution that was related with my trouble. My input file: @HWI-ABC123_30DFGGDA:1:100:3:1234 ACGTAGTACCCGGGTTTTTTTTTAAAAAAA +HWI-ABC123_30DFGGDA:1:100:3:1234 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh @HWI-ABC555_30DFGGDA:1:100:3:1234... (14 Replies)
Discussion started by: patrick87
14 Replies

7. Filesystems, Disks and Memory

Does vmstat -d give a count of actual physical writes/reads done to/from hard disk?

Hi, I am trying to find the reliability of 'vmstat -d' for showing the actual physical writes on sectors on hard disk. Can anyone please tell me if the numbers in the "sectors" field under "read" or "write" headers show a count of the actual write commands sent to disk from the low level... (2 Replies)
Discussion started by: jake24
2 Replies

8. UNIX for Advanced & Expert Users

identify the unix process performing high disk i/o reads and writes

Guys, Is there any UNIX command that captures the 'Unix process which is performing high disk I/O reads and writes'. can you help me in this? -Swamy (6 Replies)
Discussion started by: avsswamy
6 Replies

9. Shell Programming and Scripting

identify the unix processes performing high disk i/o reads and writes

I would like to write shell/perl script which identifies the top unix processes that are performing high disk I/O's or/and writes If any one knows the solution please help me? -Swamy (0 Replies)
Discussion started by: avsswamy
0 Replies

10. Programming

scanf doesn´t reads spaces ???

hi all i have a program in C (Unix Solaris 5.7) and i want to read a string from keyboard, but the "scanf" doesn´t reads spaces. example: .... char name; .... printf("Enter your name: "); scanf("%s",&name); printf ("Your name is: %s", name); and if i write Kevin Costner ... (4 Replies)
Discussion started by: DebianJ
4 Replies
Login or Register to Ask a Question

Featured Tech Videos