<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.1.3" -->
<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"
	>

<channel>
	<title>MySQL Oddments</title>
	<link>http://www.oddments.org/?cat=2</link>
	<description/>
	<pubDate>Tue, 06 May 2008 07:37:40 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.1.3</generator>
	<language>en</language>
    <atom:link href="http://www.oddments.org/wp-rss2-mysql.php" rel="self" type="application/rss+xml" />
		        	<item>
		<title>Asynchronous I/O - How It Could Speed Up Your App</title>
		<link>http://www.oddments.org/?p=9</link>
		<comments>http://www.oddments.org/?p=9#comments</comments>
		<pubDate>Tue, 06 May 2008 07:37:40 +0000</pubDate>
		<dc:creator>Eric Day</dc:creator>
		
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.oddments.org/?p=9</guid>
		<description><![CDATA[In a previous post I wrote about how I have started implementing asynchronous I/O into the MySQL client library. I plan on contacting and working with other client API maintainers (PHP, Python, Ruby, &#8230;) to make sure this functionality gets pushed out to those places too. Any comments or suggestions on how the interfaces should [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://www.oddments.org/?p=7">a previous post</a> I wrote about how I have started implementing asynchronous I/O into the MySQL client library. I plan on contacting and working with other client API maintainers (PHP, Python, Ruby, &#8230;) to make sure this functionality gets pushed out to those places too. Any comments or suggestions on how the interfaces should behave are of course welcome, and I&#8217;ll get patches posted somewhere for testing once I have the basics working. This is also my first project going through <a href="http://forge.mysql.com/wiki/Community_Contributions">the MySQL Community Contributions Program</a> so it can be included as part of a later release. I sent out the first contact e-mail to MySQL a week ago, but have not received any response yet. Anyone at MySQL listening? :)</p>
<p>For those of you new to the idea of asynchronous clients, check out <a href="http://en.wikipedia.org/wiki/Non-blocking_I/O">the Wikipedia page</a>for an introduction. The basic idea is to be able to issue a query, have the function return immediately, do some other work (while the server processes the query), and then check for the query response and process the result (as normal). This may not be much of a gain (if any) for fast queries, but for those potentially sluggish queries that take a few hundred milliseconds, this could be significant (assuming you have something else to process during that time). This is especially so if you need to issue multiple queries that take a little time since they could all run in parallel connections.</p>
<p>Let me demonstrate with a simple use case, ignoring error checking for brevity:</p>
<pre>
...
$mysql = mysql_connect("localhost", "myuser", "mypass");
$result = mysql_query("...query that takes 500ms...");
...process result...
$result = mysql_query("...query that takes 500ms...");
...process result...
...
</pre>
<p>Imagine this is part of a PHP script for our new webpage, and it needs to issue two queries to the MySQL server. Each of these queries takes approximately 500ms, resulting in a total processing time of ~1 second. Now if the code uses asynchronous I/O:</p>
<pre>
...
$mysql[0] = mysql_connect("localhost", "myuser", "mypass", 1, MYSQL_CLIENT_ASIO);
$mysql[1] = mysql_connect("localhost", "myuser", "mypass", 1, MYSQL_CLIENT_ASIO);
mysql_query_start("...query that takes 500ms...", $mysql[0]);
mysql_query_start("...query that takes 500ms...", $mysql[1]);
$result = mysql_wait($mysql[0]);
...process result...
$result = mysql_wait($mysql[1]);
...process result...
...
</pre>
<p>(Note, this is psuedo code, it will just break if you try it currently!)</p>
<p>In this example, the &#8220;mysql_query_start&#8221; function calls will return immediately (send the packet out on the socket and return). This allows the server to process both of them in parallel, resulting in a total processing time closer to ~500ms. We just cut our page load time in half! (&#8230;well, ignoring network latency, but you get the idea)</p>
<p>You can of course expand on this by doing some other time consuming processing before waiting, say image manipulation. You can also issue more than two SQL queries (possibly to different servers) and then collect all the responses in the end. I also plan on adding a query pool so that you can add multiple pending queries to it and wait for the first one that returns. This way you would not need to order your &#8220;mysql_wait&#8221; calls in how you *think* they will return, you will always get them in the order in which they finish.</p>
<p>Again, this is still in it&#8217;s infancy, so please let me know if you have any comments or suggestions!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.oddments.org/?feed=rss2&amp;p=9</wfw:commentRss>
		</item>
	        	<item>
		<title>Will Sun&#8217;s job cuts hit MySQL?</title>
		<link>http://www.oddments.org/?p=8</link>
		<comments>http://www.oddments.org/?p=8#comments</comments>
		<pubDate>Fri, 02 May 2008 17:56:30 +0000</pubDate>
		<dc:creator>Eric Day</dc:creator>
		
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.oddments.org/?p=8</guid>
		<description><![CDATA[I just came across this article about Sun&#8217;s numbers, and read &#8220;Schwartz plans to trim as many as 2,500 workers.&#8221; Does anyone know if MySQL will get hit? It seems like they still need help (quite a few job requisitions open), and this obviously won&#8217;t help matters much.
]]></description>
			<content:encoded><![CDATA[<p>I just came across <a href="http://www.bloomberg.com/apps/news?pid=20601213&#038;sid=a9Gzs6yF60n4">this article about Sun&#8217;s numbers,</a> and read &#8220;Schwartz plans to trim as many as 2,500 workers.&#8221; Does anyone know if MySQL will get hit? It seems like they still need help (quite a few job requisitions open), and this obviously won&#8217;t help matters much.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.oddments.org/?feed=rss2&amp;p=8</wfw:commentRss>
		</item>
	        	<item>
		<title>Salutations, MySQL Community</title>
		<link>http://www.oddments.org/?p=7</link>
		<comments>http://www.oddments.org/?p=7#comments</comments>
		<pubDate>Sat, 26 Apr 2008 18:54:04 +0000</pubDate>
		<dc:creator>Eric Day</dc:creator>
		
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.oddments.org/?p=7</guid>
		<description><![CDATA[For the past couple weeks I&#8217;ve been catching up on the Planet MySQL blogs in preparation to start participating in the community. I figure this would be the best way to get to know the &#8220;who&#8217;s who&#8221; of the most active members and to follow the latest features and developments. I&#8217;ve also been doing a [...]]]></description>
			<content:encoded><![CDATA[<p>For the past couple weeks I&#8217;ve been catching up on the <a href="http://www.planetmysql.org/">Planet MySQL</a> blogs in preparation to start participating in the community. I figure this would be the best way to get to know the &#8220;who&#8217;s who&#8221; of the most active members and to follow the latest features and developments. I&#8217;ve also been doing a fair amount of reading/research on MySQL development and databases in general. In particular, I&#8217;ve found the new <a href="http://forge.mysql.com/">MySQL Forge</a> site very helpful (especially the wiki), along with the <a href="http://www.oreilly.com/catalog/9780596009571/">&#8220;Understanding MySQL Internals&#8221;</a> book written by Sasha Pachev. My plan is to become familiar enough with the code base to contribute new features, help fix bugs, and hopefully meet some friends along the way! In particular, I have an interest (and experience) in parallel, clustered, and distributed computing, and trying to get the most out of these multi-core processors. I was happy to see others were interested as well (for example, <a href="http://www.paragon-cs.com/wordpress/?p=83">this post by Keith Murphy</a>).</p>
<p>A few projects in particular that I&#8217;m going to start poking at are:</p>
<ul>
<li>Asynchronous I/O support in the client library.</li>
<li>Connection pooling in the client library (need ASIO first).</li>
<li>Multi-master replication (real multi, not just dual or circular).</li>
<li>Synchronous replication for low-latency environments (building on Google&#8217;s patches to support ALL nodes).</li>
</ul>
<p>I&#8217;ll be writing additional blog entries for each of these later. I know many (all?) of these are already on the radar within the MySQL development team, but hopefully there are ways to aid in some of this core development without being an employee of MySQl AB/Sun. I already have an email out to Jim Winstead on the ASIO support since I saw him mention it in a previous blog entry.</p>
<p>As a little background on myself, I&#8217;m a senior software engineer at <a href="http://www.concentric.com/">Concentric</a> (blog entries have the usual disclaimer: they are my opinions and do not express those of my employer). I have been writing high performance, high availability software in a clustered environment for some time now (including some proprietary clustered database projects). I&#8217;ve been a supporter of open source since my first Slackware v3 Linux install, and have been using MySQL since the late 90s. I&#8217;ve always been impressed by the stability and progress of the MySQL project, and when I spent some time to evaluate the NDB storage engine last year (very cool stuff), I decided to get myself up to speed so I could participate in the community. So, after front-loading a bunch of research, I&#8217;m excited to begin. :)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.oddments.org/?feed=rss2&amp;p=7</wfw:commentRss>
		</item>
	                        </channel>
</rss>
