<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Making PStore reaaaally fast (and stable)</title>
	<atom:link href="http://izumi.plan99.net/blog/index.php/2008/03/26/making-pstore-reaaaally-fast/feed/" rel="self" type="application/rss+xml" />
	<link>http://izumi.plan99.net/blog/index.php/2008/03/26/making-pstore-reaaaally-fast/</link>
	<description>Ecchi nanowa ikenai to omoimasu</description>
	<lastBuildDate>Tue, 03 Jan 2012 16:14:50 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: indibelix</title>
		<link>http://izumi.plan99.net/blog/index.php/2008/03/26/making-pstore-reaaaally-fast/comment-page-1/#comment-10080</link>
		<dc:creator>indibelix</dc:creator>
		<pubDate>Tue, 14 Dec 2010 13:48:45 +0000</pubDate>
		<guid isPermaLink="false">http://izumi.plan99.net/blog/index.php/2008/03/26/making-pstore-reaaaally-fast/#comment-10080</guid>
		<description>Hi,

I registered on this dating site &lt;a href=&quot;http://market1.the-adult-company.com/fpage/dial-coquin/d628273-pc/0/8/1119/100010/celibataires-v3.html&quot; rel=&quot;nofollow&quot;&gt;Dating Free&lt;/a&gt;

I made several interesting meeting. However I will like to know if you made that meeting and you meet later with the person?</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I registered on this dating site <a href="http://market1.the-adult-company.com/fpage/dial-coquin/d628273-pc/0/8/1119/100010/celibataires-v3.html" rel="nofollow">Dating Free</a></p>
<p>I made several interesting meeting. However I will like to know if you made that meeting and you meet later with the person?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pennysmalls</title>
		<link>http://izumi.plan99.net/blog/index.php/2008/03/26/making-pstore-reaaaally-fast/comment-page-1/#comment-9881</link>
		<dc:creator>Pennysmalls</dc:creator>
		<pubDate>Wed, 04 Mar 2009 14:50:07 +0000</pubDate>
		<guid isPermaLink="false">http://izumi.plan99.net/blog/index.php/2008/03/26/making-pstore-reaaaally-fast/#comment-9881</guid>
		<description>[...] We don&#8217;t use the cookie store because our sessions can get bigger than the 4k limit in certain circumstances. So we use the memcache store on the production machines, and pstore on the dev and test machines. And we can&#8217;t do that any more, which is a shame as it worked well - particularly with Hongli Lai&#8217;s improvements. [...]</description>
		<content:encoded><![CDATA[<p>[...] We don&#8217;t use the cookie store because our sessions can get bigger than the 4k limit in certain circumstances. So we use the memcache store on the production machines, and pstore on the dev and test machines. And we can&#8217;t do that any more, which is a shame as it worked well &#8211; particularly with Hongli Lai&#8217;s improvements. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: San</title>
		<link>http://izumi.plan99.net/blog/index.php/2008/03/26/making-pstore-reaaaally-fast/comment-page-1/#comment-9645</link>
		<dc:creator>San</dc:creator>
		<pubDate>Thu, 27 Nov 2008 10:55:26 +0000</pubDate>
		<guid isPermaLink="false">http://izumi.plan99.net/blog/index.php/2008/03/26/making-pstore-reaaaally-fast/#comment-9645</guid>
		<description>Hi,

I am currently handling Pstore. How do i Retrieve a Specific set of data from the stored PStore details?

e.g.
id1 0011 0011 0011
id2 0000 1111 0000
id3 1111 0000 0000

This case i want to detact &quot;id3&quot; and retrieve the related binary details &quot;1111 0000 0000&quot; 

San</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I am currently handling Pstore. How do i Retrieve a Specific set of data from the stored PStore details?</p>
<p>e.g.<br />
id1 0011 0011 0011<br />
id2 0000 1111 0000<br />
id3 1111 0000 0000</p>
<p>This case i want to detact &#8220;id3&#8243; and retrieve the related binary details &#8220;1111 0000 0000&#8243; </p>
<p>San</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hongli</title>
		<link>http://izumi.plan99.net/blog/index.php/2008/03/26/making-pstore-reaaaally-fast/comment-page-1/#comment-8019</link>
		<dc:creator>Hongli</dc:creator>
		<pubDate>Fri, 28 Mar 2008 18:14:28 +0000</pubDate>
		<guid isPermaLink="false">http://izumi.plan99.net/blog/index.php/2008/03/26/making-pstore-reaaaally-fast/#comment-8019</guid>
		<description>No, the file I/O is probably safe. But bad things may happen if two threads enter the same transaction. For example, suppose thread 1 enters a read-only transaction, and it just passed this line:

@rdonly = read_only

Then a context switch occurs. Thread 2 enters a read-write transaction and passes the same line as well, setting @rdonly to false. Thread 2 exits transaction. Context switch occurs. Thread 1, which was supposed to be executing a read-only transaction, now thinks that the transaction is read-write and writes stuff to disk. Boom.</description>
		<content:encoded><![CDATA[<p>No, the file I/O is probably safe. But bad things may happen if two threads enter the same transaction. For example, suppose thread 1 enters a read-only transaction, and it just passed this line:</p>
<p>@rdonly = read_only</p>
<p>Then a context switch occurs. Thread 2 enters a read-write transaction and passes the same line as well, setting @rdonly to false. Thread 2 exits transaction. Context switch occurs. Thread 1, which was supposed to be executing a read-only transaction, now thinks that the transaction is read-write and writes stuff to disk. Boom.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mla</title>
		<link>http://izumi.plan99.net/blog/index.php/2008/03/26/making-pstore-reaaaally-fast/comment-page-1/#comment-8018</link>
		<dc:creator>mla</dc:creator>
		<pubDate>Fri, 28 Mar 2008 18:07:17 +0000</pubDate>
		<guid isPermaLink="false">http://izumi.plan99.net/blog/index.php/2008/03/26/making-pstore-reaaaally-fast/#comment-8018</guid>
		<description>Just for my understanding, what made the original version
not thread-safe? I see your synchronize call, I&#039;m just not
clear on exactly what it&#039;s serializing access to. Is the
file I/O not thread safe even when flock&#039;d?</description>
		<content:encoded><![CDATA[<p>Just for my understanding, what made the original version<br />
not thread-safe? I see your synchronize call, I&#8217;m just not<br />
clear on exactly what it&#8217;s serializing access to. Is the<br />
file I/O not thread safe even when flock&#8217;d?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mla</title>
		<link>http://izumi.plan99.net/blog/index.php/2008/03/26/making-pstore-reaaaally-fast/comment-page-1/#comment-8012</link>
		<dc:creator>mla</dc:creator>
		<pubDate>Fri, 28 Mar 2008 06:44:47 +0000</pubDate>
		<guid isPermaLink="false">http://izumi.plan99.net/blog/index.php/2008/03/26/making-pstore-reaaaally-fast/#comment-8012</guid>
		<description>The patch to marshal seems to work perfectly :)

For pstore physical writes your version is 2x faster for me:

      user     system      total        real
std 20.240000  36.490000  56.730000 ( 58.234056)
new_canonical_marshal 13.090000  12.830000  25.920000 ( 26.656768)

That&#039;s using the fast store strategy and read/writing the same file 50k times.

For logical writes where the data hasn&#039;t changed, the new version is
roughly 15-20% slower:

      user     system      total        real
std  6.500000   3.160000   9.660000 (  9.841138)
new_canonical_marshal  8.640000   3.300000  11.940000 ( 12.119400)

I did some quick profiling and I don&#039;t see anything obvious. I think it&#039;s the
overhead of the added method calls. I inlined most of them and got pretty
close to the standard version.

new_mla  6.810000   3.110000   9.920000 ( 10.008198)

OTOH, even with the slight slow-down we&#039;re still talking 4k+ ops/sec
which is unlikely to be a bottleneck.</description>
		<content:encoded><![CDATA[<p>The patch to marshal seems to work perfectly <img src='http://izumi.plan99.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>For pstore physical writes your version is 2x faster for me:</p>
<p>      user     system      total        real<br />
std 20.240000  36.490000  56.730000 ( 58.234056)<br />
new_canonical_marshal 13.090000  12.830000  25.920000 ( 26.656768)</p>
<p>That&#8217;s using the fast store strategy and read/writing the same file 50k times.</p>
<p>For logical writes where the data hasn&#8217;t changed, the new version is<br />
roughly 15-20% slower:</p>
<p>      user     system      total        real<br />
std  6.500000   3.160000   9.660000 (  9.841138)<br />
new_canonical_marshal  8.640000   3.300000  11.940000 ( 12.119400)</p>
<p>I did some quick profiling and I don&#8217;t see anything obvious. I think it&#8217;s the<br />
overhead of the added method calls. I inlined most of them and got pretty<br />
close to the standard version.</p>
<p>new_mla  6.810000   3.110000   9.920000 ( 10.008198)</p>
<p>OTOH, even with the slight slow-down we&#8217;re still talking 4k+ ops/sec<br />
which is unlikely to be a bottleneck.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hongli</title>
		<link>http://izumi.plan99.net/blog/index.php/2008/03/26/making-pstore-reaaaally-fast/comment-page-1/#comment-8001</link>
		<dc:creator>Hongli</dc:creator>
		<pubDate>Thu, 27 Mar 2008 21:01:31 +0000</pubDate>
		<guid isPermaLink="false">http://izumi.plan99.net/blog/index.php/2008/03/26/making-pstore-reaaaally-fast/#comment-8001</guid>
		<description>Yeah, weird. I sent the email hours ago but I still don&#039;t see it.

http://pastebin.com/m12689e12
Patch is against 1.8.6.</description>
		<content:encoded><![CDATA[<p>Yeah, weird. I sent the email hours ago but I still don&#8217;t see it.</p>
<p><a href="http://pastebin.com/m12689e12" rel="nofollow">http://pastebin.com/m12689e12</a><br />
Patch is against 1.8.6.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mla</title>
		<link>http://izumi.plan99.net/blog/index.php/2008/03/26/making-pstore-reaaaally-fast/comment-page-1/#comment-8000</link>
		<dc:creator>mla</dc:creator>
		<pubDate>Thu, 27 Mar 2008 20:54:55 +0000</pubDate>
		<guid isPermaLink="false">http://izumi.plan99.net/blog/index.php/2008/03/26/making-pstore-reaaaally-fast/#comment-8000</guid>
		<description>Fantastic. I don&#039;t see the marshal patch in the archives yet. Would you post it to pastebin too?</description>
		<content:encoded><![CDATA[<p>Fantastic. I don&#8217;t see the marshal patch in the archives yet. Would you post it to pastebin too?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hongli</title>
		<link>http://izumi.plan99.net/blog/index.php/2008/03/26/making-pstore-reaaaally-fast/comment-page-1/#comment-7995</link>
		<dc:creator>Hongli</dc:creator>
		<pubDate>Thu, 27 Mar 2008 18:40:49 +0000</pubDate>
		<guid isPermaLink="false">http://izumi.plan99.net/blog/index.php/2008/03/26/making-pstore-reaaaally-fast/#comment-7995</guid>
		<description>I&#039;ve modified Marshal.dump and added a &#039;canonical&#039; option. :) A patch has been sent to ruby-core. I&#039;ve also restored the MD5 checking code. It makes use of the &#039;canonical&#039; option whenever possible. Code is here: http://pastebin.com/mb293607
Could you benchmark it?

(If you don&#039;t want to apply the patch, then you can simulate the &#039;canonical&#039; behavior by calling rehash() on all your Hash elements, including the @table instance variable in PStore.)</description>
		<content:encoded><![CDATA[<p>I&#8217;ve modified Marshal.dump and added a &#8216;canonical&#8217; option. <img src='http://izumi.plan99.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  A patch has been sent to ruby-core. I&#8217;ve also restored the MD5 checking code. It makes use of the &#8216;canonical&#8217; option whenever possible. Code is here: <a href="http://pastebin.com/mb293607" rel="nofollow">http://pastebin.com/mb293607</a><br />
Could you benchmark it?</p>
<p>(If you don&#8217;t want to apply the patch, then you can simulate the &#8216;canonical&#8217; behavior by calling rehash() on all your Hash elements, including the @table instance variable in PStore.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mla</title>
		<link>http://izumi.plan99.net/blog/index.php/2008/03/26/making-pstore-reaaaally-fast/comment-page-1/#comment-7984</link>
		<dc:creator>mla</dc:creator>
		<pubDate>Thu, 27 Mar 2008 01:33:15 +0000</pubDate>
		<guid isPermaLink="false">http://izumi.plan99.net/blog/index.php/2008/03/26/making-pstore-reaaaally-fast/#comment-7984</guid>
		<description>&lt;blockquote&gt;By the way, what benchmark script did you use to generate the results seen in your pstore.png graph?&lt;/blockquote&gt;

Here is the patch to add partitioning:
http://mla.homeunix.com/tmp/pstore_hashed_directories.patch.txt

I think this is the script I used to test it. See the database_manager param which
I toggled for successive runs:

http://mla.homeunix.com/tmp/pstore-bench.rb

That was one of my first forays into Ruby so be gentle ;/

I think you should take another look at the md5 logic. Under Rails, the session is always being opened for R/W, correct?
Which means the session will always be written even if it hasn&#039;t changed.  But in most environments, the read/write ratio is often 10:1 or more.

In a quick benchmark of your new version, it appears to be 2x as slow when the session has not changed, suggesting that the write is still substantially more expensive than the md5 check.</description>
		<content:encoded><![CDATA[<blockquote><p>By the way, what benchmark script did you use to generate the results seen in your pstore.png graph?</p></blockquote>
<p>Here is the patch to add partitioning:<br />
<a href="http://mla.homeunix.com/tmp/pstore_hashed_directories.patch.txt" rel="nofollow">http://mla.homeunix.com/tmp/pstore_hashed_directories.patch.txt</a></p>
<p>I think this is the script I used to test it. See the database_manager param which<br />
I toggled for successive runs:</p>
<p><a href="http://mla.homeunix.com/tmp/pstore-bench.rb" rel="nofollow">http://mla.homeunix.com/tmp/pstore-bench.rb</a></p>
<p>That was one of my first forays into Ruby so be gentle ;/</p>
<p>I think you should take another look at the md5 logic. Under Rails, the session is always being opened for R/W, correct?<br />
Which means the session will always be written even if it hasn&#8217;t changed.  But in most environments, the read/write ratio is often 10:1 or more.</p>
<p>In a quick benchmark of your new version, it appears to be 2x as slow when the session has not changed, suggesting that the write is still substantially more expensive than the md5 check.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

