<?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/"
	>

<channel>
	<title>Transactions on InnoDB &#187; mutex</title>
	<atom:link href="http://blogs.innodb.com/wp/tag/mutex/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.innodb.com/wp</link>
	<description>&#34;The word&#34; about InnoDB Products and Technology</description>
	<lastBuildDate>Fri, 23 Dec 2011 11:17:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>MySQL 5.5: InnoDB Performance Improvements on Windows</title>
		<link>http://blogs.innodb.com/wp/2010/09/mysql-5-5-innodb-performance-improvements-on-windows/</link>
		<comments>http://blogs.innodb.com/wp/2010/09/mysql-5-5-innodb-performance-improvements-on-windows/#comments</comments>
		<pubDate>Sun, 19 Sep 2010 19:31:12 +0000</pubDate>
		<dc:creator>Calvin Sun</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[InnoDB API]]></category>
		<category><![CDATA[mutex]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blogs.innodb.com/wp/?p=679</guid>
		<description><![CDATA[At MySQL, we know our users want Performance, Scalability, Reliability, and Availability, regardless of the platform the choose to deploy. We have always had excellent benchmarks on Linux, and with MySQL 5.5, we are also working hard on improving performance on Windows. The original patch of improving Windows performance was developed by MySQL senior developer [...]]]></description>
			<content:encoded><![CDATA[<p>At MySQL, we know our users want Performance, Scalability, Reliability, and Availability, regardless of the platform the choose to deploy.  We have always had excellent benchmarks on Linux, and with MySQL 5.5, we are also working hard on improving performance on Windows.</p>
<p>The original patch of improving Windows performance was developed by MySQL senior developer Vladislav Vaintroub; benchmarks by QA engineer Jonathan Miller. We integrated the patch into MySQL 5.5 release.</p>
<p>The following two charts show the comparison of MySQL 5.5 vs. MySQL 5.1 (plugin) vs. MySQL 5.1 (builtin) using sysbench:</p>
<p><a href="http://blogs.innodb.com/wp/wp-content/uploads/2010/09/MySQL-5.5-RO-Windows2.jpg"></a><a href="http://blogs.innodb.com/wp/wp-content/uploads/2010/09/MySQL-5.5-RO-Windows3.jpg"><img class="aligncenter size-large wp-image-699" title="MySQL-5.5-RO-Windows" src="http://blogs.innodb.com/wp/wp-content/uploads/2010/09/MySQL-5.5-RO-Windows3-1024x625.jpg" alt="" width="600" height="366" /></a></p>
<p><a href="http://blogs.innodb.com/wp/wp-content/uploads/2010/09/MySQL-5.5-RW-Windows.jpg"><img class="aligncenter size-large wp-image-702" title="MySQL-5.5-RW-Windows" src="http://blogs.innodb.com/wp/wp-content/uploads/2010/09/MySQL-5.5-RW-Windows-1024x638.jpg" alt="" width="600" height="366" /></a></p>
<p><span id="more-679"></span></p>
<p>MySQL 5.5 includes a Windows performance patch, plus <a href="http://dev.mysql.com/tech-resources/articles/introduction-to-mysql-55.html">other performance improvements</a>. This Windows performance patch has two part: part one is to fix the inefficiency of InnoDB slow mutex implementation on Windows &#8211; implement slow mutex as <a href="http://msdn.microsoft.com/en-us/library/ms682530%28VS.85%29.aspx">CriticalSection</a>; and part two is to take advantage of <a href="http://msdn.microsoft.com/en-us/library/ms682052%28VS.85%29.aspx">condition variables</a> on Windows Vista or newer Windows operating systems. Condition variables are not supported on Windows Server 2003 and Windows XP/2000.</p>
<p>What if I have an old Windows on which condition variables are not supported? Well, you can still benefit from the new slow mutex implementation; but will not be able to take the advantage of condition variables. The same binary runs on old Windows too. The InnoDB does a dynamic checking during start-up, to see whether condition variables are supported by the operating system it runs on.</p>
<p>Another benefit from this patch is the reduced consumption of Windows kernel objects (or handles), which deserves another blog on its own.</p>
<p><a href="http://dev.mysql.com/downloads" target="_self">Download MySQL 5.5 RC release</a> to give it a try for yourself! Thanks to Vladislav and Jonathan for their hard work!</p>
<h3>Hardware configuration and operating system</h3>
<p>Intel x86_64, 4 CPU x 2  Cores , 3.166 GHz, 8GB RAM, and Windows Server 2008.</p>
<h3>MySQL / InnoDB configuration</h3>
<p>Relevant my.cnf parameters:</p>
<p style="padding: 2px 6px 4px 45px; color: #555555; background-color: #0000000; border: #dddddd 2px solid;"><code>max_connections=500<br />
max_connect_errors=50<br />
table_cache=2048<br />
query-cache-size=0<br />
query-cache-type=0<br />
disable-log-bin<br />
transaction_isolation=REPEATABLE-READ<br />
innodb-file-per-table=1<br />
innodb_data_file_path=ibdata1:200M:autoextend<br />
innodb_buffer_pool_size=4G<br />
innodb_additional_mem_pool_size=20M<br />
innodb_log_file_size=650M<br />
innodb_log_files_in_group=2<br />
innodb_log_buffer_size=16M<br />
innodb_support_xa=0<br />
innodb_doublewrite=1<br />
innodb_thread_concurrency=0<br />
innodb_flush_log_at_trx_commit=1<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.innodb.com/wp/2010/09/mysql-5-5-innodb-performance-improvements-on-windows/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Software is Hard Sometimes &#8230;</title>
		<link>http://blogs.innodb.com/wp/2009/03/software-is-hard-sometimes/</link>
		<comments>http://blogs.innodb.com/wp/2009/03/software-is-hard-sometimes/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 08:00:59 +0000</pubDate>
		<dc:creator>Vasil Dimov</dc:creator>
				<category><![CDATA[InnoDB Plugin]]></category>
		<category><![CDATA[Concurrency]]></category>
		<category><![CDATA[mutex]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[portability]]></category>
		<category><![CDATA[Scalability]]></category>

		<guid isPermaLink="false">http://blogs.innodb.com/wp/?p=350</guid>
		<description><![CDATA[Some months ago, Google released a patch for InnoDB that boosts performance on multi-core servers. We decided to incorporate the change into the InnoDB Plugin to make everybody happy: users of InnoDB don&#8217;t have to apply the patch, and Google no longer has to maintain the patch for new versions of InnoDB. And it makes [...]]]></description>
			<content:encoded><![CDATA[<p>Some months ago, Google released a <a href="http://code.google.com/p/google-mysql-tools/wiki/SmpPerformance">patch</a> for InnoDB that boosts performance on multi-core servers.  We decided to incorporate the change into the InnoDB Plugin to make everybody happy: users of InnoDB don&#8217;t have to apply the patch, and Google no longer has to maintain the patch for new versions of InnoDB.  And it makes us at Innobase happy because it improves our product (as you can in <a href="http://blogs.innodb.com/wp/2009/03/plug-in-for-performance-and-scalability/">this post</a> about InnoDB Plugin release 1.0.3).</p>
<p>However, there are always technical and business issues to address.  Given the low-level changes in the patch, was it technically sound?   Was the patch stable and as rock solid as is the rest of InnoDB?  Although it was written for the built-in InnoDB in MySQL 5.0.37, we needed to adapt it to the InnoDB Plugin. Could we make the patch portable to many platforms?   Could we incorporate the patch without legal risk (so it could be licensed under both the GPL and commercial terms)?</p>
<p>Fortunately Google generously donated the patch to us under the BSD license, so there was no concern about intellectual property (so long as we properly acknowledged the contribution, which we do in an Appendix to the manual and in the source code).  So, while the folks at Google are known for writing excellent code, we had to thoroughly review and test the patch before it could be incorporated in a release of InnoDB.</p>
<p>The patch improves performance by replacing InnoDB mutex and rw-mutex with atomic memory instructions. The first issue that arose was that the patch assigned the integer value -1 to a pthread_t variable, to refer to a neutral/non-existent thread identifier.  This approach worked for Google because they use InnoDB solely on Linux. As it happens, pthread_t is defined as an integer on Linux.</p>
<p>But we had problems when the patch was tested on FreeBSD.  We still needed to reference a non-existent thread, but in some environments (e.g. some versions of HPUX, Mac OS X) pthread_t is defined as a<br />
structure, not an integer.  As we looked at it, the problem became more complex.  For this scheme to work, it must be possible to change thread identifiers atomically, using a Compare-And-Swap instruction.  Otherwise, there will be subtle, mysterious and nasty failures.</p>
<p><span id="more-350"></span></p>
<p>We thought about enabling this patch only on Linux.  But that approach was not optimal, because the patch could work perfectly well on other platforms where pthread_t is the same size as the machine word, like FreeBSD and Solaris, for example.   We could have simply enumerated the operating system names where the patch would be supported, but this too was far from perfect.  The ability to use the atomic instructions depends not only on the operating system, but the GCC version (has to be 4.1 or newer) and the capabilities of the CPU (some CPUs do not support Compare-And-Swap!).</p>
<p>So, we developed a dynamic compile-time check for checking whether the target environment (pthread_t type and size, GCC version, CPU capabilities) supports the use of atomic instructions as intended. This seemed to be the best approach, but then another problem arose! </p>
<p>Dynamic compile-time checks (i.e. autoconf) are part of the MySQL&#8217;s ./configure script.  Innobase does not control this script, and so we must live with what is distributed by MySQL.  To make things simple for<br />
users, we wanted to avoid asking the users to re-create ./configure with the autotools. So we simply injected the required checks in the Makefile.  This seemed to work fine.   Only after release of the InnoDB Plugin 1.0.3 did a small crack in this approach arise.  Fortunately this problem turned out to be easy to fix and only occurs if one compiles with &#8220;make -j&#8221; (in order to perform the make in parallel). See <a href="http://bugs.mysql.com/43740">Bug#43740</a> for details and for a fix.</p>
<p>The bottom line is that sometimes more goes on &#8220;behind the scenes&#8221; than you might expect when it comes to incorporating a third-party contribution into a product.  We are grateful for the Google patch, and are glad that we have been able to include it in the InnoDB Plugin in a way that maximizes its portability, while keeping things as simple as possible for users.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.innodb.com/wp/2009/03/software-is-hard-sometimes/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

