{"id":501,"date":"2012-06-20T19:56:26","date_gmt":"2012-06-21T02:56:26","guid":{"rendered":"http:\/\/mattfife.net\/wordpress\/?p=501"},"modified":"2012-08-12T19:12:56","modified_gmt":"2012-08-13T02:12:56","slug":"moving-your-browser-cache-to-a-ramdrive","status":"publish","type":"post","link":"https:\/\/mattfife.com\/?p=501","title":{"rendered":"Moving your browser cache to a ramdrive"},"content":{"rendered":"<p>So, memory is dirt cheap right now. Crazy considering the prices just 2 years ago.  I started with 8GB in my machine, then upped it to 16GB.\u00a0 The reality has been, sadly, that I haven&#8217;t really seen a speedup or perf improvement from that extra ram as I rarely seem to use over even 8gb of memory.\u00a0 Think my max has been 12GB so far.\u00a0 It&#8217;s not really wasted as Windows 7 Prefetch is populating it with programs in the background &#8211; but that&#8217;s not super- interesting now that I have an SSD drive.\u00a0 However, I do want to save my SSD from lots of browser cache writes.\u00a0 What if I told you that you could do that, speed up your browsing by about 20% AND keeping you more secure. How?\u00a0 By moving the browsers cache to a ramdrive.<\/p>\n<p><strong>Benefits:<\/strong><\/p>\n<ul>\n<li>Speed &#8211; reports are anywhere from 20%-100% speedups<\/li>\n<li>Privacy &#8211; When you shut down and the ramdrive goes away &#8211; your entire browsing cache and cookies are irrevocably erased unless you persist\/restore it from a regular drive.\u00a0 No tracking cookies or other nasty junk is left around.\u00a0 No need to &#8216;safe delete&#8217; files.<\/li>\n<li>Security &#8211; I&#8217;ve also already seen where this method caught a pop-up virus because when I  rebooted and the app tried to install itself during the bootup cycle, the payload that was in  the cache was gone and I caught the installer&#8217;s error message.<\/li>\n<li>As long as you&#8217;re mostly hibernating\/waking and not rebooting, the cache stays active and in memory.<\/li>\n<li>Free and automatic once set up with about 5 easy steps<\/li>\n<li>Some browsers are building this method into the browser itself<\/li>\n<li>If you want to persist the cache between reboots &#8211; you can with a simple checkbox select.<\/li>\n<\/ul>\n<p><strong>Downsides:<\/strong><\/p>\n<ul>\n<li>Unless you persist\/restore the ramdrive to a regular drive, you have to rebuild the cache each time you reboot.\u00a0 First browsing on a page requires the reload of all the data.<\/li>\n<li>Could potentially slow down your entire system if you are running short of memory<\/li>\n<li>\u00a0Requires an initial setup<\/li>\n<\/ul>\n<p>So, how do you do it?\u00a0 The detailed instructions are on the linked websites below, but I&#8217;ll summarize here in case those instructions go away.\u00a0 This is for firefox, but works for all other browsers too.<\/p>\n<ol>\n<li>Download <a href=\"http:\/\/memory.dataram.com\/products-and-services\/software\/ramdisk\" target=\"_blank\">DataRam Ramdisk <\/a>and install it.\u00a0 Amazing little ramdrive program that works on x32 and x64 Windows systems all the way up and through Windows 7. Great GUI frontend, does everything you expect, super stable, restarts on boot automatically.<\/li>\n<li>Open the Ramdisk configuration utility after install:\n<ol>\n<li>Select the Settings tab\n<ol>\n<li>Set the size to anything from 500-1500mb<\/li>\n<li>Set the file system type to Fat32<\/li>\n<li>Check the Disk Label checkbox and make sure the drive name is &#8216;RAMDisk&#8217;<\/li>\n<\/ol>\n<\/li>\n<li>Select the Load and Save tab (optional step if you want the cache to persist between boots)\n<ol>\n<li>If you want the browser cache stored and reloaded when you shut down the machine, select &#8216;Save disk image on shutdown&#8217; and &#8216;Load disk image on Startup&#8217;.\u00a0 Make sure they point to the same image file.<\/li>\n<li>I don&#8217;t do either of these as I want my cache to go away.\u00a0 Loading\/Saving the state will also increase both your bootup and shutdown times.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<\/li>\n<li>Open Firefox\n<ol>\n<li>Type &#8216;about:config&#8217; (no quotes) in the address bar<\/li>\n<li>Hit the &#8216;I&#8217;ll be careful&#8217; button<\/li>\n<li>Right click &#8211; select New -&gt; String<\/li>\n<li>Type &#8216;browser.cache.disk.parent_directory&#8217; into the box and press OK<\/li>\n<li>Type the path of your BrowserCache directory using the drive letter of the Ramdrive i.e. &#8216;R:BrowserCache&#8217;<\/li>\n<li>Close all open Firefox tabs and windows<\/li>\n<li>Reopen Firefox, open any webpage, and see if there is a new directory called BrowserCache on your ramdrive.<\/li>\n<\/ol>\n<\/li>\n<li>Fix the drive letter on reboot.\u00a0 Ramdisk has an annoying feature.\u00a0 On reboot, it&#8217;ll assign the Ramdrive whatever random drive letter is available.\u00a0 Obviously, this breaks the cache directory assignment in Firefox.\u00a0 You&#8217;d need to update Firefox each reboot to point to the right drive.\u00a0 Totally unacceptable.\u00a0 DataRam&#8217;s Ramdisk doesn&#8217;t allow you to specify the drive letter of the  ramdisk.\u00a0 Totally unacceptable.\u00a0 But &#8211; you can get around this by having a  script move the drive letter during bootup.\n<ol>\n<li>Copy the below code, then use notepad or other text editor to save it in a file called C:RamdiskRename.bat<\/li>\n<li>Press Win + R (or find \u201cRun\u201d on start menu), a \u201cRun\u201d dialog will appear. Enter \u201cgpedit.msc\u201d and select the \u201cgpedit\u201d in Programs list.<\/li>\n<li>In the left pane, click \u201cLocal Computer Policy\u201d -&gt; \u201cWindows Settings\u201d -&gt;  \u201cScripts(Startup\/Shutdown)\u201d \u00a0then on the right side, click \u201cStartup\u201d<\/li>\n<li>In the pop-up dialog, On the \u201cScripts\u201d tab, click \u201cAdd\u2026\u201d and add the \u201cC:RamdiskRename.bat\u201d to the list. Click \u201cOK\u201d to finish.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p>Thats it!\u00a0 To test it, reboot your machine, and you should see the ramdisk always at R.\u00a0 When you open the browser for the first time after a reboot, you should see the cache directory appear in that drive. Using the Chromium benchmarking tool, the original author found that page load times were reduced by around 20%.\u00a0 Shutting down and restarting the browser is also a lot quicker.<\/p>\n<p><strong>Links:<\/strong><a href=\"http:\/\/www.zomeoff.com\/fixing-the-drive-letter-for-your-ramdisk-a-simple-solution-to-dataram-ramdisk\/\" target=\"_blank\"><br \/>\nhttp:\/\/downloadsquad.switched.com\/2010\/11\/10\/how-to-move-the-firefox-or-chrome-cache-to-a-ram-disk-and-speed\/<br \/>\nhttp:\/\/www.zomeoff.com\/fixing-the-drive-letter-for-your-ramdisk-a-simple-solution-to-dataram-ramdisk\/<\/a><\/p>\n<p><strong>RamdiskRename.bat:<\/strong><code><br \/>\n@echo off<br \/>\n:: Settings<br \/>\nSET _ramdisklabel=RAMDISK<br \/>\nSET _ramdiskletter=R:<\/code><\/p>\n<p><code>:: Get ramdisk disk number in diskpart<br \/>\necho list volume &gt; %systemdrive%ListDrives.tmp<br \/>\ndiskpart \/s %systemdrive%ListDrives.tmp &gt; %systemdrive%DriveList.tmp<br \/>\nFOR \/F \"tokens=2-4\" %%a IN ('type %systemdrive%DriveList.tmp') DO @IF \/I \"%%c\"==\"%_ramdisklabel%\" @set _ramdisknum=%%a<\/code><\/p>\n<p><code>:: Create drive change script<br \/>\necho. &gt; %systemdrive%ChangeDrive.tmp<br \/>\nif DEFINED _ramdisknum (<br \/>\necho select volume %_ramdisknum% &gt;&gt; %systemdrive%ChangeDrive.tmp<br \/>\necho assign letter=%_ramdiskletter% &gt;&gt; %systemdrive%ChangeDrive.tmp<br \/>\n)<\/p>\n<p>:: Run diskpart using the new script file<br \/>\ndiskpart \/s %systemdrive%ChangeDrive.tmp<\/p>\n<p>:: Delete the script files<br \/>\ndel \/q \/f %systemdrive%ListDrives.tmp<br \/>\ndel \/q \/f %systemdrive%ChangeDrive.tmp<br \/>\ndel \/q \/f %systemdrive%DriveList.tmp<\/p>\n<p><\/code><code><\/code><code>exit \/b 0<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>So, memory is dirt cheap right now. Crazy considering the prices just 2 years ago. I started with 8GB in my machine, then upped it to 16GB.\u00a0 The reality has been, sadly, that I haven&#8217;t really seen a speedup or perf improvement from that extra ram as I rarely seem to use over even 8gb of memory.\u00a0 Think my max has been 12GB so far.\u00a0 It&#8217;s not really wasted as Windows 7 Prefetch is populating it with programs in the&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/mattfife.com\/?p=501\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[5],"tags":[],"class_list":["post-501","post","type-post","status-publish","format-standard","hentry","category-technical"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4WECr-85","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/mattfife.com\/index.php?rest_route=\/wp\/v2\/posts\/501","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mattfife.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mattfife.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mattfife.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mattfife.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=501"}],"version-history":[{"count":1,"href":"https:\/\/mattfife.com\/index.php?rest_route=\/wp\/v2\/posts\/501\/revisions"}],"predecessor-version":[{"id":556,"href":"https:\/\/mattfife.com\/index.php?rest_route=\/wp\/v2\/posts\/501\/revisions\/556"}],"wp:attachment":[{"href":"https:\/\/mattfife.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mattfife.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=501"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mattfife.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}