Page 9 of 16 FirstFirst ... 7891011 ... LastLast
Results 81 to 90 of 152

Thread: Improve (potentially halve) login time by using readahead

  1. #81
    Join Date
    Jan 2005
    Location
    United States
    Beans
    369
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Improve (potentially halve) login time by using readahead

    Quote Originally Posted by double1116 View Post
    Yes, the previous instructions should work. After you do updates or things change, you may want to run with " profile" in the boot sequence again.

    Please let me know either way if it works. Last time I tried it killed KDM, I'm not sure why.
    It worked great! I'm seeing major improvements in booting speed--the biggest bottleneck I have left right now seems to be Compiz. When I boot up and then log in everything is pretty quick, and I see GNOME snap into place immediately. The problem is it seems GNOME or GTK or something is fighting with Compiz over who gets to draw the desktop, because it goes black and then redraws everything exactly as it should be in about three or four seconds later.

    Strange...

    Still I'll just have to do some more research and this is the best my Laptop has been in all my using of Linux on it...so it can only get better!

    --bornagainpenguin

  2. #82
    Join Date
    Jan 2007
    Location
    $here ? $here : $there
    Beans
    3,717
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Improve (potentially halve) login time by using readahead

    Here is a small script I hacked together to do readahead on an application specific basis. There are two ways to use it. 1) You can cause an application readahead to happen just before you start the app. 2) You can cause an application readahead to happen at login if you are already using the readahead stuff from jdong.

    By default, the script is setup to do #1 but, there are instructions at the top for changing it to do #2 (it's just swapping comments).

    The basic idea is put the script in your ~/bin directory, do a chmod +x on it and then run it as sudo with the name of an app. For example, to generate a readahead list for firefox it's simply:

    Code:
    sudo ra-run.sh firefox
    That will place a readahead list in either ~/.readahead-app or ~/.readahead depending on if you choose method #1 or #2 above. If you choose method #2, you should be done and the next time you login, it will automatically readahead the app. If you choose method #1, you will also need to make a symlink for the app that points to ra-run.sh. For example, for firefox, you would do this:

    Code:
    ln -s ~/bin/ra-run.sh ~/bin/firefox
    As long as you have /home/bin as the first entry in $PATH, that should make the symlink to ra-run.sh get executed when you run firefox (which will do a readahead-list for firefox before executing /usr/bin/firefox).

    ra-run.sh
    Code:
    #!/bin/bash
    
    # Uncomment the second RA_HOME if you are using the .readahead stuff from jdong
    # and prefer to have commands cached at login/boot time
    RA_HOME=$HOME/.readahead-app
    #RA_HOME=$HOME/.readahead
    
    if [ "$1" != "" ] ; then
        APP=`basename $1`
        APP_NAME=$APP
    else
        # Called from a symlink.  Resolve it
        CMD=`basename $0`
        SCRIPT=`which $CMD`
    
        for i in `which -a $CMD` ; do
            if [ "$i" != "$SCRIPT" ] ; then
                APP_NAME=`basename $i`;
                APP=$i;
                break
            fi
        done
    fi
    
    RA_FILE=$RA_HOME/$APP_NAME
    
    if [ -e $RA_FILE ] ; then
        # We've already made the readahead file.  Load it and exec the app
        readahead-list $RA_FILE
        exec $APP
    else
        if [ "$USER" != "root" ] ; then
           echo "Error: The first time you run ra-run.sh for an app, you must run it with sudo."
           exit 1;
        fi
    
        mkdir -p $RA_HOME
    
        readahead-watch -o $RA_FILE /
    
        # This isn't optimal but, it accounts for apps that immediately go into the
        # background like oowriter
        echo "Running ra-run for $APP for the first time.  Please exit the app once it starts and wait up to 30 seconds for data to written."
    
        sudo -E -u $SUDO_USER $APP &
    
        sleep 30
        killall readahead-watch
        chown ${SUDO_USER}:${SUDO_USER} $RA_HOME -R
    fi
    Hopefully someone finds that useful. Unfortunately the speedup of method #1 is negligible on fast hardware but, if you have a lot of RAM, method #2 can be useful to prime the cache at startup for apps that you are likely to use at some point.

  3. #83
    Join Date
    Nov 2006
    Beans
    15

    Re: Improve (potentially halve) login time by using readahead

    On a Dell Inspiron 6400 with 1 Gb RAM with Ubuntu Hardy, disabling readhead makes my GRUB to login prompt about 15 secs faster. But slows down the time from login to working Gnome desktop.
    On the other hand with readahead enabled time from GRUB to login prompt is about 15 secs slower. But this is more or less compensated by the reduced time from login to working desktop.
    So, in summary, with or without readahead, it is more or less the same.

  4. #84
    Join Date
    May 2007
    Beans
    161
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Improve (potentially halve) login time by using readahead

    thumbs up from me i went from minutes to seconds. very cool

    does the order in the file generated dictate boot sequence?

  5. #85
    Join Date
    Aug 2006
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Improve (potentially halve) login time by using readahead

    Cool. I had fewer problems with login times since then.

    This led me on to further configuration. I ran readahead-watch, opened up every application in the GNOME menu, reinstalled a package using APT and then halted the system, thus creating the output file. I then reloaded the system and set up a GNOME session script to run readahead-list on the same output file every time I logged in. It felt a lot like Superfetch on Vista, with better efficiency and no constant slowdowns.


  6. #86
    Join Date
    Jan 2005
    Location
    Montréal, Québec
    Beans
    250

    Re: Improve (potentially halve) login time by using readahead

    doesn't having too much stuff prefetched by readahead harm performance? My understanding was that there was a certain "optimum" point where adding further preloading might make the performance curve go down?

  7. #87
    Join Date
    Aug 2006
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Improve (potentially halve) login time by using readahead

    Probably, kiddo. If there are loads of files being read by readahead at once, it could potentially cause disk access problems if there are other consumptive processes running at the same time. Systems with low memory might also suffer from preloaded applications if the cache is full.

    I'm not too sure about the "optimum" performance though. Maybe trying different options might solve some performance problems.

  8. #88
    Join Date
    Jan 2005
    Location
    Montréal, Québec
    Beans
    250

    Re: Improve (potentially halve) login time by using readahead

    you know, it would be so nice if there was a way to automate this whole deal, at least partly, and allow visualizing the profile file in a graphical manner (it's pretty darn hard to parse), or even click a button to "profile application X and add it to the list", and evaluate if the profile list would be too big (exceed the RAM or stuff like that).

  9. #89
    Join Date
    Jun 2008
    Beans
    1

    Re: Improve (potentially halve) login time by using readahead

    Quote Originally Posted by double1116 View Post
    Simple steps:

    1. Save the script I posted into /etc/X11/Xsessions.d
    2. Reboot but type "e" (edit) on the grub line before booting. Add " profile". This will cause the boot and desktop login process to be profiled.
    3. Login to your desktop session. Wait until things settle down, then click "okay" on the window to save the profile.
    4. Reboot normally and it should be faster.

    Note, I have had problems re-running my script with "profile" lately, I'm not sure what the problem is. It causes the KDM login to fail. YMMV.

    The improvement in the script in /etc/X11/Xsessions.d is that it simplies the steps to make this happen.
    hi,

    i am using 8.04. is this still usable? also, i am guessing that the following line has an extra dot:
    done <\${F} >> $HOME/.readahead/\${F#/tmp/${USER}.}
    it should be:
    done <\${F} >> $HOME/readahead/\${F#/tmp/${USER}.}
    or is there a more updated version?

  10. #90
    Join Date
    Jun 2008
    Beans
    Hidden!

    Re: Improve (potentially halve) login time by using readahead

    I'm also using 8.04 Hardy Heron and this isn't working for me at all. It's a pity, because my tablet has 4 GB RAM. The profile starts--I know that because there is that few minute delay before I can go back and login--but that's the catch, I can't login again. It gets stuck on loading the /etc/rc.local file for more than ten minutes...perhaps longer, but I stopped waiting and did a hard reset. Then, after restarting the computer and auto-login, I go back to the terminal per the instructions and run the script to see the files readahead wants to cache. There I get stuck, again. It doesn't give me an option to get back to the terminal; after I scroll through the whole list (I think the largest file I noted was 3.5k? Most were only a few hundred K), it tells me
    Code:
    log:
    I don't know what to enter under that... So, again, I do a hard reset, because there's just no way to close it. Repeated this at least 3 times, each time with the same results.

    Then, I created the /etc/X11/Xsession.d/00readahead, and copied and pasted, and restarted. No effect; even though I autologin I went ahead and did step 3, and it didn't help. I even tried doing it all from the terminal on my desktop (without accessing it from after logging out) and it didn't make the slightest difference.

    I'm not trying to complain--I'm simply trying to supply as much information as possible so someone who knows better (than me, the newbie) can help me--and possibly other users under Hardy Heron--I understand this guide was written before 8.04?--figure this out, and benefit from faster logins! Thanks!

    PS: Currently, my login time from the moment the ubuntu screen completes lighting up the blocks (for the lack of a better term) till the time I see the desktop is...40 seconds. So I really look forward to cutting that in half (or less!). Again, any help would be truly appreciated.
    Last edited by sarah.fauzia; June 24th, 2008 at 11:10 PM. Reason: Added in the PS note

Page 9 of 16 FirstFirst ... 7891011 ... 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
  •