{"id":1558,"date":"2009-06-01T20:40:01","date_gmt":"2009-06-02T03:40:01","guid":{"rendered":"http:\/\/multimedia.cx\/eggs\/?p=1558"},"modified":"2010-05-17T21:57:05","modified_gmt":"2010-05-18T04:57:05","slug":"ram-disk-experiment","status":"publish","type":"post","link":"https:\/\/multimedia.cx\/eggs\/ram-disk-experiment\/","title":{"rendered":"RAM Disk Experiment"},"content":{"rendered":"<p><strong>Science project:<\/strong> Can <a href=\"http:\/\/fate.multimedia.cx\/\">FATE<\/a> performance be improved &#8212; significantly or at all &#8212; by running as much of the operation as possible from RAM? My hypothesis is that it will speed up the overall build\/test process, but I don&#8217;t know by how much.<\/p>\n<blockquote><p>Conclusion and spoiler: The RAM disk makes no appreciable performance difference. Linux&#8217;s default caching is more than adequate.\n<\/p><\/blockquote>\n<p>There are 4 items I am looking at storing in RAM: The FFmpeg source code, the built objects, the ccache files, and the <a href=\"http:\/\/samples.mplayerhq.hu\/fate-suite\/\">suite of FATE samples<\/a>. This experiment will deal with placing the first 3 into RAM.<\/p>\n<p>Method:<\/p>\n<ul>\n<li>Clear ccache and compile <a href=\"http:\/\/ffmpeg.org\/\">FFmpeg<\/a> on the disk. Do this thrice and collect &#8220;wall clock&#8221; numbers using the &#8216;time&#8217; command line prefix,<br \/>\ne.g.:<\/p>\n<pre>\r\n  time `..\/ffmpeg\/configure --prefix=install-directory -cc=\"ccache gcc\" &&\r\n        make && make install`\r\n<\/pre>\n<p>The second and third runs should be faster due to Linux&#8217;s usual file caching in memory.\n<\/li>\n<li>Restart the machine.<\/li>\n<li>Perform 3 more runs using the existing cache.<\/li>\n<li>Restart the machine.<\/li>\n<li>Set up a 1GB RAM disk as outlined by <a href=\"http:\/\/www.vanemery.com\/Linux\/Ramdisk\/ramdisk.html\">this tutorial<\/a>.<\/li>\n<li>Copy the source tree into the RAM disk and configure ccache to use a directory on the RAM disk. Re-run the last step and collect numbers.<\/li>\n<li>Bonus: restart the machine again and compile the source without ccache in order to measure the performance hit incurred by ccache when there are no files cached.\n<\/li>\n<\/ul>\n<p>Hardware: MSI Wind Nettop with 1.6 GHz N330 Atom (dual-core, hyperthreaded); 2 GB of DDR2 533 RAM; 160 GB, 7200 RPM SATA HD with an ext3 filesystem. I don&#8217;t know a good way to graph this, so here are the raw numbers. The first number of each pair is wall clock time, the second is CPU time.<\/p>\n<pre>\r\nOn disk:\r\nrun 1: 15:41, 14:32\r\nrun 2:  1:43,  1:12\r\nrun 3:  1:43,  1:12\r\n\r\nOn disk, after restart:\r\nrun 1:  1:50,  1:13\r\nrun 2:  1:42,  1:13\r\nrun 3:  1:43,  1:12\r\n\r\nRAM disk (ext2):\r\nrun 1: 15:37, 14:35\r\nrun 2:  1:39,  1:12\r\nrun 3:  1:40,  1:13\r\n\r\nFrom startup, no ccache:\r\nrun 1: 15:12, 14:12\r\n<\/pre>\n<p>Building from disk after a restart demonstrates that there is a difference of 8 real seconds during which all of the relevant files are read into the OS&#8217;s file cache. The run without ccache demonstrates that using ccache with no prior cache incurs a nearly 30-second penalty as the cache must be initialized.<\/p>\n<p>And since I know you&#8217;re wondering, here&#8217;s what happens when I wipe the ccache and just let this thing rip with &#8216;make -j5&#8217; multithreaded build:<\/p>\n<pre>\r\nOn disk, with ccache, multithreaded:\r\nrun 1: 6:51, 24:12\r\nrun 2: 1:05, 2:18\r\nrun 3: 0:54, 1:41\r\nrun 4: 0:54, 1:40\r\n<\/pre>\n<p>I did 4 runs this time because I wanted to see if I saw a 4th set of numbers consistent with the 3rd.<\/p>\n<p>I know these results may elicit a big <strong>&#8220;duh!&#8221;<\/strong> from many readers, but I still wanted to prove it to myself.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Can I speed up FATE by using my own RAM disk?<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101,218],"tags":[198],"class_list":["post-1558","post","type-post","status-publish","format-standard","hentry","category-fate-server","category-science-projects","tag-ram-disk"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/1558","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/comments?post=1558"}],"version-history":[{"count":11,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/1558\/revisions"}],"predecessor-version":[{"id":2478,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/1558\/revisions\/2478"}],"wp:attachment":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/media?parent=1558"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/categories?post=1558"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/tags?post=1558"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}