<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>domas mituzas &#187; mmap</title>
	<atom:link href="http://dom.as/tag/mmap/feed/" rel="self" type="application/rss+xml" />
	<link>http://dom.as</link>
	<description></description>
	<lastBuildDate>Thu, 02 Feb 2012 21:29:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='dom.as' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/6e344c6e0cd7462eb056f8b98eb2cbcd?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>domas mituzas &#187; mmap</title>
		<link>http://dom.as</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://dom.as/osd.xml" title="domas mituzas" />
	<atom:link rel='hub' href='http://dom.as/?pushpress=hub'/>
		<item>
		<title>mmap()</title>
		<link>http://dom.as/2008/08/17/mmap/</link>
		<comments>http://dom.as/2008/08/17/mmap/#comments</comments>
		<pubDate>Sun, 17 Aug 2008 23:51:00 +0000</pubDate>
		<dc:creator>Domas Mituzas</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[mmap]]></category>
		<category><![CDATA[myisam]]></category>
		<category><![CDATA[vm]]></category>

		<guid isPermaLink="false">http://dammit.lt/?p=187</guid>
		<description><![CDATA[I&#8217;ve seen quite some work done on implementing mmap() in various places, including MySQL. mmap() is also used for malloc()&#8217;ing huge blocks of memory. mmap() data cache is part of VM cache, not file cache (though those are inside kernels &#8230; <a href="http://dom.as/2008/08/17/mmap/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dom.as&amp;blog=190075&amp;post=187&amp;subd=domasmituzas&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve seen quite some work done on implementing <a href='http://en.wikipedia.org/wiki/Mmap'>mmap()</a> in various places, including MySQL.<br />
mmap() is also used for malloc()&#8217;ing huge blocks of memory.<br />
mmap() data cache is part of VM cache, not file cache (though those are inside kernels tightly coupled, priorities still remain different).</p>
<p>If a small program with low memory footprint maps a file, it will probably make file access faster (as it will be cached more aggressively in memory, and will provide pressure on other cached file data -thats cheating though).</p>
<p>If a large program with lots and lots of allocated memory maps a file, that will pressure the filesystem cache to flush pages, and then&#8230; will pressure existing VM pages of the very same large program to be swapped out. Thats certainly bad.</p>
<p>For now MySQL is <a href='http://bugs.mysql.com/bug.php?id=37408'>using mmap()</a> just for compressed MyISAM files. <a href='http://www.mysqlperformanceblog.com/2006/05/26/myisam-mmap-feature-51/'>Vadim wrote</a> a patch to do more of mmap()ing.</p>
<p>If there&#8217;s less data than RAM, mmap() may provide somewhat more efficient CPU cycles. If there&#8217;s more data than RAM, mmap() will kill the system.</p>
<p>Interesting though, few months ago there was a <a href='http://kerneltrap.org/mailarchive/linux-kernel/2008/6/19/2166494/thread'>discussion on lkml</a> where <a href='http://en.wikipedia.org/wiki/Linus_Torvalds'>Linus</a> wrote:</p>
<blockquote><p>
Because quite frankly, the mixture of doing mmap() and write() system calls is quite fragile &#8211; and I&#8217;m not saying that just because of this particular bug, but because there are all kinds of nasty cache aliasing issues with virtually indexed caches etc that just fundamentally mean that it&#8217;s often a mistake to mix mmap with read/write at the same time.
</p></blockquote>
<p>So, simply, don&#8217;t.</p>
<p><b>Update:</b> Oh well, 5.1: &#8211;myisam_use_mmap option&#8230; Argh.<br />
<b>Update on update:</b> after few minutes of internal testing all mmap()ed MyISAM tables <a href='http://bugs.mysql.com/bug.php?id=38848'>went fubar</a>.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/domasmituzas.wordpress.com/187/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/domasmituzas.wordpress.com/187/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/domasmituzas.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/domasmituzas.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/domasmituzas.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/domasmituzas.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/domasmituzas.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/domasmituzas.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/domasmituzas.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/domasmituzas.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/domasmituzas.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/domasmituzas.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/domasmituzas.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/domasmituzas.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/domasmituzas.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/domasmituzas.wordpress.com/187/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dom.as&amp;blog=190075&amp;post=187&amp;subd=domasmituzas&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dom.as/2008/08/17/mmap/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c660a6eb3a4005232acb111303bef12c?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">domasmituzas</media:title>
		</media:content>
	</item>
	</channel>
</rss>
