Monday, December 3, 2007

Optimizing Windows XP for SSD use

[Original portuguese article here]



Although SSD (Solid State Disks) are now becoming a lot more common (even cheap mini-laptops like the Eee PC use Flash disk storage) it doesn't mean that our old trusted MS Windows XP knows how to use it properly.



The main issue with flash based SSD is the limited number of write cycles.

Although hundreds of thousands may sound like a lot, a computer can issue hundreds of writes per second - and even though some SSD use a "smart" relocation scheme, so it spreads the writes across different sectors in order not to wear down a single area; the fact remains that paging files and temporary files cause significant degradation that can cause disk errors in just a few months of regular use.



On Linux (like on the Asus Eee PC) you can turn off the swap files with just 512Mb of Ram; on Windows XP that wouldn't be possible (and would be even worse on Vista.)



So, before considering upgrading your laptop or UMPC for SSD use, it's best to upgrade your RAM to its highest capacity.

On XP, with 2Gb of Ram you can turn off the paging file - I've done so over 2 years ago and just rarely get a "out of memory" error (and only when forcing it, like trying to use Photoshop to edit multiple 12Mpixels images while having 2 browsers with dozens of tabs open, and burning a DVD at the same time.) Under regular conditions, even with multiple browsers open, I can still play memory intensive games like ETQW and UT3 without any problem.



With no swap file, you avoid the constant disk trashing due to the page file constant reading/writing, However, there's still more to be done.



There are other programs that use disk space for temporary buffers and caches. Internet Browsers are probably the worst of them. Each time you visit a new page, hundreds of small files are written to disc to speed up future requests. Although not a big deal on magnetic hard drives, these are not well suited to SSD.

Until these programs offer a finer control on how to use their RAM/disk caches and memory usage, the most efficient way to deal with it is by using a RAM disk.

Yes, I know it sound illogical - waste RAM making it look like it's a disc... However it does work out ok for the time being.

You just need to configure your programs to use the newly created ram disk to store their temporary files.

(As an added advantage you also stop worrying about cleaning your disk and privacy issues - every time you reboot it will clear all you temporary files; though some Ram disk drivers also allow you to commit the changes to disk at shutdown time, restoring it when you boot up again.)



There still one other alternative - though it requires a fair amount of computer knowledge.

If you use the EWF (Enhanced Write Filter) originally designed for XP Embedded, it allows you to manage writes much more efficiently.

Just like Ubuntu "live CD" that allows you to boot and save files even if you don't have a hard-drive installed, the EWF reroutes all writes through a management layer which would allow you to commit the changes to disk only when absolutely necessary. Usually, when a shutdown/suspend is in order, or when some extra free memory was required. However, this is not easy to setup, and not indicated for a "normal" windows user.



With Linux - although I'm not an expert on it - I imagine all these changes would be a lot easier to implement (or they might be there already, requiring just the correct settings.)



On Windows, as we can't change its source-code, we need to resort to these ips and tricks to maximize SSD performance and reliability (though you can also use it even if you use regular Hard-Drives.

  • Install as much RAM as possible (at least 2Gb, but ideally 3 or 4Gb)

  • Deactivate the paging file

  • Use 128-512Mb as a RAM disk (depending on your needs) and setup your programs to use it as storage space for temporary files/caches


Update]

Article further expanded here.

30 comments:

  1. Pretty OK, except for the part about write times. Most drives on the market today measure their MTBF in the millions of hours, which is based on hundreds of thousands of read/write cycles a day. To say that the main limiting factor is writes is just wrong. My main concern right now is the speed, at 26 - 28 mb/s thats just plain slow. I was hoping this would have some tips on optimizing the cacheing or whatever to speed up the read times, but alas I must look elsewherez

    ReplyDelete
  2. Charles, we're talking about flash based SSD "hard drives" - and those do have a few thousand write cycles.

    From wikipedia:
    "Limited write cycles. Typical Flash storage will typically wear out after 100,000-300,000 write cycles, while high endurance Flash storage is often marketed with endurance of 1–5 million write cycles (many log files, file allocation tables, and other commonly used parts of the file system exceed this over the lifetime of a computer). Special file systems or firmware designs can mitigate this problem by spreading writes over the entire device, rather than rewriting files in place."

    As for speed, there are a lot of different SSDs out there - and it all depends on how much you're willing to spend.
    For instance Mtron SSDs have read speed in the 80-110 MBytes/s and sustained writes of 75Mbytes/s.

    Not that slow. :)

    And if you put them in raid 0, then... even the raid contolers have trouble keeping up with it:
    9 SSDs in Raid 0.

    The reason for this post was to reduce the number of writes. If you have a slow "device" (either conventional HD or Flash based SSD) there's not much you can do to improve performance: you can maximize RAM cache, but that won't "fix" the slow drives.
    (just compare a 4200rpm HD with a 7200 HD)

    ReplyDelete
  3. Yuh, look at the current specs for ssds on newegg, look at the manufacturer sites, the SSDs are rated as MTBF 2million - 5million hours of use, with an average of 50 gigs a day swapped around on it, meaning hundreds of thousands of read write cycles.

    The problem with wikipedia is the lack of proper sources, the site they list as a source for that has nothing to do with hardware and is discussing the implications of using linux with flash drives, and not SSDs, but more specifically thumb drives and their limited write capacity. The same does not hold true for SSDs.

    The main thing I can take from your article is limiting the amount of writes, but not because of wear and tear, more for the slow ass transfer rates.

    Thanks for trying?

    ReplyDelete
  4. Could you please provide links for it?
    I do happen to work with hardware, and I regularly get to order flash memory chips from the "biggest" manufacturers - and all their spec sheets state the same: few thousand write cycles, with high-endurance flash chips (regularly smaller sized chips, or a customized special area on larger chips) achieving a few millions writes.
    Thing that can also be kind of "mimicked" by inteligent contollers on SSD spreading the writes across different areas - just like stated on Wiki. I wouldn't quote "wiki" if I though it was "made-up" data.

    MTBF is a compleletly different "measurement", and has nothing to do with write cycles.
    PROMs MTBFs of millions of hours too, and you can write them only once!
    MTBF states that, operating within the specifications, the device should work as expected for "X" time.
    If you over-write the device, you'll be out of spec, therefore...

    Just check this data sheet for a Toshiba flash chip:
    1,000,000 write cycles

    This Micron 8Gb Nand Flash: 100,000 write cycles.

    As you can see, the specs are accurate.


    If you use a FTP (for example) program that writes to "disc" once-per-second, (without considering write caches and inteligent sector management on the controller) even 1, or even 2 or 5 million write cycles can easily be surpassed in a matter of weeks.

    Caches, and intelligent management will certainly help extends that, but in write-intensive apps even those might not be enough to make it last "for years".
    Of course, I'm talking about a worst-case scenario, and that's why I was talking about minimizing writes.

    As for the speed, that you insist on being slow: I've pointed you to SSDs capable of over 70MB/s sustained writes - it's all about which SSD you choose.

    ReplyDelete
  5. I actually thought that it was a pretty good article. The only thing that I would like to point out though is that a lot of those MTBF times are overly inflated and under "ideal" conditions.

    I know this because I did a report on MTBF's of several computer systems my company assembles. For example Seagate says that the hard drives we're using aren't supposed to fail for like ~79.90 years...

    Would you trust a 7200RPM SATA drive to work for 80 years? Cause I know I've had to replace about half a dozen that were in the field for 1-2 years.

    ReplyDelete
  6. Thanks Pete.

    No, I would definitely not trust "anything" to be reliable for 80 years. :)

    My own PC has been working for the past 4 years, 24/7, using 6 Hard disks, and there's still no sign of problems.

    But you know how it is: most problems do pop up unannounced! ;)

    Many years ago, I had the misfortune of having those infamous IBM drives that would give you the click-of-death; since then I am very serious in keeping my hardware running cool.
    In my PC case, I have a dedicated airflow path just to keep the Harddrives as cool as possible)

    ReplyDelete
  7. The RAM disk for temp but frequently written files is a good idea for laptop users and those who want to wring the last bit of performance out of their computer, but for those of us who are desktop users with a spare HDD or two, it would be nice to get some suggestions on how to make our OS and applications reside on the SSD and put their frequently changed files on a HDD. I would like to see more depth on that than was given in the original article.

    ReplyDelete
  8. Point taken, I'll write an article about optimizing for dual HD setups - including the case of 1 magnetic HD and 1 Flash SDD.

    ReplyDelete
  9. Optimizing Windows XP and Office 2003 for Solid State Drives on “Netbooks”

    Asus eee PC 1000, 901, Acer Onennote, Lenovo Ideapad S10, SSD

    Intel Atom 270, Diamondville, VIA C7, Celeron

    Problem:

    Slow access / program hang / freeze / stuttering / slow response time on Windows XP, especially with Microsoft Outlook 2003.

    Solution:

    Windows Tweaks:

    - Upgrade DRAM memory to maximum allowed (2gb for Intel Atom based PCs)

    - Make sure that XP system files are either less than 50% of SSD disk capacity (if your machine has more than 1 SSD), or are installed on the larger of the 2.

    - Remove all unnecessary Windows components and leftovers following these directions:

    http://forum.eeeuser.com/viewtopic.php?pid=352761

    Additional Tricks

    - Turn off hibernation to save the 2gb space on the 8gb SSD (on E 1000)

    - Turn off System Restore

    - Turn off Windows Disk Caching and manually delete the cache files


    Anti-Virus / Phishing / Spyware Programs

    - These programs all use a lot of disk access and if at all possible, use the minimum and use an antivirus scanner that is small, compact, and runs relatively fast like Avira free-av.com

    - In any case, the antivirus service should be set to optimize for speed rather than maximum security. For example, set the AV to check only selected lists of files (smart list on Avira), and only check it on READ, not read and write.




    Speeding up specific applications:

    Firefox, IE, etc.

    - These programs cache a lot and should be installed on the larger SSD and then make sure that their cache files are on the larger disk

    Special Instructions to speed up Microsoft Outlook 2003

    Outlook 2003 is so slow as to be nearly unusable on the ASUS eee PC 1000, here are the tweaks I did:

    - Turn off Windows Prefetch following these instructions.

    http://www.ocztechnologyforum.com/forum/showthread.php?t=42487

    - manually edit registry keys

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\Session Manager\Memory Management\PrefetchParameters]
    "EnablePrefetcher"=dword:00000000

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Dfrg\BootOpt imizeFunction]
    "Enable"="N"

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr entVersion\OptimalLayout]
    "EnableAutoLayout"=dword:00000000


    - or download 'Disable WinXP Prefetcher

    http://mampan.org/prefetch/Disable_Prefetcher.reg and double click.

    Microsoft Windows / Office / Outlook is optimized for relatively slow hard drives and makes extensive use of caching. This is unnecessary with SSDs and only serve to slow things down.



    Follow these directions, and my Windows XP and Outlook 2003 works pretty fast --- mail opens up instantly, and it is no different from running it on a hard drive.

    ReplyDelete
  10. interesting that this article is almost a year old, but the recent comments are what i was actually looking for. i too am looking at optimizing for dual drive systems - with the capacities of SSD available within a reasonable price range at the moment, i was surprised to read about setting up a system based solely on flash. obviously there are some applications like surf-stations and (non-internal storage-based) HTPCs that could benefit from this, but both of those systems would do fine with standard/cheaper solutions.

    Carlos, any estimate on when such an article would be ready?

    ReplyDelete
  11. @anonymous

    Thanks for those tips, they are indeed quite interesting.

    @s0macyde

    I'm working on it... I'll post a link here when it's done.

    ReplyDelete
  12. Ok, I wrote some more about it, in a 3 part article.

    The 2 first parts are already online.

    If you're interested, you can read it here:

    Optimizing XP for dual hd/ssd

    ReplyDelete
  13. Does anyone know how to relocate Firefox's disk cache on a RAM disk? I can't find how to do this.

    ReplyDelete
  14. Why can't there be an SSD version of WinXP which stores only the Operating System and Programs On SSD and uses SATA HDD for Data, Page and Temp Files ??? Would that be so hard ? Actually that is how it should always be, One Partition for Programs, One for Data, One for Temp files, Logs, etc., and One for System Backup...

    Then Can get away with Program's Partition of about 20 to 25 GB and System Backup same as Programs Partition, Temp can be about 3 times the Ram and balance for Data.

    That way one can install System and Programs on SSD along with System Backup (like in Phones), have a Temp on Ram Drive that clears when system restarts or can be on SATA with Data Partition

    Will try with Bart's PE

    ReplyDelete
  15. @Anonymous

    Yes, that would be great. However, I don't imagine MS to "go back" to XP to do these enhancements... they'll probably advertise Win7 as being the friendliest SSD OS ever (which, for windows OSes is true - it automatically disables defrags and indexing for SSDs.)

    I'm in the process of building a new PC right now, and waiting for my OCZ SSD to arrive (currently out of stock) and so, you can expect a new article coming up soon. :)

    ReplyDelete
  16. Dear Anonymous, :-)
    It would indeed be a wonderful thing if the O/S was SSD aware. But unfortunately its not really the OS write operations (over and above defragmentation/indexing etc) that pose the problem here.

    Windows is not a fundamentally "structured" O/S. User files are scattered around on the disk. Cache files could be in the program files folder or documents and settings or windows folder or anywhere else for that matter!

    Dare I say it, Linux has had this sorted since its creation. User files stored in /home, config files in /etc, programs in /bin, processes in /proc, logs in /var. This makes re-directing writes to another disk, perhaps a HDD, an absolute breeze by comparison. Also the programs are much disciplined as the settings and cache files created when programs execute are also stored in that users /home folder. So if your /home folder was stored on an HDD, you would have just a few services to disable and you'd be done and dusted!

    I think those of use that are not going to be embracing Microsofts "latest and greatest, SSD friendly O/S" may have to accept that insane disk speeds will come at a price...

    You wouldn't buy a high performance Ferrari and expect to drive 30,000 miles at 150mph without an expensive service before during and after!

    SSD's are a quantum leap in terms of performance, but as with most things leading edge, early adoption technologies, it comes at a cost!

    Best regards

    Techfreakz

    P.S. I'd be interested to know if the latest MS O/S is SSD friendly, even if the SSD's are set on a RAID controller and only appear as a single physical disk?

    ReplyDelete
  17. @Techfreakz

    Thanks for your comment. :)

    As far as I know, WIn7 is indeed SSD friendly (at least it disables unneeded services when on SSD - defrags, indexing services, etc. - and its supposed to know when to issue trim commands, etc - though I guess future SSDs will do that automatically, like some OCZs already do with beta firmwares.)

    ReplyDelete
  18. Turn off defragment, causes unnecessary writes and doesn't give a performance boost with SSD. turn off hibernate if you don't use it. will waste lots of space, especially if you have lots of ram. SSDs are still small.

    ReplyDelete
  19. @Matt
    ... Tell me about it, my current PC has 12GB ram, hibernate would be a killer. Luckily S3 sleep mode has been working like a charm. :)

    ReplyDelete
  20. SSD Hard Drives are hard drives that exceeds normal hard drive disks's speed.SSDs increase computer speed surprisingly.really it is good idea if u wanna best speed for your comuter.

    ReplyDelete
  21. thank you so much mr. obvious

    ReplyDelete
  22. Disabling the page file is not advised with windows, since it is integral to the OS, as it handles virtual memory requests. On x64 systems, many applications allocate memory through the use of virtual addresses which are translated into 'real' addresses by the OS.

    ReplyDelete
  23. @liam

    Might be so, but I've stopped using pagefiles in XP over 8 years ago without a hitch, and have done it with Win7 (64 bits) as well ever since I got it.

    ReplyDelete
  24. TWEAK! Just dont buy a damn SSD!
    Seems most of you are missing the point, of it all! Why are you tweaking Windows, the point is to take the mechincal hard-drive out of the picture....no change everything about windows, so that it DOES NOT use the SSD.

    Use the damn SSD, dont try to avoid it!

    ReplyDelete
  25. @Anonymous
    I'd might want to look at the date of the post. It's over 3 years old and a lot has changed since then.
    As it's stated in the title: it was intended to "optimize" performance.
    Of course simply pluging in the SSD and using it will work wonders; but for anyone wanting to go the extra mile, those were valuable tips. (Some still are, even today and for Win7.)

    ReplyDelete
  26. Good Job Carlos! I'm still running XP and want to install a SSD. I'm keeping temp files/paging on a separate HD......z

    ReplyDelete
  27. Good Job Carlos!.......I'm still running XP (love it) and am installing a SSD......gonna keep temp files/swap on a separate HD..........z

    ReplyDelete

Related Posts with Thumbnails

Amazon Store