Page 1 of 14 12311 ... LastLast
Results 1 to 10 of 139

Thread: All about ureadahead

  1. #1
    Join Date
    Sep 2005
    Location
    Birmingham, UK
    Beans
    86

    All about ureadahead

    Hey folks, we developers don't get the spare time to hang out on the forums for most of the release cycle, but in the past day I've tried to keep up with various boot-related issues and I've seen a few posts about ureadahead - and people recommending removing it.

    I thought it might be a good idea to try and explain what it does, how it does it, and why "status 4" is a good thing.

    Also I want to stress that I'm not going to tell you that there's nothing wrong with it, and that you haven't had a genuine issue, but just that I haven't heard about it if you have! I'd really appreciate it if anybody who is having problems could help out with some debugging to understand the problem, then I'll be able to fix it for you and everyone else!

    What does ureadahead do?

    In order to boot Ubuntu, we need to read somewhere between 100MB and 200MB of data from the disk and into memory. Unfortunately the slowest part of your otherwise awesome machine is its hard disk -- that's why we want this data into memory in the first place.

    Hard disks aren't just slow to read data, they're slow to find it as well! So we can lose a time of time during boot just waiting for the hard disk to find the data we need, and then read it into memory.

    What ureadahead does is figure out what pieces of which files we actually need, and read everything from the disk into memory in one go. By doing it at once we don't need to spend so much time finding everything, and because it's already in memory, we don't waste anywhere near as much time during boot.

    It's just for SSD right, not rotational HDD?

    No, quite the opposite. You're thinking of sreadahead ("Super-readahead"). This was a similar tool written by Intel for their Moblin project, and is very unashamedly optimised for SSDs.

    We tried it for a while, but found that its performance was simply terrible on rotational hard drives.

    I sat down, drank a large amount of Tea, and wrote ureadahead ("Über-readahead") to replace it. ureadahead from the get go was unashamedly optimised for rotational hard drives, that's not to say it's poor on SSD either, it performas at least as well as sreadhead there.

    But ureadahead takes several seconds of my boot!

    Yes it does; it's reading all the data in one go. If you didn't have it, those several seconds would be simply spread out across everything else, and probably last two or three times longer!

    I looked at bootchart, and ureadahead doesn't get full throughput

    Even though ureadahead reads everything in one go, and is heavily optimised to read everything in the actual order it's on the disk, it still has to skip over the bits it doesn't need.

    This "seek time" is the same performance penalty as finding data in the first place.

    The only way to avoid this is defragmenting your disk.

    But Linux filesystems don't need defragmenting!

    Whoever told you that is deeply mistaken, this is one of the most common myths of Linux.

    What is true is that Linux filesystems avoid, where possible, fragmenting their inode tables. This means that the index of how files are split up (fragmented) across the disk, and where those parts are, tends to be kept together as a whole.

    That's a good thing; fragmentation of inode tables is a big problem for other filesystems (FATs in that filesystem, etc.) so by keeping them together, it wins a lot of performance.

    But the data itself is still fragmented, and spread all over your disk in a random order. And unfortunately during boot, it's the data we need.

    One of the future things we want to do is use the ureadahead analysis of what we need during boot to feed into a defragmenter, so everything we need is in one big block on the disk.

    When does ureadahead reprofile?

    Any time a package is installed or upgraded that contains a file in /etc/init or /etc/init.d; this is a bit brute-force, and means we're probably reprofiling a bit more than we'd like.

    To force a reprofile, simply remove the "pack" files in /var/lib/ureadahead and reboot.

    In a future version we intend to move to each boot improving the pack file by identifying things read that were never used, and new things that weren't read last time.

    When does ureadahead stop profiling?

    ureadahead slightly assumes you're using auto-login; so waits about 45s after the display manager starts before it stops reprofiling. If you're logging in with a password, and want your desktop files included in the pack, type quickly

    (This will be addressed in a future version too).

    ureadahead slows down my boot!

    I want to hear from you! It really shouldn't; to give you an example of the savings, my trusty laptop boots in about 1m30s without ureadahead - and only 30s with it.

    Make sure you have the bootchart package installed. Remove the ureadahead pack files, and move the /etc/init/ureadahead.conf file to something like ureadahead.disabled. Reboot, login, etc. and wait for the bootchart to appear ("watch status bootchart" until stop/waiting).

    Now put the ureadahead conf file back, reboot and login again and wait for bootchart to appear.

    Finally reboot and login once more, and wait for bootchart to appear.

    You'll now have three bootcharts. One is without ureadahead, one is when ureadahead is profiling, and the final one is with ureadahead behaving normally.

    File a bug report on ureadahead (ubuntu-bug ureadahead) and attach these three files along with the output of "sudo ureadahead --dump" (this is quite a bit, so capture it in a file).

    I'll take a look, and we'll see if we can fix that bug for you!

    ureadahead exits with status 4!

    This isn't actually a bug

    Status 4 (usually ureadahead-other exits with this) means that you had a mountpoint in your fstab that didn't have any files on it needed during boot. Probably that drive with all those MP3s and movie files on it.

    It still reads everything needed during boot, the status is just there for me to debug other issues.

    The real bug here is that Upstart spams the console with that message, even though the ureadahead-other.conf file has "normal exit 4" in it!

    (In other words, If your boot fails, this message is completely unrelated to that! It's more likely that there is an issue with the X server starting, or an issue with init scripts not being run -- a good clue might be whether you see a login: screen after pressing Alt+F2)
    Last edited by keybuk; March 22nd, 2010 at 02:23 PM.

  2. #2
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: All about ureadahead

    Thank you for taking the time to explain this!
    GRUB2

    Retired.

  3. #3
    Join Date
    Jun 2007
    Beans
    192

    Re: All about ureadahead

    Hi keybuk,
    I don't have a problem with ureadahead I just want to thank you for this very interesting and informative post

  4. #4
    Join Date
    Apr 2009
    Beans
    Hidden!
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: All about ureadahead

    The only problem I have with ureadahead is that when it does a reprofile, it slows everything down to a crawl and the only way to fix it is to re-boot. In other words, when I do an update which requires a ureadahead profile, I re-boot. The boot process takes forever and anything I do is slow as molasses. I re-boot again and everything is back to normal.

  5. #5
    Join Date
    Sep 2006
    Location
    Central Europe
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: All about ureadahead

    Quote Originally Posted by drs305 View Post
    Thank you for taking the time to explain this!
    +1

    Good read for testing newbies!
    The Power User’s Guide to Unity
    Questions about Ubuntu? Ask them at askubuntu.com!

  6. #6
    Join Date
    Sep 2007
    Location
    Pune, India
    Beans
    445
    Distro
    Kubuntu Development Release

    Re: All about ureadahead

    thanks "SJR"... go dancing monkeys go!
    Desktop: Unbranded, Q6600 2.4 ghz CPU, Intel DP35DP mobo, 4 GB RAM, 500 GB HDD, 128 GB SSD, NVIDIA 8800GT, Dell E248WFP LCD.
    Laptop: HP Pavilion tx1302au Turion64 X2 TL-58 1.9 ghz CPU, NVIDIA GeForce Go 6150, 2 GB RAM, 64 GB SSD, Broadcom 4321 Wifi.

  7. #7
    dino99's Avatar
    dino99 is offline Ubuntu addict and loving it
    Join Date
    Jun 2006
    Location
    Nux Jam
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: All about ureadahead

    Good news to have you sparing time with us a saturday afternoon.

    I'm one which have some issues to boot and reboot:

    let say my system have 2 hdd ide & ihdd sata; each of them have a different OS: Jaunty64, Karmic32 and the last Lucid32. They are all ext3 but Lucid ext4, and boot with grub2 (Lucid release).

    95 % boot fail with kernel panic (not syncing, can't mount unknown block) the first time, making again a cold boot, it generally boot but complaint since a week or so with hdd needed fsck. Have a quick message on screen saying ureadahead ended with status 4 now (some days ago that was status 2).

    Here is for booting, when i want to reboot: session is closed but system never stopped (freezed, cold stop needed), stop (switch off) work fine.

    So, Lucid was a clean install with A2, then updated. Logs does not help about those problems as nothing is logged about starting or closing.

    I wonder if these problems are related to:
    - parted used when installing A2
    - one of gdm/ureadahead/plymouth given some conflicts/priority/timing

    i would like to report about that but how: which package, how to trace and generate usefull logs .

  8. #8
    Join Date
    Apr 2008
    Beans
    10,827

    Re: All about ureadahead

    Very, very informational and helpful! Many thanks

  9. #9
    Join Date
    Apr 2008
    Beans
    10,827

    Re: All about ureadahead

    Note to mods: could we make this a sticky please?

  10. #10
    Join Date
    Sep 2005
    Location
    Birmingham, UK
    Beans
    86

    Re: All about ureadahead

    Quote Originally Posted by michy99 View Post
    The only problem I have with ureadahead is that when it does a reprofile, it slows everything down to a crawl and the only way to fix it is to re-boot. In other words, when I do an update which requires a ureadahead profile, I re-boot. The boot process takes forever and anything I do is slow as molasses. I re-boot again and everything is back to normal.
    Actually the boot when profiling is probably just how slow your boot would be without ureadahead installed, and should be addressed when we do online reprofiling.

    The slowness after could be related to the kernel trace buffer size, which has a fix pending for next week

Page 1 of 14 12311 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •