Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] Slow buffered disk reads
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
mntnoe
n00b
n00b


Joined: 21 Jan 2007
Posts: 61
Location: Denmark

PostPosted: Mon Jun 04, 2007 10:42 am    Post subject: [solved] Slow buffered disk reads Reply with quote

I was unhappy with the performance on my laptop (Acer Travelmate 233XV with 30GB Ultra ATA/100), so I compared the disk i/o with my desktop:

hdparm -tT /dev/hda on desktop:
Code:
/dev/hda:
 Timing cached reads:   1056 MB in  2.00 seconds = 527.87 MB/sec
 Timing buffered disk reads:  158 MB in  3.03 seconds =  52.21 MB/sec


hdparm -tT /dev/hda on laptop:
Code:
/dev/hda:
 Timing cached reads:   1296 MB in  2.00 seconds = 647.47 MB/sec
 Timing buffered disk reads:   68 MB in  3.07 seconds =  22.12 MB/sec


Why is the buffered disk reads so slow on my laptop, and is it possible to fix?

I don't want to risk corrupting my data, so I am not keen messing with the options from an end. Thanks in advance.

Code:
hdparm /dev/hda:
 multcount    = 16 (on)
 IO_support   =  0 (default 16-bit)
 unmaskirq    =  0 (off)
 using_dma    =  1 (on)
 keepsettings =  0 (off)
 readonly     =  0 (off)
 readahead    = 256 (on)
 geometry     = 16383/255/63, sectors = 58605120, start = 0

hdparm -i /dev/hda:
 Model=IC25N030ATMR04-0, FwRev=MOAOAD0A, SerialNo=MRG211K2G3JHWD
 Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4
 BuffType=DualPortCache, BuffSize=1740kB, MaxMultSect=16, MultSect=16
 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=58605120
 IORDY=on/off, tPIO={min:240,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio1 pio2 pio3 pio4
 DMA modes:  mdma0 mdma1 mdma2
 UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5
 AdvancedPM=yes: mode=0x80 (128) WriteCache=enabled
 Drive conforms to: ATA/ATAPI-6 T13 1410D revision 3a:  ATA/ATAPI-2 ATA/ATAPI-3 ATA/ATAPI-4 ATA/ATAPI-5 ATA/ATAPI-6

 * signifies the current active mode


Last edited by mntnoe on Tue Jun 05, 2007 1:00 pm; edited 1 time in total
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Mon Jun 04, 2007 11:28 am    Post subject: Reply with quote

First check that you have sys-apps/hdparm-6.9-r1, to avoid a bug in reporting the speeds.

Use the search button for "hdparm", there's several threads here about optimizing performance.

I'd expect a laptop's hard drive to be slower than a desktop, because they are probably optimized for power consumption, heat and noise, rather than speed.
Back to top
View user's profile Send private message
mntnoe
n00b
n00b


Joined: 21 Jan 2007
Posts: 61
Location: Denmark

PostPosted: Mon Jun 04, 2007 12:46 pm    Post subject: Reply with quote

Thanks for answering, PaulBredbury. I upgraded to 6.9-r1, and now the cached read speed is reported half as big, so I must have been using the buggy version.
Code:
/dev/hda:
 Timing cached reads:   700 MB in  2.00 seconds = 349.35 MB/sec
 Timing buffered disk reads:   74 MB in  3.00 seconds =  24.66 MB/sec

On my laptop however, Windows copies a file with the same size faster than Linux, so I think there must be something that can be optimized. So, if anybody could point out a weakness in my config, I would really appreciate that.

Generally, the discussions I have read about it doesn't cover when to enable the various options. The best I could find was http://gentoo-wiki.com/HOWTO_Use_hdparm_to_improve_IDE_device_performance, which explains some of the options. But what is read-lookahead, for example, and could I enable it on my laptop, without fear of corruption?

I tried to enable unmaskirq, but could not measure any differences; perhaps because it only helps when the system is busy. Any way to benchmark that?
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Mon Jun 04, 2007 12:56 pm    Post subject: Reply with quote

That's too anecdotal. Give details about the file copy, and don't be fooled by disk caching.

There are some tweaks possible in /etc/fstab, e.g. I use:
Code:
/dev/sda1 / ext3  defaults,commit=60,noatime   1 1

Read man mount for details.

Edit: Added nodiratime
Edit2: Removed nodiratime, which is implied by noatime


Last edited by PaulBredbury on Tue Mar 15, 2011 12:52 pm; edited 2 times in total
Back to top
View user's profile Send private message
eccerr0r
Advocate
Advocate


Joined: 01 Jul 2004
Posts: 4006
Location: USA

PostPosted: Mon Jun 04, 2007 7:51 pm    Post subject: Reply with quote

Laptop hard drives tend to be quite slow as said.
Of the four laptop drives I got, the last known reading I've seen:

Travelstar 40GN (20GB) 4200RPM: 20.3 MB/sec
Travelstar 40GNX (40GB) 5400RPM: 22.8 MB/sec
Fujitsu 30GB 4200RPM: 23.6MB/sec
Samsung 120GB 5400RPM: 31.5MB/sec

Don't take these as gospel, they're different versions of hdparm and some of these disks are very old (specifically, the Travelstars).
Likely you're not going to get much more out of them unless it's a newer 7200+RPM disk.
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed to be advocating?
Back to top
View user's profile Send private message
mntnoe
n00b
n00b


Joined: 21 Jan 2007
Posts: 61
Location: Denmark

PostPosted: Tue Jun 05, 2007 11:34 am    Post subject: Reply with quote

mntnoe wrote:
On my laptop however, Windows copies a file with the same size faster than Linux, so I think there must be something that can be optimized.

Well, I was wrong... :oops:

I ran a benchmark test from Windows, which reported 22.1 MB/sec avg, so yes, I might have been tricked by the cache/filesystem. Guess I'll have to live with that speed.

Does commit=60 option actually improve the sync timing, or does it only give an illusion of fast copying with small files?

BTW on a laptop with a slow disk, should I then consider using "-Os" in my CFLAGS for large applications?
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Tue Jun 05, 2007 12:16 pm    Post subject: Reply with quote

commit=60 stops the "immediate" (default of 5 seconds) prioritization of writes of over reads, caching the writes for a few more seconds later. This is good in the situation of heavy reads and writes mixed together, where the user wants the reads to take priority, so that the processor can be kept busy rather than pause while waiting for the writes to finish before it can continue reading.

A real-world example I have seen is waiting several seconds for the Gnome pull-down menu to appear, for seemingly no reason. The reason was that the disk was busy writing, so the CPU had to wait for the writing to finish before it could get all the data from the disk to be able to show the menu.

Hope that makes some sense :)
Back to top
View user's profile Send private message
mntnoe
n00b
n00b


Joined: 21 Jan 2007
Posts: 61
Location: Denmark

PostPosted: Tue Jun 05, 2007 1:00 pm    Post subject: Reply with quote

Yes, I understand your point. I have added it to my fstab, so lets hope that I can feel a difference.

Thank you for your time... :)
Back to top
View user's profile Send private message
eccerr0r
Advocate
Advocate


Joined: 01 Jul 2004
Posts: 4006
Location: USA

PostPosted: Tue Jun 05, 2007 7:00 pm    Post subject: Reply with quote

On my machines that I care about disk space a lot I do use -Os (specifically, CF disks). However I've found in practice it doesn't really help too much loading, burst speed reads are only a fraction of total time to satisfy requests (hint: seek times)

Sometimes I also wonder if you may just need more RAM in your machine? Is it swapping?

I'm always worried about laptops with delayed writebacks because they're more susceptible to sudden power outages (battery runs out, etc.) Either way, more RAM may help.
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed to be advocating?
Back to top
View user's profile Send private message
mntnoe
n00b
n00b


Joined: 21 Jan 2007
Posts: 61
Location: Denmark

PostPosted: Tue Jun 05, 2007 8:07 pm    Post subject: Reply with quote

eccerr0r wrote:
On my machines that I care about disk space a lot I do use -Os (specifically, CF disks). However I've found in practice it doesn't really help too much loading, burst speed reads are only a fraction of total time to satisfy requests (hint: seek times)

Sometimes I also wonder if you may just need more RAM in your machine? Is it swapping?

I'm always worried about laptops with delayed writebacks because they're more susceptible to sudden power outages (battery runs out, etc.) Either way, more RAM may help.

I started a thread about -Os. I will try it out, so I can compare load time vs. responsiveness.

I only have 256M, and although it isn't swapping, I ought to buy some more... when I can afford it :)

I have set commit=15 so far. 15 seconds of "data loss" should be manageable, right?
Back to top
View user's profile Send private message
eccerr0r
Advocate
Advocate


Joined: 01 Jul 2004
Posts: 4006
Location: USA

PostPosted: Tue Jun 05, 2007 8:57 pm    Post subject: Reply with quote

I probably shouldn't be as paranoid I guess. With a journalling filesystem it shouldn't be nearly as big of a problem.
Depends on how much writing you're doing to the disk with "current" data (versus just copying data).

I hate data loss of any kind! :-(
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed to be advocating?
Back to top
View user's profile Send private message
mntnoe
n00b
n00b


Joined: 21 Jan 2007
Posts: 61
Location: Denmark

PostPosted: Wed Jun 06, 2007 12:39 pm    Post subject: Reply with quote

Tried out firefox with -Os, but unfortunately it didn't help.

See the thread linked above.
Back to top
View user's profile Send private message
warrawarra
Tux's lil' helper
Tux's lil' helper


Joined: 30 May 2007
Posts: 84

PostPosted: Wed Jun 06, 2007 10:52 pm    Post subject: Reply with quote

Mine works very nicely with
-march=prescott -msse3 -m32 -pipe -O2
and
-j3 -s or -j16 -s

-j3 = bottleneck and lag , -j16 very smooth and 3 compiles at the same time on core duo 2.16ghz t2600 .

Also parallel fetch.

But gcc 4.12 or gcc 4.2 takes forever on any config / machine.
Back to top
View user's profile Send private message
sonicbhoc
Veteran
Veteran


Joined: 24 Oct 2005
Posts: 1805
Location: In front of the computer screen

PostPosted: Thu Jun 07, 2007 12:17 am    Post subject: Reply with quote

what does -s in makeopts do?
_________________
I'm too lazy to keep this stupid signature up to date, so here's something more interesting:
My friend Hetdegon can draw if you ask me.
Now using PClinuxOS on my laptop and Gentoo on my desktop and new laptop.
Back to top
View user's profile Send private message
LinuxSmiley
n00b
n00b


Joined: 13 May 2004
Posts: 36

PostPosted: Thu Jun 07, 2007 2:40 pm    Post subject: Reply with quote

sonicbhoc wrote:
what does -s in makeopts do?

man make
Quote:
-s, --silent, --quiet
Silent operation; do not print the commands as they are executed.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum