<?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>beer planet &#187; Performance</title> <atom:link href="http://beerpla.net/tag/performance/feed/" rel="self" type="application/rss+xml" /><link>http://beerpla.net</link> <description>where things have nothing to do with beer - tutorials, tips, how-tos, thoughts, hacks, and other techy nonsense</description> <lastBuildDate>Thu, 17 May 2012 22:50:53 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <atom:link rel='hub' href='http://beerpla.net/?pushpress=hub'/> <item><title>Follow-up To Loading CSS And JS Conditionally</title><link>http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/</link> <comments>http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/#comments</comments> <pubDate>Fri, 15 Jan 2010 20:07:40 +0000</pubDate> <dc:creator>Artem Russakovskii</dc:creator> <category><![CDATA[Programming]]></category> <category><![CDATA[Wordpress]]></category> <category><![CDATA[action]]></category> <category><![CDATA[admin_print_scripts]]></category> <category><![CDATA[admin_print_styles]]></category> <category><![CDATA[conditional]]></category> <category><![CDATA[CSS]]></category> <category><![CDATA[enqueue]]></category> <category><![CDATA[hook]]></category> <category><![CDATA[JavaScript]]></category> <category><![CDATA[js]]></category> <category><![CDATA[load]]></category> <category><![CDATA[ob_flush]]></category> <category><![CDATA[ob_start]]></category> <category><![CDATA[optimization]]></category> <category><![CDATA[output buffer]]></category> <category><![CDATA[Performance]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[script]]></category> <category><![CDATA[style]]></category> <category><![CDATA[time]]></category> <category><![CDATA[wp_enqueue_script]]></category> <category><![CDATA[wp_enqueue_style]]></category> <category><![CDATA[wp_print_scripts]]></category> <category><![CDATA[wp_print_styles]]></category> <guid
isPermaLink="false">http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/</guid> <description><![CDATA[<p>First of all, I&#039;d like to thank everyone who read and gave their 2 cents about the <a
href="http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/">[Wordpress Plugin Development] How To Include CSS and JavaScript Conditionally And Only When Needed By The Posts</a> post. The article was well received and will hopefully spark some optimizations around loading styles and scripts.</p><p>Here are some discussions and mentions around the web:</p><ul><li><a
href="http://weblogtoolscollection.com/archives/2010/01/15/how-to-include-css-and-javascript-conditionally/" rel="nofollow">an article</a> on Weblog Tools Collection</li><li><a
href="http://www.wptavern.com/forum/resources/1213-including-javascript-css-conditionally.html" rel="nofollow">a forum post</a> on WP Tavern</li><li><a
href="http://topsy.com/tb/ping.fm/DIM0S" rel="nofollow">twitter</a> retweets</li></ul><p>Sure, there are drawbacks to this method and it does require some more processing on the backend and it&#039;s not for everyone, which is why we should always strive for an even better solution.</p><p>I stand by my point of view that, for instance, my dedicated ...<div
class=clear></div> <a
href="http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/" class="read_more"><div
class=excerpt-end>Read the rest of this article &#187;</div></a></p>]]></description> <content:encoded><![CDATA[<p>First of all, I&#039;d like to thank everyone who read and gave their 2 cents about the <a
href="http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/">[Wordpress Plugin Development] How To Include CSS and JavaScript Conditionally And Only When Needed By The Posts</a> post. The article was well received and will hopefully spark some optimizations around loading styles and scripts.</p><p>Here are some discussions and mentions around the web:</p><ul><li><a
href="http://weblogtoolscollection.com/archives/2010/01/15/how-to-include-css-and-javascript-conditionally/" rel="nofollow">an article</a> on Weblog Tools Collection</li><li><a
href="http://www.wptavern.com/forum/resources/1213-including-javascript-css-conditionally.html" rel="nofollow">a forum post</a> on WP Tavern</li><li><a
href="http://topsy.com/tb/ping.fm/DIM0S" rel="nofollow">twitter</a> retweets</li></ul><p>Sure, there are drawbacks to this method and it does require some more processing on the backend and it&#039;s not for everyone, which is why we should always strive for an even better solution.</p><p>I stand by my point of view that, for instance, my dedicated gallery shouldn&#039;t load for people who will never even go see my photos.</p><p>I think an ideal solution would be for WP core developers, who had a lot of experience designing WordPress&#039; internals and who know what can work and what can&#039;t, perhaps <a
href="http://www.ma.tt" rel="nofollow">Matt</a> included, to get together and think about a better solution really hard.</p><p>Conditional loading similar to the one discussed here is already possible in the admin area, which creates dynamic hooks by appending page ids to <strong><em>&#039;admin_print_styles&#039;</em></strong> and <strong><em>&#039;admin_print_scripts&#039;</em></strong>. It is, however, still not good enough to be used more generically because those hooks rely on the page you are on, rather than the content of that page.</p><p>Another possibility is using a PHP technique called <strong><em>output buffering</em></strong> (<a
href="http://php.net/manual/en/function.ob-start.php" rel="nofollow"><strong><em>ob_start()</em></strong></a>, <a
href="http://www.php.net/manual/en/function.ob-flush.php" rel="nofollow"><strong><em>ob_flush()</em></strong></a>, etc) that grants second chances to data that had already been echoed. It intercepts all echo and print calls and redirects them into a memory buffer, so instead of printing data to the page right away, you can now modify the header even if it had already been processed. It&#039;s like giving it a second chance.</p><p>Would it work for WordPress? I am not sure but I sure could use your feedback, devs.</p><p><div
class="note"><div
class="notetip"><strong>Update: </strong>Scribu, a WordPress master, <a
href="http://scribu.net/wordpress/optimal-script-loading.html" rel="nofollow">came up with the approach</a> that would at least handle loading JS, as it would put it in the footer, which can be done after the posts have been parsed.</p><p>His approach doesn&#039;t handle CSS which is why I decided to seek another solution but it doesn&#039;t require an extra pass through the posts and it benefits from using the shortcode API instead of stripos() or some hacky regex you&#039;d need to come up with.</p><p>It&#039;s a great compromise for developers who do not want to take the approach I outlined in the article linked at the top of this page.</div></div></p><div
class="shr-bookmarks shr-bookmarks-expand"><ul
class="socials"><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=Follow-up+To+Loading+CSS+And+JS+Conditionally&amp;link=http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/&amp;notes=First%20of%20all%2C%20I%27d%20like%20to%20thank%20everyone%20who%20read%20and%20gave%20their%202%20cents%20about%20the%20%5BWordpress%20Plugin%20Development%5D%20How%20To%20Include%20CSS%20and%20JavaScript%20Conditionally%20And%20Only%20When%20Needed%20By%20The%20Posts%20post.%20The%20article%20was%20well%20received%20and%20will%20hopefully%20spark%20some%20optimizations%20around%20loading%20styles%20an&amp;short_link=http://bit.ly/76og1l&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%24%7Btitle%7D+-+%24%7Bshort_link%7D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=Follow-up+To+Loading+CSS+And+JS+Conditionally&amp;link=http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/&amp;notes=First%20of%20all%2C%20I%27d%20like%20to%20thank%20everyone%20who%20read%20and%20gave%20their%202%20cents%20about%20the%20%5BWordpress%20Plugin%20Development%5D%20How%20To%20Include%20CSS%20and%20JavaScript%20Conditionally%20And%20Only%20When%20Needed%20By%20The%20Posts%20post.%20The%20article%20was%20well%20received%20and%20will%20hopefully%20spark%20some%20optimizations%20around%20loading%20styles%20an&amp;short_link=http://bit.ly/76og1l&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-googlebuzz"> <a
href="http://www.shareaholic.com/api/share/?title=Follow-up+To+Loading+CSS+And+JS+Conditionally&amp;link=http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/&amp;notes=First%20of%20all%2C%20I%27d%20like%20to%20thank%20everyone%20who%20read%20and%20gave%20their%202%20cents%20about%20the%20%5BWordpress%20Plugin%20Development%5D%20How%20To%20Include%20CSS%20and%20JavaScript%20Conditionally%20And%20Only%20When%20Needed%20By%20The%20Posts%20post.%20The%20article%20was%20well%20received%20and%20will%20hopefully%20spark%20some%20optimizations%20around%20loading%20styles%20an&amp;short_link=http://bit.ly/76og1l&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=257&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a></li><li
class="shr-reddit"> <a
href="http://www.shareaholic.com/api/share/?title=Follow-up+To+Loading+CSS+And+JS+Conditionally&amp;link=http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/&amp;notes=First%20of%20all%2C%20I%27d%20like%20to%20thank%20everyone%20who%20read%20and%20gave%20their%202%20cents%20about%20the%20%5BWordpress%20Plugin%20Development%5D%20How%20To%20Include%20CSS%20and%20JavaScript%20Conditionally%20And%20Only%20When%20Needed%20By%20The%20Posts%20post.%20The%20article%20was%20well%20received%20and%20will%20hopefully%20spark%20some%20optimizations%20around%20loading%20styles%20an&amp;short_link=http://bit.ly/76og1l&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a></li><li
class="shr-hackernews"> <a
href="http://www.shareaholic.com/api/share/?title=Follow-up+To+Loading+CSS+And+JS+Conditionally&amp;link=http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/&amp;notes=First%20of%20all%2C%20I%27d%20like%20to%20thank%20everyone%20who%20read%20and%20gave%20their%202%20cents%20about%20the%20%5BWordpress%20Plugin%20Development%5D%20How%20To%20Include%20CSS%20and%20JavaScript%20Conditionally%20And%20Only%20When%20Needed%20By%20The%20Posts%20post.%20The%20article%20was%20well%20received%20and%20will%20hopefully%20spark%20some%20optimizations%20around%20loading%20styles%20an&amp;short_link=http://bit.ly/76og1l&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=202&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Submit this to Hacker News">Submit this to Hacker News</a></li><li
class="shr-delicious"> <a
href="http://www.shareaholic.com/api/share/?title=Follow-up+To+Loading+CSS+And+JS+Conditionally&amp;link=http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/&amp;notes=First%20of%20all%2C%20I%27d%20like%20to%20thank%20everyone%20who%20read%20and%20gave%20their%202%20cents%20about%20the%20%5BWordpress%20Plugin%20Development%5D%20How%20To%20Include%20CSS%20and%20JavaScript%20Conditionally%20And%20Only%20When%20Needed%20By%20The%20Posts%20post.%20The%20article%20was%20well%20received%20and%20will%20hopefully%20spark%20some%20optimizations%20around%20loading%20styles%20an&amp;short_link=http://bit.ly/76og1l&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=2&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a></li><li
class="shr-stumbleupon"> <a
href="http://www.shareaholic.com/api/share/?title=Follow-up+To+Loading+CSS+And+JS+Conditionally&amp;link=http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/&amp;notes=First%20of%20all%2C%20I%27d%20like%20to%20thank%20everyone%20who%20read%20and%20gave%20their%202%20cents%20about%20the%20%5BWordpress%20Plugin%20Development%5D%20How%20To%20Include%20CSS%20and%20JavaScript%20Conditionally%20And%20Only%20When%20Needed%20By%20The%20Posts%20post.%20The%20article%20was%20well%20received%20and%20will%20hopefully%20spark%20some%20optimizations%20around%20loading%20styles%20an&amp;short_link=http://bit.ly/76og1l&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=Follow-up%20To%20Loading%20CSS%20And%20JS%20Conditionally&amp;link=http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/&amp;notes=First%20of%20all%2C%20I%27d%20like%20to%20thank%20everyone%20who%20read%20and%20gave%20their%202%20cents%20about%20the%20%5BWordpress%20Plugin%20Development%5D%20How%20To%20Include%20CSS%20and%20JavaScript%20Conditionally%20And%20Only%20When%20Needed%20By%20The%20Posts%20post.%20The%20article%20was%20well%20received%20and%20will%20hopefully%20spark%20some%20optimizations%20around%20loading%20styles%20an&amp;short_link=http://bit.ly/76og1l&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li></ul><div
style="clear: both;"></div></div> Similar Posts:<ul><li><a
href="http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/" rel="bookmark" title="January 13, 2010">[WordPress Plugin Development] How To Include CSS and JavaScript Conditionally And Only When Needed By The Posts</a></li><li><a
href="http://beerpla.net/2009/02/17/swapping-column-values-in-mysql/" rel="bookmark" title="February 17, 2009">Swapping Column Values in MySQL</a></li><li><a
href="http://beerpla.net/2010/11/06/how-to-dynamically-increase-memory-limits-when-interfacing-with-wordpress-using-xml-rpc-windows-live-writer-etc/" rel="bookmark" title="November 6, 2010">How To Dynamically Increase Memory Limits When Interfacing With WordPress Using XML-RPC (Windows Live Writer, Etc)</a></li><li><a
href="http://beerpla.net/2010/01/31/how-to-remove-inline-hardcoded-recent-comments-sidebar-widget-style-from-your-wordpress-theme/" rel="bookmark" title="January 31, 2010">How To Remove Inline Hardcoded Recent Comments Sidebar Widget Style From Your WordPress Theme</a></li><li><a
href="http://beerpla.net/2012/04/13/how-to-fix-incomplete-wordpress-wxr-exports/" rel="bookmark" title="April 13, 2012">How To Fix Incomplete WordPress (WXR) Exports</a></li></ul><p><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbeerpla.net%2F2010%2F01%2F15%2Ffollow-up-to-loading-css-and-js-conditionally%2F&amp;title=Follow-up%20To%20Loading%20CSS%20And%20JS%20Conditionally" id="wpa2a_2"><img
src="http://beerpla.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/feed/</wfw:commentRss> <slash:comments>5</slash:comments> </item> <item><title>[WordPress Plugin Development] How To Include CSS and JavaScript Conditionally And Only When Needed By The Posts</title><link>http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/</link> <comments>http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/#comments</comments> <pubDate>Wed, 13 Jan 2010 17:15:00 +0000</pubDate> <dc:creator>Artem Russakovskii</dc:creator> <category><![CDATA[Tips]]></category> <category><![CDATA[Tutorials]]></category> <category><![CDATA[Wordpress]]></category> <category><![CDATA[action]]></category> <category><![CDATA[admin_print_scripts]]></category> <category><![CDATA[admin_print_styles]]></category> <category><![CDATA[conditional]]></category> <category><![CDATA[CSS]]></category> <category><![CDATA[enqueue]]></category> <category><![CDATA[hook]]></category> <category><![CDATA[JavaScript]]></category> <category><![CDATA[js]]></category> <category><![CDATA[load]]></category> <category><![CDATA[optimization]]></category> <category><![CDATA[Performance]]></category> <category><![CDATA[script]]></category> <category><![CDATA[style]]></category> <category><![CDATA[time]]></category> <category><![CDATA[wp_enqueue_script]]></category> <category><![CDATA[wp_enqueue_style]]></category> <category><![CDATA[wp_print_scripts]]></category> <category><![CDATA[wp_print_styles]]></category> <guid
isPermaLink="false">http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/</guid> <description><![CDATA[<h2>Introduction</h2><p><img
style="margin: 0px 10px 10px 0px; display: inline" title="wordpress logo" alt="wordpress logo" align="left" src="http://beerpla.net/wp-content/uploads/WordpressPluginWritersTakeNoteHowToInclu_863C/image_3.png" width="150" height="150" /> In this tutorial, I am going to introduce a WordPress technique that I believe was unpublished until I <a
href="http://wordpress.org/support/topic/350167" rel="nofollow">raised the question</a> a few days ago on the WordPress forums.</p><p>In short, the problem I was trying to solve was <strong><em>plugins unnecessarily loading their JavaScript and CSS on *every* page of the blog, even when doing so would achieve absolutely nothing and the plugin wouldn&#039;t do any work</em></strong>.</p><p><div
class="note"><div
class="notetip"><strong>Update #1:</strong> I have posted a <a
href="http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/">follow-up</a> in response to some comments received around the web.</div></div></p><p><div
class="note"><div
class="notetip"><strong>Update #2:</strong> There is a solution that can be considered a compromise as it works well for loading JavaScript but doesn&#039;t handle CSS.</div></div></p><p>I briefly mentioned this approach here but but Scribu decided to expand ...<div
class=clear></div> <a
href="http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/" class="read_more"><div
class=excerpt-end>Read the rest of this article &#187;</div></a></p>]]></description> <content:encoded><![CDATA[<h2>Introduction</h2><p><img
style="margin: 0px 10px 10px 0px; display: inline" title="wordpress logo" alt="wordpress logo" align="left" src="http://beerpla.net/wp-content/uploads/WordpressPluginWritersTakeNoteHowToInclu_863C/image_3.png" width="150" height="150" /> In this tutorial, I am going to introduce a WordPress technique that I believe was unpublished until I <a
href="http://wordpress.org/support/topic/350167" rel="nofollow">raised the question</a> a few days ago on the WordPress forums.</p><p>In short, the problem I was trying to solve was <strong><em>plugins unnecessarily loading their JavaScript and CSS on *every* page of the blog, even when doing so would achieve absolutely nothing and the plugin wouldn&#039;t do any work</em></strong>.</p><p><div
class="note"><div
class="notetip"><strong>Update #1:</strong> I have posted a <a
href="http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/">follow-up</a> in response to some comments received around the web.</div></div></p><p><div
class="note"><div
class="notetip"><strong>Update #2:</strong> There is a solution that can be considered a compromise as it works well for loading JavaScript but doesn&#039;t handle CSS.</p><p>I briefly mentioned this approach here but but Scribu decided to expand on it by providing a nice Jedi-themed tutorial. It is available <a
href="http://scribu.net/wordpress/optimal-script-loading.html" rel="nofollow">here</a>.</div></div></p><p>Let me explain using this example:</p><ul><li>a code formatter plugin only does something useful when it sees a [code] shortcode in any post on the page.</li><li>most of your posts do not contain the [code] shortcode as you don't include code snippets that often or you only started using this particular plugin recently.</li><li>the plugin, however, loads the CSS and JS (which are most likely <a
href="http://qbnz.com/highlighter/" rel="nofollow">GeSHi</a> and take up loads of space) on every page.</li><li>these CSS and JS do absolutely nothing on most page loads.</li><li>bandwidth is wasted, extra DNS and HTTP requests are processed, the browser is slowed down, and for what? For no good reason, other than the plugin author didn't know how to achieve this conditional loading.</li></ul><p>If you think about it, there are many plugins that only do something once in a blue moon. Table of contents, text manipulators, galleries, sliders, etc, etc. If only they loaded their frontend code strictly when necessary, most page loads would suddenly become much lighter.</p><p>So what can we do to solve this? Let's look at a few techniques.</p><h2>Loading CSS And JS In Place?</h2><p>Here's one, albeit pretty bad, solution - only print the CSS and JS includes if and when you determine somewhere in the middle of loading the posts that the scripts and styles are indeed needed, then set a flag to avoid printing them again. In our example, that would be when the plugin detects the [code] shortcode.</p><p>This, however, is a mediocre solution because, while it's not a bad idea to load Javascript in the footer, <a
href="http://developer.yahoo.com/performance/rules.html" rel="nofollow">CSS should be loaded in the header</a>, otherwise the page might look unformatted until the CSS is reached.</p><p>Additionally, it's not the cleanest and most robust solution because you shouldn't be writing &lt;script&gt; and &lt;style&gt; tags manually but rather using <a
href="http://codex.wordpress.org/Function_Reference/wp_enqueue_style" rel="nofollow">wp_enqueue_style()</a> and <a
href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script" rel="nofollow">wp_enqueue_script()</a> functions.</p><h2>What's This About wp_enqueue_FOO?</h2><p>Now, you might say: &quot;What's this about <strong><em>wp_enqueue_style()</em></strong>, <strong><em>wp_enqueue_script()</em></strong>, and then hooking into <strong><em>'wp_print_scripts'</em></strong>, <strong><em>'wp_print_styles'</em></strong>, <strong><em>'admin_print_scripts'</em></strong>, and <strong><em>'admin_print_styles'</em></strong> hooks&quot;? You know about these, right? Right??</p><p>Allow me to explain this, in my opinion, greatest and most underused WordPress paradigm in a short refresher:</p><p><div
class="note"><div
class="noteclassic">WordPress has a great system of queuing up the scripts and styles your script will need to use and printing them all in one go, rather than hooking into wp_head and printing &lt;style&gt; and &lt;script&gt; tags manually.</p><p>This queuing system achieves 2 main goals:</p><ul><li>the <strong><em>same scripts are not loaded multiple times</em></strong>, such as <a
href="http://jquery.com/" rel="nofollow">jQuery</a>, <a
href="http://script.aculo.us/" rel="nofollow">scriptaculous</a>, or any other custom script or style your plugins may share between each other or even other plugins.</li><li>it introduces support for establishing <strong><em>dependencies</em></strong>. You can specify that your script or style depends on another script or style, and WordPress will take care of loading them in the right order. Guaranteed.</li><li>oh what the hell, here's a 3rd one: <strong><em>elegance</em></strong>.</li></ul><p>Here is the way this usually works:</p><ul><li>in the beginning of your plugin you attach to <strong><em>wp_print_scripts</em></strong> and/or <strong><em>wp_print_styles</em></strong> hooks. For example:</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
</pre></td><td
class="code"><pre>add_action( 'wp_print_scripts', 'enqueue_my_scripts' );
add_action( 'wp_print_styles', 'enqueue_my_styles' );</pre></td></tr></table></div><p>What this will do is call the functions in the 2nd parameter when it's time to execute any functions associated with the hooks in the 1st parameter. It is the main principle behind the WordPress plugin architecture.</li><li>looking at the script example, in the <strong><em>enqueue_my_scripts()</em></strong> function, you can do something like:<div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
</pre></td><td
class="code"><pre>wp_enqueue_script( 'my_awesome_script', '/script.js', array( 'jquery' ));</pre></td></tr></table></div><p>which would queue up your script to be printed later but only after jQuery.</p><p>If you or some other plugin calls <strong><em>wp_enqueue_script()</em></strong> with the same first parameter (unique handle), it will just be ignored, rather than printed to the page twice.</li><li>styles are exactly the same, except you use <strong><em>wp_enqueue_style()</em></strong></li></ul><p>There is a variation of this functionality for the admin styles and scripts - all you have to do is change the hooks to <strong><em>admin_print_styles</em></strong> and <strong><em>admin_print_scripts</em></strong>. Ozh made a nice post on this topic <a
href="http://planetozh.com/blog/2008/04/how-to-load-javascript-with-your-wordpress-plugin/" rel="nofollow">here</a> - check it out.</p><p></div></div></p><h2>Enqueuing Alone Is Not Enough</h2><p>Enqueuing is great for loading your JS and CSS but using it alone doesn't achieve the conditional behavior that we are looking for here.</p><p>This is a classic case of Chicken or the Egg, because WordPress makes only one pass through all of the content.</p><p>You see, since the header needs to be printed before the content, <strong><em>wp_print_scripts</em></strong> and <strong><em>wp_print_styles</em></strong> hooks are triggered before you even get to the posts. If you enqueue a script or style from within the 'the_content' hook, for example, the queued up scripts and styles will never get printed. It's too late to print them then anyway, as you're already in the middle of printing the posts.</p><h2>The Solution</h2><p>What we need to do is take a step back, before even printing the header, and then peek ahead.</p><p>Sure, this adds an extra pass over some data, but since no filters are applied during this process and if you avoid regular expressions (using stripos(), for example), this extra pass should be quite negligible.</p><p><div
class="note"><div
class="notewarning">A word of warning though: I'd rather see false positives (enqueuing when it's not needed) than false negatives (miss enqueuing when it's needed), so please do your matching wisely and test well.</div></div></p><p>The upside, however, can be potentially very substantial.</p><p>Credit goes to <a
href="http://twitter.com/white_shadow" rel="nofollow">@white_shadow</a> for the idea.</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td
class="code"><pre>add_filter('the_posts', 'conditionally_add_scripts_and_styles'); // the_posts gets triggered before wp_head
function conditionally_add_scripts_and_styles($posts){
	if (empty($posts)) return $posts;
&nbsp;
	$shortcode_found = false; // use this flag to see if styles and scripts need to be enqueued
	foreach ($posts as $post) {
		if (stripos($post-&gt;post_content, '[code]') !== false) {
			$shortcode_found = true; // bingo!
			break;
		}
	}
&nbsp;
	if ($shortcode_found) {
		// enqueue here
		wp_enqueue_style('my-style', '/style.css');
		wp_enqueue_script('my-script', '/script.js');
	}
&nbsp;
	return $posts;
}</pre></td></tr></table></div><p>This simple function fires before the header gets printed, as it's attached to the 'the_posts' hook. However, this time it has full access to the posts' content.</p><p>I have tested this method and it works really well - if you have heavy scripts in your plugin, please do us, users, a favor and incorporate this logic into it.</p><h2>Conclusion</h2><p>In this tutorial, you have seen a method of loading scripts and styles for you plugin conditionally. This technique allows for less bloated pages and faster page loads.</p><p>Plugin developers, what is your take on this solution? Do you use another method? Please share in the comments.</p><div
class='post_blob_1'>Our <a
href="http://www.test-king.com/exams/HP0-D07.htm">HP0-D07</a> study guides will help you to pass your <a
href="http://www.test-king.com/exams/642-436.htm">642-436</a> and <a
href="http://www.test-king.com/exams/640-816.htm">640-816</a> exam on first attempt guaranteed.</div><div
class="shr-bookmarks shr-bookmarks-expand"><ul
class="socials"><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=%5BWordpress+Plugin+Development%5D+How+To+Include+CSS+and+JavaScript+Conditionally+And+Only+When+Needed+By+The+Posts&amp;link=http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/&amp;notes=Introduction%0D%0A%20In%20this%20tutorial%2C%20I%20am%20going%20to%20introduce%20a%20Wordpress%20technique%20that%20I%20believe%20was%20unpublished%20until%20I%20raised%20the%20question%20a%20few%20days%20ago%20on%20the%20Wordpress%20forums.%0D%0AIn%20short%2C%20the%20problem%20I%20was%20trying%20to%20solve%20was%20plugins%20unnecessarily%20loading%20their%20JavaScript%20and%20CSS%20on%20%2Aevery%2A%20page%20of&amp;short_link=http://bit.ly/aH8tGB&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%24%7Btitle%7D+-+%24%7Bshort_link%7D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=%5BWordpress+Plugin+Development%5D+How+To+Include+CSS+and+JavaScript+Conditionally+And+Only+When+Needed+By+The+Posts&amp;link=http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/&amp;notes=Introduction%0D%0A%20In%20this%20tutorial%2C%20I%20am%20going%20to%20introduce%20a%20Wordpress%20technique%20that%20I%20believe%20was%20unpublished%20until%20I%20raised%20the%20question%20a%20few%20days%20ago%20on%20the%20Wordpress%20forums.%0D%0AIn%20short%2C%20the%20problem%20I%20was%20trying%20to%20solve%20was%20plugins%20unnecessarily%20loading%20their%20JavaScript%20and%20CSS%20on%20%2Aevery%2A%20page%20of&amp;short_link=http://bit.ly/aH8tGB&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-googlebuzz"> <a
href="http://www.shareaholic.com/api/share/?title=%5BWordpress+Plugin+Development%5D+How+To+Include+CSS+and+JavaScript+Conditionally+And+Only+When+Needed+By+The+Posts&amp;link=http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/&amp;notes=Introduction%0D%0A%20In%20this%20tutorial%2C%20I%20am%20going%20to%20introduce%20a%20Wordpress%20technique%20that%20I%20believe%20was%20unpublished%20until%20I%20raised%20the%20question%20a%20few%20days%20ago%20on%20the%20Wordpress%20forums.%0D%0AIn%20short%2C%20the%20problem%20I%20was%20trying%20to%20solve%20was%20plugins%20unnecessarily%20loading%20their%20JavaScript%20and%20CSS%20on%20%2Aevery%2A%20page%20of&amp;short_link=http://bit.ly/aH8tGB&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=257&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a></li><li
class="shr-reddit"> <a
href="http://www.shareaholic.com/api/share/?title=%5BWordpress+Plugin+Development%5D+How+To+Include+CSS+and+JavaScript+Conditionally+And+Only+When+Needed+By+The+Posts&amp;link=http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/&amp;notes=Introduction%0D%0A%20In%20this%20tutorial%2C%20I%20am%20going%20to%20introduce%20a%20Wordpress%20technique%20that%20I%20believe%20was%20unpublished%20until%20I%20raised%20the%20question%20a%20few%20days%20ago%20on%20the%20Wordpress%20forums.%0D%0AIn%20short%2C%20the%20problem%20I%20was%20trying%20to%20solve%20was%20plugins%20unnecessarily%20loading%20their%20JavaScript%20and%20CSS%20on%20%2Aevery%2A%20page%20of&amp;short_link=http://bit.ly/aH8tGB&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a></li><li
class="shr-hackernews"> <a
href="http://www.shareaholic.com/api/share/?title=%5BWordpress+Plugin+Development%5D+How+To+Include+CSS+and+JavaScript+Conditionally+And+Only+When+Needed+By+The+Posts&amp;link=http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/&amp;notes=Introduction%0D%0A%20In%20this%20tutorial%2C%20I%20am%20going%20to%20introduce%20a%20Wordpress%20technique%20that%20I%20believe%20was%20unpublished%20until%20I%20raised%20the%20question%20a%20few%20days%20ago%20on%20the%20Wordpress%20forums.%0D%0AIn%20short%2C%20the%20problem%20I%20was%20trying%20to%20solve%20was%20plugins%20unnecessarily%20loading%20their%20JavaScript%20and%20CSS%20on%20%2Aevery%2A%20page%20of&amp;short_link=http://bit.ly/aH8tGB&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=202&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Submit this to Hacker News">Submit this to Hacker News</a></li><li
class="shr-delicious"> <a
href="http://www.shareaholic.com/api/share/?title=%5BWordpress+Plugin+Development%5D+How+To+Include+CSS+and+JavaScript+Conditionally+And+Only+When+Needed+By+The+Posts&amp;link=http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/&amp;notes=Introduction%0D%0A%20In%20this%20tutorial%2C%20I%20am%20going%20to%20introduce%20a%20Wordpress%20technique%20that%20I%20believe%20was%20unpublished%20until%20I%20raised%20the%20question%20a%20few%20days%20ago%20on%20the%20Wordpress%20forums.%0D%0AIn%20short%2C%20the%20problem%20I%20was%20trying%20to%20solve%20was%20plugins%20unnecessarily%20loading%20their%20JavaScript%20and%20CSS%20on%20%2Aevery%2A%20page%20of&amp;short_link=http://bit.ly/aH8tGB&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=2&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a></li><li
class="shr-stumbleupon"> <a
href="http://www.shareaholic.com/api/share/?title=%5BWordpress+Plugin+Development%5D+How+To+Include+CSS+and+JavaScript+Conditionally+And+Only+When+Needed+By+The+Posts&amp;link=http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/&amp;notes=Introduction%0D%0A%20In%20this%20tutorial%2C%20I%20am%20going%20to%20introduce%20a%20Wordpress%20technique%20that%20I%20believe%20was%20unpublished%20until%20I%20raised%20the%20question%20a%20few%20days%20ago%20on%20the%20Wordpress%20forums.%0D%0AIn%20short%2C%20the%20problem%20I%20was%20trying%20to%20solve%20was%20plugins%20unnecessarily%20loading%20their%20JavaScript%20and%20CSS%20on%20%2Aevery%2A%20page%20of&amp;short_link=http://bit.ly/aH8tGB&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=%5BWordpress%20Plugin%20Development%5D%20How%20To%20Include%20CSS%20and%20JavaScript%20Conditionally%20And%20Only%20When%20Needed%20By%20The%20Posts&amp;link=http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/&amp;notes=Introduction%0D%0A%20In%20this%20tutorial%2C%20I%20am%20going%20to%20introduce%20a%20Wordpress%20technique%20that%20I%20believe%20was%20unpublished%20until%20I%20raised%20the%20question%20a%20few%20days%20ago%20on%20the%20Wordpress%20forums.%0D%0AIn%20short%2C%20the%20problem%20I%20was%20trying%20to%20solve%20was%20plugins%20unnecessarily%20loading%20their%20JavaScript%20and%20CSS%20on%20%2Aevery%2A%20page%20of&amp;short_link=http://bit.ly/aH8tGB&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li></ul><div
style="clear: both;"></div></div> Similar Posts:<ul><li><a
href="http://beerpla.net/2010/01/15/follow-up-to-loading-css-and-js-conditionally/" rel="bookmark" title="January 15, 2010">Follow-up To Loading CSS And JS Conditionally</a></li><li><a
href="http://beerpla.net/2010/01/31/how-to-remove-inline-hardcoded-recent-comments-sidebar-widget-style-from-your-wordpress-theme/" rel="bookmark" title="January 31, 2010">How To Remove Inline Hardcoded Recent Comments Sidebar Widget Style From Your WordPress Theme</a></li><li><a
href="http://beerpla.net/2010/11/06/how-to-dynamically-increase-memory-limits-when-interfacing-with-wordpress-using-xml-rpc-windows-live-writer-etc/" rel="bookmark" title="November 6, 2010">How To Dynamically Increase Memory Limits When Interfacing With WordPress Using XML-RPC (Windows Live Writer, Etc)</a></li><li><a
href="http://beerpla.net/2010/03/21/how-to-diagnose-and-fix-incorrect-post-comment-counts-in-wordpress/" rel="bookmark" title="March 21, 2010">How To Diagnose And Fix Incorrect Post Comment Counts In WordPress</a></li><li><a
href="http://beerpla.net/2010/02/20/how-to-view-a-specific-svn-revision-in-your-browser/" rel="bookmark" title="February 20, 2010">How To View A Specific SVN Revision In Your Browser</a></li></ul><p><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbeerpla.net%2F2010%2F01%2F13%2Fwordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts%2F&amp;title=%5BWordPress%20Plugin%20Development%5D%20How%20To%20Include%20CSS%20and%20JavaScript%20Conditionally%20And%20Only%20When%20Needed%20By%20The%20Posts" id="wpa2a_4"><img
src="http://beerpla.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/feed/</wfw:commentRss> <slash:comments>58</slash:comments> </item> <item><title>Skype Extension For Firefox Is A Piece Of Crap &#8211; Leaks Memory, Hangs Firefox, Clubs Baby Seals</title><link>http://beerpla.net/2009/11/11/skype-extension-for-firefox-is-a-piece-of-crap-leaks-memory-hangs-firefox-clubs-baby-seals/</link> <comments>http://beerpla.net/2009/11/11/skype-extension-for-firefox-is-a-piece-of-crap-leaks-memory-hangs-firefox-clubs-baby-seals/#comments</comments> <pubDate>Thu, 12 Nov 2009 04:31:06 +0000</pubDate> <dc:creator>Artem Russakovskii</dc:creator> <category><![CDATA[Firefox]]></category> <category><![CDATA[Performance]]></category> <category><![CDATA[Tips]]></category> <category><![CDATA[100% cpu]]></category> <category><![CDATA[add-on]]></category> <category><![CDATA[addon]]></category> <category><![CDATA[bug]]></category> <category><![CDATA[code]]></category> <category><![CDATA[cpu]]></category> <category><![CDATA[extension]]></category> <category><![CDATA[leak]]></category> <category><![CDATA[memory]]></category> <category><![CDATA[memory leak]]></category> <category><![CDATA[mozilla]]></category> <category><![CDATA[process explorer]]></category> <category><![CDATA[ram]]></category> <category><![CDATA[skype]]></category> <guid
isPermaLink="false">http://beerpla.net/2009/11/11/skype-extension-for-firefox-is-a-piece-of-crap-leaks-memory-hangs-firefox-clubs-baby-seals/</guid> <description><![CDATA[<p><img
style="margin: 0px 10px 10px 0px; display: inline" title="image" alt="image" align="left" src="http://beerpla.net/wp-content/uploads/SkypeExtensionForFirefoxIsAPieceOfCrapHo_11789/image_thumb.png" width="150" height="115" /></p><h2>Introduction</h2><p>Dear Skype,</p><p>you are great. You have the convenience of a nearby, well, convenience store and the UI that is acceptable to even an Apple fanboy (I&#039;m not one, I&#039;m just saying).</p><p>Skype also has a Firefox extension which finds all pieces of text that resemble phone numbers on web pages you are visiting and converts them into clickable Skype buttons <img
style="display: inline; margin-left: 0px; margin-right: 0px" title="image" alt="image" src="http://beerpla.net/wp-content/uploads/SkypeExtensionForFirefoxIsAPieceOfCrapHo_11789/image_thumb_3.png" width="146" height="27" />. One click and you&#039;re dialing the number. The premise is great but the execution… When it comes to your Firefox extension, Skype &#8211; you suck. You really suck.</p><h2>The <strike>Problem</strike> Bullshit</h2><p>So what makes me say these mean things? Is it the fact that when simply searching Google for <a
href="http://www.google.com/search?q=skype+firefox" rel="nofollow">&#34;skype firefox&#34;</a>, one finds mostly blog posts ...<div
class=clear></div> <a
href="http://beerpla.net/2009/11/11/skype-extension-for-firefox-is-a-piece-of-crap-leaks-memory-hangs-firefox-clubs-baby-seals/" class="read_more"><div
class=excerpt-end>Read the rest of this article &#187;</div></a></p>]]></description> <content:encoded><![CDATA[<p><img
style="margin: 0px 10px 10px 0px; display: inline" title="image" alt="image" align="left" src="http://beerpla.net/wp-content/uploads/SkypeExtensionForFirefoxIsAPieceOfCrapHo_11789/image_thumb.png" width="150" height="115" /></p><h2>Introduction</h2><p>Dear Skype,</p><p>you are great. You have the convenience of a nearby, well, convenience store and the UI that is acceptable to even an Apple fanboy (I&#039;m not one, I&#039;m just saying).</p><p>Skype also has a Firefox extension which finds all pieces of text that resemble phone numbers on web pages you are visiting and converts them into clickable Skype buttons <img
style="display: inline; margin-left: 0px; margin-right: 0px" title="image" alt="image" src="http://beerpla.net/wp-content/uploads/SkypeExtensionForFirefoxIsAPieceOfCrapHo_11789/image_thumb_3.png" width="146" height="27" />. One click and you&#039;re dialing the number. The premise is great but the execution… When it comes to your Firefox extension, Skype &#8211; you suck. You really suck.</p><h2>The <strike>Problem</strike> Bullshit</h2><p>So what makes me say these mean things? Is it the fact that when simply searching Google for <a
href="http://www.google.com/search?q=skype+firefox" rel="nofollow">&quot;skype firefox&quot;</a>, one finds mostly blog posts and references to major fail? Or is it the fact that MozillaZine&#039;s <a
href="http://kb.mozillazine.org/Problematic_extensions" rel="nofollow">Problematic Extensions</a> page lists Skype as one of the buggiest?</p><p>Well, yes. Those are great, aren&#039;t they? However, what really prompted me to write this post is my own experience with this extension.</p><p>As I am getting into Android development nowadays, I read the Android dev guide quite a lot. Thus, it was no surprise that yesterday I was happily reading the page about <a
href="http://developer.android.com/references/android/docs/guide/topics/ui/ui-events.html" rel="nofollow">Handling UI Events</a>. What was a surprise, however, is that when I clicked over to the <a
href="http://developer.android.com/reference/android/view/View.html" rel="nofollow">View API reference page</a> (in case that page ever changes for documentation reasons, I also saved it <a
href="http://beerpla.net/for_www/skype_extension_for_firefox_sucks/references/android/view/View.html" rel="nofollow">here</a>), my Firefox went into a painful agony and exploded in a few minutes.</p><p><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="image" alt="image" src="http://beerpla.net/wp-content/uploads/SkypeExtensionForFirefoxIsAPieceOfCrapHo_11789/image_thumb_4.png" width="530" height="247" /></p><p>What the fudgemonkeys? Let&#039;s do this again and watch the <a
href="http://www.sysinternals.com/" rel="\">Process Explorer</a>.&#160;</p><p><a
href="http://beerpla.net/wp-content/uploads/SkypeExtensionForFirefoxIsAPieceOfCrapHo_11789/image_5.png" class="lightview" rel="gallery['1220']" title="image"><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="image" alt="image" src="http://beerpla.net/wp-content/uploads/SkypeExtensionForFirefoxIsAPieceOfCrapHo_11789/image_thumb_5.png" width="700" height="82" /></a></p><p>This is what we call a memory leak &#8211; a prime example at that. In the screenshot above, the CPU usage spikes to 100% (shown as 50% because it&#039;s a dual core CPU), Firefox&#039;s memory usage jumps to around 2GB from 100MB, in 500MB/s increments. Finally, at 5GB total system memory consumption, either the OS kicks in or some major swapping starts to occur &#8211; I&#039;m not sure which of the two is happening exactly but you can see it when the green CPU marker gets overtaken by the red one.</p><p>As I have a <a
href="http://beerpla.net/2009/04/11/essential-firefox-extensions-plugins-add-ons-and-tips-a-comprehensive-guide-part-1-tips/">large number of extensions installed</a>, I was dreading the next step: disabling them until the culprit was found. Ugh…</p><p>Sure enough, after about half an hour of starting Firefox, observing the memory leak, killing, and restarting it, I narrowed it down to the Skype extension. Somebody at Skype needs to fess up. And here&#039;s the kicker &#8211; it only exposes the memory leak in the following configuration:</p><p><img
style="display: block; float: none; margin-left: auto; margin-right: auto" title="image" alt="image" src="http://beerpla.net/wp-content/uploads/SkypeExtensionForFirefoxIsAPieceOfCrapHo_11789/image_thumb_6.png" width="519" height="413" /></p><p>If you turn number highlighting on &#8211; it&#039;s fine. If you turn name highlighting off &#8211; it&#039;s fine. But if you turn number highlighting off but leave name highlighting on &#8211; major fail.</p></p><h2>The Conclusion</h2><p>So where am I going with all this? Here is the summary:</p><ul><li>somebody at Skype doesn&#039;t know how to program</li><li>this is the worst memory leak in a Firefox extension I&#039;ve ever seen</li><li>this extension is <a
href="http://kb.mozillazine.org/Problematic_extensions" rel="nofollow">notorious</a> for its crashes, bugs, and memory leaks</li><li>keep using this extension if you&#039;re<ul><li>a masochist</li><li>need to perform burn-in tests for your CPU or RAM</li></ul></li></ul><p>Have you had problems with the Skype extension? If so, share in the comments.</p><div
class="shr-bookmarks shr-bookmarks-expand"><ul
class="socials"><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=Skype+Extension+For+Firefox+Is+A+Piece+Of+Crap+-+Leaks+Memory%2C+Hangs+Firefox%2C+Clubs+Baby+Seals&amp;link=http://beerpla.net/2009/11/11/skype-extension-for-firefox-is-a-piece-of-crap-leaks-memory-hangs-firefox-clubs-baby-seals/&amp;notes=%20%20%20Introduction%20%20Dear%20Skype%2C%20%20you%20are%20great.%20You%20have%20the%20convenience%20of%20a%20nearby%2C%20well%2C%20convenience%20store%20and%20the%20UI%20that%20is%20acceptable%20to%20even%20an%20Apple%20fanboy%20%28I%27m%20not%20one%2C%20I%27m%20just%20saying%29.%20%20Skype%20also%20has%20a%20Firefox%20extension%20which%20finds%20all%20pieces%20of%20text%20that%20resemble%20phone%20numbers%20on%20web%20pages&amp;short_link=http://bit.ly/cmnZc6&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%24%7Btitle%7D+-+%24%7Bshort_link%7D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=Skype+Extension+For+Firefox+Is+A+Piece+Of+Crap+-+Leaks+Memory%2C+Hangs+Firefox%2C+Clubs+Baby+Seals&amp;link=http://beerpla.net/2009/11/11/skype-extension-for-firefox-is-a-piece-of-crap-leaks-memory-hangs-firefox-clubs-baby-seals/&amp;notes=%20%20%20Introduction%20%20Dear%20Skype%2C%20%20you%20are%20great.%20You%20have%20the%20convenience%20of%20a%20nearby%2C%20well%2C%20convenience%20store%20and%20the%20UI%20that%20is%20acceptable%20to%20even%20an%20Apple%20fanboy%20%28I%27m%20not%20one%2C%20I%27m%20just%20saying%29.%20%20Skype%20also%20has%20a%20Firefox%20extension%20which%20finds%20all%20pieces%20of%20text%20that%20resemble%20phone%20numbers%20on%20web%20pages&amp;short_link=http://bit.ly/cmnZc6&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-googlebuzz"> <a
href="http://www.shareaholic.com/api/share/?title=Skype+Extension+For+Firefox+Is+A+Piece+Of+Crap+-+Leaks+Memory%2C+Hangs+Firefox%2C+Clubs+Baby+Seals&amp;link=http://beerpla.net/2009/11/11/skype-extension-for-firefox-is-a-piece-of-crap-leaks-memory-hangs-firefox-clubs-baby-seals/&amp;notes=%20%20%20Introduction%20%20Dear%20Skype%2C%20%20you%20are%20great.%20You%20have%20the%20convenience%20of%20a%20nearby%2C%20well%2C%20convenience%20store%20and%20the%20UI%20that%20is%20acceptable%20to%20even%20an%20Apple%20fanboy%20%28I%27m%20not%20one%2C%20I%27m%20just%20saying%29.%20%20Skype%20also%20has%20a%20Firefox%20extension%20which%20finds%20all%20pieces%20of%20text%20that%20resemble%20phone%20numbers%20on%20web%20pages&amp;short_link=http://bit.ly/cmnZc6&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=257&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a></li><li
class="shr-reddit"> <a
href="http://www.shareaholic.com/api/share/?title=Skype+Extension+For+Firefox+Is+A+Piece+Of+Crap+-+Leaks+Memory%2C+Hangs+Firefox%2C+Clubs+Baby+Seals&amp;link=http://beerpla.net/2009/11/11/skype-extension-for-firefox-is-a-piece-of-crap-leaks-memory-hangs-firefox-clubs-baby-seals/&amp;notes=%20%20%20Introduction%20%20Dear%20Skype%2C%20%20you%20are%20great.%20You%20have%20the%20convenience%20of%20a%20nearby%2C%20well%2C%20convenience%20store%20and%20the%20UI%20that%20is%20acceptable%20to%20even%20an%20Apple%20fanboy%20%28I%27m%20not%20one%2C%20I%27m%20just%20saying%29.%20%20Skype%20also%20has%20a%20Firefox%20extension%20which%20finds%20all%20pieces%20of%20text%20that%20resemble%20phone%20numbers%20on%20web%20pages&amp;short_link=http://bit.ly/cmnZc6&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a></li><li
class="shr-hackernews"> <a
href="http://www.shareaholic.com/api/share/?title=Skype+Extension+For+Firefox+Is+A+Piece+Of+Crap+-+Leaks+Memory%2C+Hangs+Firefox%2C+Clubs+Baby+Seals&amp;link=http://beerpla.net/2009/11/11/skype-extension-for-firefox-is-a-piece-of-crap-leaks-memory-hangs-firefox-clubs-baby-seals/&amp;notes=%20%20%20Introduction%20%20Dear%20Skype%2C%20%20you%20are%20great.%20You%20have%20the%20convenience%20of%20a%20nearby%2C%20well%2C%20convenience%20store%20and%20the%20UI%20that%20is%20acceptable%20to%20even%20an%20Apple%20fanboy%20%28I%27m%20not%20one%2C%20I%27m%20just%20saying%29.%20%20Skype%20also%20has%20a%20Firefox%20extension%20which%20finds%20all%20pieces%20of%20text%20that%20resemble%20phone%20numbers%20on%20web%20pages&amp;short_link=http://bit.ly/cmnZc6&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=202&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Submit this to Hacker News">Submit this to Hacker News</a></li><li
class="shr-delicious"> <a
href="http://www.shareaholic.com/api/share/?title=Skype+Extension+For+Firefox+Is+A+Piece+Of+Crap+-+Leaks+Memory%2C+Hangs+Firefox%2C+Clubs+Baby+Seals&amp;link=http://beerpla.net/2009/11/11/skype-extension-for-firefox-is-a-piece-of-crap-leaks-memory-hangs-firefox-clubs-baby-seals/&amp;notes=%20%20%20Introduction%20%20Dear%20Skype%2C%20%20you%20are%20great.%20You%20have%20the%20convenience%20of%20a%20nearby%2C%20well%2C%20convenience%20store%20and%20the%20UI%20that%20is%20acceptable%20to%20even%20an%20Apple%20fanboy%20%28I%27m%20not%20one%2C%20I%27m%20just%20saying%29.%20%20Skype%20also%20has%20a%20Firefox%20extension%20which%20finds%20all%20pieces%20of%20text%20that%20resemble%20phone%20numbers%20on%20web%20pages&amp;short_link=http://bit.ly/cmnZc6&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=2&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a></li><li
class="shr-stumbleupon"> <a
href="http://www.shareaholic.com/api/share/?title=Skype+Extension+For+Firefox+Is+A+Piece+Of+Crap+-+Leaks+Memory%2C+Hangs+Firefox%2C+Clubs+Baby+Seals&amp;link=http://beerpla.net/2009/11/11/skype-extension-for-firefox-is-a-piece-of-crap-leaks-memory-hangs-firefox-clubs-baby-seals/&amp;notes=%20%20%20Introduction%20%20Dear%20Skype%2C%20%20you%20are%20great.%20You%20have%20the%20convenience%20of%20a%20nearby%2C%20well%2C%20convenience%20store%20and%20the%20UI%20that%20is%20acceptable%20to%20even%20an%20Apple%20fanboy%20%28I%27m%20not%20one%2C%20I%27m%20just%20saying%29.%20%20Skype%20also%20has%20a%20Firefox%20extension%20which%20finds%20all%20pieces%20of%20text%20that%20resemble%20phone%20numbers%20on%20web%20pages&amp;short_link=http://bit.ly/cmnZc6&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=Skype%20Extension%20For%20Firefox%20Is%20A%20Piece%20Of%20Crap%20-%20Leaks%20Memory%2C%20Hangs%20Firefox%2C%20Clubs%20Baby%20Seals&amp;link=http://beerpla.net/2009/11/11/skype-extension-for-firefox-is-a-piece-of-crap-leaks-memory-hangs-firefox-clubs-baby-seals/&amp;notes=%20%20%20Introduction%20%20Dear%20Skype%2C%20%20you%20are%20great.%20You%20have%20the%20convenience%20of%20a%20nearby%2C%20well%2C%20convenience%20store%20and%20the%20UI%20that%20is%20acceptable%20to%20even%20an%20Apple%20fanboy%20%28I%27m%20not%20one%2C%20I%27m%20just%20saying%29.%20%20Skype%20also%20has%20a%20Firefox%20extension%20which%20finds%20all%20pieces%20of%20text%20that%20resemble%20phone%20numbers%20on%20web%20pages&amp;short_link=http://bit.ly/cmnZc6&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li></ul><div
style="clear: both;"></div></div> Similar Posts:<ul><li><a
href="http://beerpla.net/2009/04/11/essential-firefox-extensions-plugins-add-ons-and-tips-a-comprehensive-guide-part-1-tips/" rel="bookmark" title="April 11, 2009">Essential Firefox Extensions (Plugins, Add-Ons) And Tips &ndash; A Comprehensive Guide :: Part 1 :: Tips</a></li><li><a
href="http://beerpla.net/2009/11/21/meet-firefox-for-mobile-video-feature-highlights-more-info/" rel="bookmark" title="November 21, 2009">Meet Firefox For Mobile [Video + Feature Highlights + More Info]</a></li><li><a
href="http://beerpla.net/2008/12/11/a-detailed-depiction-of-the-job-interview-process-at-google-by-peteris-krumins/" rel="bookmark" title="December 11, 2008">A Detailed Depiction Of The Job Interview Process At Google (by Peteris Krumins)</a></li><li><a
href="http://beerpla.net/2009/03/17/twitter-autocomplete-auto-url-expansion-auto-url-shortener-auto-pagination-rt-button-nested-replies-inline-media-embed-search-tabs-and-more/" rel="bookmark" title="March 17, 2009">Twitter.com Autocomplete, Auto URL Expansion, Auto URL Shortener, RT Button, Nested Replies, Inline Media Embed, Search Tabs, And More</a></li><li><a
href="http://beerpla.net/2009/06/10/essential-firefox-extensions-plugins-add-ons-a-comprehensive-guide-part-2-pragmatic-extensions/" rel="bookmark" title="June 10, 2009">Essential Firefox Extensions (Plugins, Add-Ons) &ndash; A Comprehensive Guide :: Part 2 :: Pragmatic Extensions</a></li></ul><p><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbeerpla.net%2F2009%2F11%2F11%2Fskype-extension-for-firefox-is-a-piece-of-crap-leaks-memory-hangs-firefox-clubs-baby-seals%2F&amp;title=Skype%20Extension%20For%20Firefox%20Is%20A%20Piece%20Of%20Crap%20%26%238211%3B%20Leaks%20Memory%2C%20Hangs%20Firefox%2C%20Clubs%20Baby%20Seals" id="wpa2a_6"><img
src="http://beerpla.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://beerpla.net/2009/11/11/skype-extension-for-firefox-is-a-piece-of-crap-leaks-memory-hangs-firefox-clubs-baby-seals/feed/</wfw:commentRss> <slash:comments>8</slash:comments> </item> <item><title>Best MySQL Server Under $10K?</title><link>http://beerpla.net/2008/06/11/best-mysql-server-under-10k/</link> <comments>http://beerpla.net/2008/06/11/best-mysql-server-under-10k/#comments</comments> <pubDate>Wed, 11 Jun 2008 09:30:54 +0000</pubDate> <dc:creator>Artem Russakovskii</dc:creator> <category><![CDATA[Databases]]></category> <category><![CDATA[best]]></category> <category><![CDATA[featured]]></category> <category><![CDATA[MySQL]]></category> <category><![CDATA[Performance]]></category> <category><![CDATA[server]]></category> <guid
isPermaLink="false">http://beerpla.net/2008/06/11/best-mysql-server-under-10k/</guid> <description><![CDATA[<p><a
href="http://beerpla.net/wp-content/uploads/BestMySQLServerUnder10K_2161/Serverpicture.png" class="lightview" rel="gallery['362']"><img
style="margin: 0px 10px 5px 0px" height="160" alt="Server picture" src="http://beerpla.net/wp-content/uploads/BestMySQLServerUnder10K_2161/Serverpicture_thumb.png" width="240" align="left" /></a> I want to get opinions from outside of my daily circle of people on the best server hardware to use for MySQL. I remember from <a
href="http://beerpla.net/2008/03/24/mysql-conference-2008/">the conference</a> somebody (Pipes?) mentioning a particular Dell server with multiple disk RAID10 that could supposedly be had for about $6k but I completely misplaced the model number (Frank, did you get my email?).</p><p>I know that a multi-disk RAID array with a bunch of fast disks (15k RPM?) is probably the most important method of improving performance, followed by the amount of RAM, so I&#039;m trying to find the best combination/balance of the two. However, server prices on the Internet range so much that I don&#039;t even know where to begin to tell a ...<div
class=clear></div> <a
href="http://beerpla.net/2008/06/11/best-mysql-server-under-10k/" class="read_more"><div
class=excerpt-end>Read the rest of this article &#187;</div></a></p>]]></description> <content:encoded><![CDATA[<p><a
href="http://beerpla.net/wp-content/uploads/BestMySQLServerUnder10K_2161/Serverpicture.png" class="lightview" rel="gallery['362']"><img
style="margin: 0px 10px 5px 0px" height="160" alt="Server picture" src="http://beerpla.net/wp-content/uploads/BestMySQLServerUnder10K_2161/Serverpicture_thumb.png" width="240" align="left" /></a> I want to get opinions from outside of my daily circle of people on the best server hardware to use for MySQL. I remember from <a
href="http://beerpla.net/2008/03/24/mysql-conference-2008/">the conference</a> somebody (Pipes?) mentioning a particular Dell server with multiple disk RAID10 that could supposedly be had for about $6k but I completely misplaced the model number (Frank, did you get my email?).</p><p>I know that a multi-disk RAID array with a bunch of fast disks (15k RPM?) is probably the most important method of improving performance, followed by the amount of RAM, so I&#039;m trying to find the best combination/balance of the two. However, server prices on the Internet range so much that I don&#039;t even know where to begin to tell a good deal from a bad one. I don&#039;t think SSDs can play a role here, because we need at least 200GB of usable space per machine. For comparison, we currently use the following spec: Dual quadcore Intel, 16GB RAM, 200GB RAID1 + 1TB RAID1 using SATA drives (eww?) in a 2U rack (a bit too chunky, isn&#039;t it?) made by <a
href="http://www.zantaz.com/">Zantaz</a>. It performs quite nicely but I think it chokes on the amount of writes way too early.</p><p>So, what does everyone think the best configuration is under $10,000? Bonus points if you can provide a link to the vendor site or at least a model number!</p><p><div
class="note"><div
class="notetip"><strong>Edit</strong>: so, here&#039;s the final configuration and quote I got from Silicon Mechanics, which I&#039;m quite happy about. It is way under the $10k budget, so mission accomplished:</p><ul><li>RakX 2U chassis</li><li>2x Intel Xeon E5420 Quad-core 2.5Ghz, 12MB cache CPUs</li><li>32GB (16x 2GB) 667Mhz Fully Buffered RAM</li><li>2x integrated gbit NICs</li><li>IPMI 2.0 remote management card with KVM over LAN</li><li>3Ware 9690SA-4I RAID controller with 512MB cache and battery backup</li><li>12x 74GB Seagate Cheetah 15K.5 15KRPM SAS drives</li><li>redundant 700W power supply</li><li>sliding rail kit</li><li>5 year advance component exchange warranty</li><li>OS RAID: 73GB HW RAID1</li><li>DATA RAID: 365GB HW RAID10</li></ul><p>Total price: <strong>$6176</strong> + tax, free shipping.</div></div></p><div
class="shr-bookmarks shr-bookmarks-expand"><ul
class="socials"><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=Best+MySQL+Server+Under+%2410K%3F&amp;link=http://beerpla.net/2008/06/11/best-mysql-server-under-10k/&amp;notes=%20I%20want%20to%20get%20opinions%20from%20outside%20of%20my%20daily%20circle%20of%20people%20on%20the%20best%20server%20hardware%20to%20use%20for%20MySQL.%20I%20remember%20from%20the%20conference%20somebody%20%28Pipes%3F%29%20mentioning%20a%20particular%20Dell%20server%20with%20multiple%20disk%20RAID10%20that%20could%20supposedly%20be%20had%20for%20about%20%246k%20but%20I%20completely%20misplaced%20the%20mod&amp;short_link=http://bit.ly/ctscht&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%24%7Btitle%7D+-+%24%7Bshort_link%7D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=Best+MySQL+Server+Under+%2410K%3F&amp;link=http://beerpla.net/2008/06/11/best-mysql-server-under-10k/&amp;notes=%20I%20want%20to%20get%20opinions%20from%20outside%20of%20my%20daily%20circle%20of%20people%20on%20the%20best%20server%20hardware%20to%20use%20for%20MySQL.%20I%20remember%20from%20the%20conference%20somebody%20%28Pipes%3F%29%20mentioning%20a%20particular%20Dell%20server%20with%20multiple%20disk%20RAID10%20that%20could%20supposedly%20be%20had%20for%20about%20%246k%20but%20I%20completely%20misplaced%20the%20mod&amp;short_link=http://bit.ly/ctscht&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-googlebuzz"> <a
href="http://www.shareaholic.com/api/share/?title=Best+MySQL+Server+Under+%2410K%3F&amp;link=http://beerpla.net/2008/06/11/best-mysql-server-under-10k/&amp;notes=%20I%20want%20to%20get%20opinions%20from%20outside%20of%20my%20daily%20circle%20of%20people%20on%20the%20best%20server%20hardware%20to%20use%20for%20MySQL.%20I%20remember%20from%20the%20conference%20somebody%20%28Pipes%3F%29%20mentioning%20a%20particular%20Dell%20server%20with%20multiple%20disk%20RAID10%20that%20could%20supposedly%20be%20had%20for%20about%20%246k%20but%20I%20completely%20misplaced%20the%20mod&amp;short_link=http://bit.ly/ctscht&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=257&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a></li><li
class="shr-reddit"> <a
href="http://www.shareaholic.com/api/share/?title=Best+MySQL+Server+Under+%2410K%3F&amp;link=http://beerpla.net/2008/06/11/best-mysql-server-under-10k/&amp;notes=%20I%20want%20to%20get%20opinions%20from%20outside%20of%20my%20daily%20circle%20of%20people%20on%20the%20best%20server%20hardware%20to%20use%20for%20MySQL.%20I%20remember%20from%20the%20conference%20somebody%20%28Pipes%3F%29%20mentioning%20a%20particular%20Dell%20server%20with%20multiple%20disk%20RAID10%20that%20could%20supposedly%20be%20had%20for%20about%20%246k%20but%20I%20completely%20misplaced%20the%20mod&amp;short_link=http://bit.ly/ctscht&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a></li><li
class="shr-hackernews"> <a
href="http://www.shareaholic.com/api/share/?title=Best+MySQL+Server+Under+%2410K%3F&amp;link=http://beerpla.net/2008/06/11/best-mysql-server-under-10k/&amp;notes=%20I%20want%20to%20get%20opinions%20from%20outside%20of%20my%20daily%20circle%20of%20people%20on%20the%20best%20server%20hardware%20to%20use%20for%20MySQL.%20I%20remember%20from%20the%20conference%20somebody%20%28Pipes%3F%29%20mentioning%20a%20particular%20Dell%20server%20with%20multiple%20disk%20RAID10%20that%20could%20supposedly%20be%20had%20for%20about%20%246k%20but%20I%20completely%20misplaced%20the%20mod&amp;short_link=http://bit.ly/ctscht&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=202&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Submit this to Hacker News">Submit this to Hacker News</a></li><li
class="shr-delicious"> <a
href="http://www.shareaholic.com/api/share/?title=Best+MySQL+Server+Under+%2410K%3F&amp;link=http://beerpla.net/2008/06/11/best-mysql-server-under-10k/&amp;notes=%20I%20want%20to%20get%20opinions%20from%20outside%20of%20my%20daily%20circle%20of%20people%20on%20the%20best%20server%20hardware%20to%20use%20for%20MySQL.%20I%20remember%20from%20the%20conference%20somebody%20%28Pipes%3F%29%20mentioning%20a%20particular%20Dell%20server%20with%20multiple%20disk%20RAID10%20that%20could%20supposedly%20be%20had%20for%20about%20%246k%20but%20I%20completely%20misplaced%20the%20mod&amp;short_link=http://bit.ly/ctscht&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=2&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a></li><li
class="shr-stumbleupon"> <a
href="http://www.shareaholic.com/api/share/?title=Best+MySQL+Server+Under+%2410K%3F&amp;link=http://beerpla.net/2008/06/11/best-mysql-server-under-10k/&amp;notes=%20I%20want%20to%20get%20opinions%20from%20outside%20of%20my%20daily%20circle%20of%20people%20on%20the%20best%20server%20hardware%20to%20use%20for%20MySQL.%20I%20remember%20from%20the%20conference%20somebody%20%28Pipes%3F%29%20mentioning%20a%20particular%20Dell%20server%20with%20multiple%20disk%20RAID10%20that%20could%20supposedly%20be%20had%20for%20about%20%246k%20but%20I%20completely%20misplaced%20the%20mod&amp;short_link=http://bit.ly/ctscht&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=Best%20MySQL%20Server%20Under%20%2410K%3F&amp;link=http://beerpla.net/2008/06/11/best-mysql-server-under-10k/&amp;notes=%20I%20want%20to%20get%20opinions%20from%20outside%20of%20my%20daily%20circle%20of%20people%20on%20the%20best%20server%20hardware%20to%20use%20for%20MySQL.%20I%20remember%20from%20the%20conference%20somebody%20%28Pipes%3F%29%20mentioning%20a%20particular%20Dell%20server%20with%20multiple%20disk%20RAID10%20that%20could%20supposedly%20be%20had%20for%20about%20%246k%20but%20I%20completely%20misplaced%20the%20mod&amp;short_link=http://bit.ly/ctscht&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li></ul><div
style="clear: both;"></div></div> Similar Posts:<ul><li><a
href="http://beerpla.net/2006/06/13/amd-plans-major-cpu-price-drops-day-after-conroe/" rel="bookmark" title="June 13, 2006">AMD Plans Major CPU Price Drops Day After Conroe</a></li><li><a
href="http://beerpla.net/2008/04/15/mysql-conference-presentation-at-the-kickfire-booth/" rel="bookmark" title="April 15, 2008">MySQL Conference: Presentation At The Kickfire Booth</a></li><li><a
href="http://beerpla.net/2006/06/12/beer-planet-is-fast-again/" rel="bookmark" title="June 12, 2006">Beer Planet is Fast Again</a></li><li><a
href="http://beerpla.net/2008/04/17/mysql-conference-liveblogging-optimizing-mysql-for-high-volume-data-logging-applications-thursday-250pm/" rel="bookmark" title="April 17, 2008">MySQL Conference Liveblogging: Optimizing MySQL For High Volume Data Logging Applications (Thursday 2:50PM)</a></li><li><a
href="http://beerpla.net/2008/09/05/mysql-slave-lag-delay-explained-and-7-ways-to-battle-it/" rel="bookmark" title="September 5, 2008">MySQL Slave Lag (Delay) Explained And 7 Ways To Battle It</a></li></ul><p><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbeerpla.net%2F2008%2F06%2F11%2Fbest-mysql-server-under-10k%2F&amp;title=Best%20MySQL%20Server%20Under%20%2410K%3F" id="wpa2a_8"><img
src="http://beerpla.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://beerpla.net/2008/06/11/best-mysql-server-under-10k/feed/</wfw:commentRss> <slash:comments>21</slash:comments> </item> <item><title>MySQL Conference Liveblogging: MySQL Performance Under A Microscope: The Tobias And Jay Show (Wednesday 2:00PM)</title><link>http://beerpla.net/2008/04/16/mysql-conference-liveblogging-mysql-performance-under-a-microscope-the-tobias-and-jay-show-wednesday-200pm/</link> <comments>http://beerpla.net/2008/04/16/mysql-conference-liveblogging-mysql-performance-under-a-microscope-the-tobias-and-jay-show-wednesday-200pm/#comments</comments> <pubDate>Wed, 16 Apr 2008 21:18:17 +0000</pubDate> <dc:creator>Artem Russakovskii</dc:creator> <category><![CDATA[Databases]]></category> <category><![CDATA[conference]]></category> <category><![CDATA[jay]]></category> <category><![CDATA[MySQL]]></category> <category><![CDATA[Performance]]></category> <category><![CDATA[tobias]]></category> <guid
isPermaLink="false">http://beerpla.net/2008/04/16/mysql-conference-liveblogging-mysql-performance-under-a-microscope-the-tobias-and-jay-show-wednesday-200pm/</guid> <description><![CDATA[<ul><li>Jay Pipes, Tobias Asplund</li><li>Finding out the number of rows that would have been returned (MyISAM and InnoDB)</li></ul><ul><li>SQL_CALC_FOUND_ROWS and FOUND_ROWS()</li><li>COUNT(*)</li><li>MEMORY table</li><li>if query cache is on, then it makes no difference</li><li>if it&#039;s off</li></ul><ul><li>Memory MyISAM is fastest</li><li>FOUND_ROWS() is slightly slower than count(*)</li></ul><li>more in the slides that I&#039;ll add later</li><li>quite a lot of humor, these guys are fun</li><li><strong>query union vs index_merge union</strong></li><ul><li>SELECT &#8230; WHERE a UNION SELECT &#8230; WHERE b<br
/>vs<br
/>SELECT &#8230; WHERE a AND b</li><li>index_merge wins</li></ul><li><strong>composite index vs index merge</strong></li><ul><li>composite index is faster</li><li>of course, multiple indexes are more flexible than composite index</li></ul><li><strong>sort union vs composite index</strong></li><ul><li>&#8230;</li></ul><li>unix time (int unsigned) vs datetime</li><ul><li>query cache</li>...<div
class=clear></div> <a
href="http://beerpla.net/2008/04/16/mysql-conference-liveblogging-mysql-performance-under-a-microscope-the-tobias-and-jay-show-wednesday-200pm/" class="read_more"><div
class=excerpt-end>Read the rest of this article &#187;</div></a></ul>]]></description> <content:encoded><![CDATA[<ul><li>Jay Pipes, Tobias Asplund</li><li>Finding out the number of rows that would have been returned (MyISAM and InnoDB)</li><ul><li>SQL_CALC_FOUND_ROWS and FOUND_ROWS()</li><li>COUNT(*)</li><li>MEMORY table</li><li>if query cache is on, then it makes no difference</li><li>if it&#039;s off</li><ul><li>Memory MyISAM is fastest</li><li>FOUND_ROWS() is slightly slower than count(*)</li></ul><li>more in the slides that I&#039;ll add later</li></ul><li>quite a lot of humor, these guys are fun</li><li><strong>query union vs index_merge union</strong></li><ul><li>SELECT &#8230; WHERE a UNION SELECT &#8230; WHERE b<br
/>vs<br
/>SELECT &#8230; WHERE a AND b</li><li>index_merge wins</li></ul><li><strong>composite index vs index merge</strong></li><ul><li>composite index is faster</li><li>of course, multiple indexes are more flexible than composite index</li></ul><li><strong>sort union vs composite index</strong></li><ul><li>&#8230;</li></ul><li>unix time (int unsigned) vs datetime</li><ul><li>query cache disabled</li><li>100k rows</li><li>now and 20 years back</li><li>retrieval range between 50 and 365 days</li><li>all data fits into memory</li><li>UNIX_TIMESTAMP is worst</li><li>DATETIME in the middle</li><li>strtotime() fastest</li></ul><li>is BENCHMARK() a good simulation test?</li><ul><li>NOW()</li><li>MONTH(NOW())</li><li>MONTH(&#039;YYYY-MM-DD&#039;)</li><li>DATE_FORMAT()</li><li>SUBSTRING()</li><li>all about the same if php benchmark script is used</li><li>BENCHMARK() is very unreliable, the results vary a lot</li></ul><li>X in Y how many times?</li><ul><li>3 different methods on mysql forge</li><li>2 UDFs and 1 using native functions</li><li>query cache off</li><li>1K rows</li><li>all rows have &#034;/&#034;</li><li>count the number of &#034;/&#034;</li><li>Marcelo&#039;s solution &#034;COUNT_CHAR_OCCURRENCE&#034;: 4th place</li><li>Garrett Hill&#039;s solution &#034;countstring&#034; (it&#039;s technically slightly wrong, because it doesn&#039;t account for multibyte characters): 2nd place</li><li>Roland Bouman&#039;s solution using mysql functions: 1st place</li><li>Jay&#039;s way: function in php: 3rd place</li></ul><li>MEMORY engine HASH index vs BTREE index</li><ul><li>BTREE is faster</li><li>HASH uses less memory</li></ul></ul><div
class="shr-bookmarks shr-bookmarks-expand"><ul
class="socials"><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=MySQL+Conference+Liveblogging%3A+MySQL+Performance+Under+A+Microscope%3A+The+Tobias+And+Jay+Show+%28Wednesday+2%3A00PM%29&amp;link=http://beerpla.net/2008/04/16/mysql-conference-liveblogging-mysql-performance-under-a-microscope-the-tobias-and-jay-show-wednesday-200pm/&amp;notes=%20Jay%20Pipes%2C%20Tobias%20Asplund%20Finding%20out%20the%20number%20of%20rows%20that%20would%20have%20been%20returned%20%28MyISAM%20and%20InnoDB%29%20%20SQL_CALC_FOUND_ROWS%20and%20FOUND_ROWS%28%29%20COUNT%28%2A%29%20MEMORY%20table%20if%20query%20cache%20is%20on%2C%20then%20it%20makes%20no%20difference%20if%20it%27s%20off%20%20Memory%20MyISAM%20is%20fastest%20FOUND_ROWS%28%29%20is%20slightly%20slower%20than%20count%28%2A&amp;short_link=http://bit.ly/9pz9Dd&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%24%7Btitle%7D+-+%24%7Bshort_link%7D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=MySQL+Conference+Liveblogging%3A+MySQL+Performance+Under+A+Microscope%3A+The+Tobias+And+Jay+Show+%28Wednesday+2%3A00PM%29&amp;link=http://beerpla.net/2008/04/16/mysql-conference-liveblogging-mysql-performance-under-a-microscope-the-tobias-and-jay-show-wednesday-200pm/&amp;notes=%20Jay%20Pipes%2C%20Tobias%20Asplund%20Finding%20out%20the%20number%20of%20rows%20that%20would%20have%20been%20returned%20%28MyISAM%20and%20InnoDB%29%20%20SQL_CALC_FOUND_ROWS%20and%20FOUND_ROWS%28%29%20COUNT%28%2A%29%20MEMORY%20table%20if%20query%20cache%20is%20on%2C%20then%20it%20makes%20no%20difference%20if%20it%27s%20off%20%20Memory%20MyISAM%20is%20fastest%20FOUND_ROWS%28%29%20is%20slightly%20slower%20than%20count%28%2A&amp;short_link=http://bit.ly/9pz9Dd&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-googlebuzz"> <a
href="http://www.shareaholic.com/api/share/?title=MySQL+Conference+Liveblogging%3A+MySQL+Performance+Under+A+Microscope%3A+The+Tobias+And+Jay+Show+%28Wednesday+2%3A00PM%29&amp;link=http://beerpla.net/2008/04/16/mysql-conference-liveblogging-mysql-performance-under-a-microscope-the-tobias-and-jay-show-wednesday-200pm/&amp;notes=%20Jay%20Pipes%2C%20Tobias%20Asplund%20Finding%20out%20the%20number%20of%20rows%20that%20would%20have%20been%20returned%20%28MyISAM%20and%20InnoDB%29%20%20SQL_CALC_FOUND_ROWS%20and%20FOUND_ROWS%28%29%20COUNT%28%2A%29%20MEMORY%20table%20if%20query%20cache%20is%20on%2C%20then%20it%20makes%20no%20difference%20if%20it%27s%20off%20%20Memory%20MyISAM%20is%20fastest%20FOUND_ROWS%28%29%20is%20slightly%20slower%20than%20count%28%2A&amp;short_link=http://bit.ly/9pz9Dd&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=257&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a></li><li
class="shr-reddit"> <a
href="http://www.shareaholic.com/api/share/?title=MySQL+Conference+Liveblogging%3A+MySQL+Performance+Under+A+Microscope%3A+The+Tobias+And+Jay+Show+%28Wednesday+2%3A00PM%29&amp;link=http://beerpla.net/2008/04/16/mysql-conference-liveblogging-mysql-performance-under-a-microscope-the-tobias-and-jay-show-wednesday-200pm/&amp;notes=%20Jay%20Pipes%2C%20Tobias%20Asplund%20Finding%20out%20the%20number%20of%20rows%20that%20would%20have%20been%20returned%20%28MyISAM%20and%20InnoDB%29%20%20SQL_CALC_FOUND_ROWS%20and%20FOUND_ROWS%28%29%20COUNT%28%2A%29%20MEMORY%20table%20if%20query%20cache%20is%20on%2C%20then%20it%20makes%20no%20difference%20if%20it%27s%20off%20%20Memory%20MyISAM%20is%20fastest%20FOUND_ROWS%28%29%20is%20slightly%20slower%20than%20count%28%2A&amp;short_link=http://bit.ly/9pz9Dd&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a></li><li
class="shr-hackernews"> <a
href="http://www.shareaholic.com/api/share/?title=MySQL+Conference+Liveblogging%3A+MySQL+Performance+Under+A+Microscope%3A+The+Tobias+And+Jay+Show+%28Wednesday+2%3A00PM%29&amp;link=http://beerpla.net/2008/04/16/mysql-conference-liveblogging-mysql-performance-under-a-microscope-the-tobias-and-jay-show-wednesday-200pm/&amp;notes=%20Jay%20Pipes%2C%20Tobias%20Asplund%20Finding%20out%20the%20number%20of%20rows%20that%20would%20have%20been%20returned%20%28MyISAM%20and%20InnoDB%29%20%20SQL_CALC_FOUND_ROWS%20and%20FOUND_ROWS%28%29%20COUNT%28%2A%29%20MEMORY%20table%20if%20query%20cache%20is%20on%2C%20then%20it%20makes%20no%20difference%20if%20it%27s%20off%20%20Memory%20MyISAM%20is%20fastest%20FOUND_ROWS%28%29%20is%20slightly%20slower%20than%20count%28%2A&amp;short_link=http://bit.ly/9pz9Dd&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=202&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Submit this to Hacker News">Submit this to Hacker News</a></li><li
class="shr-delicious"> <a
href="http://www.shareaholic.com/api/share/?title=MySQL+Conference+Liveblogging%3A+MySQL+Performance+Under+A+Microscope%3A+The+Tobias+And+Jay+Show+%28Wednesday+2%3A00PM%29&amp;link=http://beerpla.net/2008/04/16/mysql-conference-liveblogging-mysql-performance-under-a-microscope-the-tobias-and-jay-show-wednesday-200pm/&amp;notes=%20Jay%20Pipes%2C%20Tobias%20Asplund%20Finding%20out%20the%20number%20of%20rows%20that%20would%20have%20been%20returned%20%28MyISAM%20and%20InnoDB%29%20%20SQL_CALC_FOUND_ROWS%20and%20FOUND_ROWS%28%29%20COUNT%28%2A%29%20MEMORY%20table%20if%20query%20cache%20is%20on%2C%20then%20it%20makes%20no%20difference%20if%20it%27s%20off%20%20Memory%20MyISAM%20is%20fastest%20FOUND_ROWS%28%29%20is%20slightly%20slower%20than%20count%28%2A&amp;short_link=http://bit.ly/9pz9Dd&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=2&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a></li><li
class="shr-stumbleupon"> <a
href="http://www.shareaholic.com/api/share/?title=MySQL+Conference+Liveblogging%3A+MySQL+Performance+Under+A+Microscope%3A+The+Tobias+And+Jay+Show+%28Wednesday+2%3A00PM%29&amp;link=http://beerpla.net/2008/04/16/mysql-conference-liveblogging-mysql-performance-under-a-microscope-the-tobias-and-jay-show-wednesday-200pm/&amp;notes=%20Jay%20Pipes%2C%20Tobias%20Asplund%20Finding%20out%20the%20number%20of%20rows%20that%20would%20have%20been%20returned%20%28MyISAM%20and%20InnoDB%29%20%20SQL_CALC_FOUND_ROWS%20and%20FOUND_ROWS%28%29%20COUNT%28%2A%29%20MEMORY%20table%20if%20query%20cache%20is%20on%2C%20then%20it%20makes%20no%20difference%20if%20it%27s%20off%20%20Memory%20MyISAM%20is%20fastest%20FOUND_ROWS%28%29%20is%20slightly%20slower%20than%20count%28%2A&amp;short_link=http://bit.ly/9pz9Dd&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=MySQL%20Conference%20Liveblogging%3A%20MySQL%20Performance%20Under%20A%20Microscope%3A%20The%20Tobias%20And%20Jay%20Show%20%28Wednesday%202%3A00PM%29&amp;link=http://beerpla.net/2008/04/16/mysql-conference-liveblogging-mysql-performance-under-a-microscope-the-tobias-and-jay-show-wednesday-200pm/&amp;notes=%20Jay%20Pipes%2C%20Tobias%20Asplund%20Finding%20out%20the%20number%20of%20rows%20that%20would%20have%20been%20returned%20%28MyISAM%20and%20InnoDB%29%20%20SQL_CALC_FOUND_ROWS%20and%20FOUND_ROWS%28%29%20COUNT%28%2A%29%20MEMORY%20table%20if%20query%20cache%20is%20on%2C%20then%20it%20makes%20no%20difference%20if%20it%27s%20off%20%20Memory%20MyISAM%20is%20fastest%20FOUND_ROWS%28%29%20is%20slightly%20slower%20than%20count%28%2A&amp;short_link=http://bit.ly/9pz9Dd&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li></ul><div
style="clear: both;"></div></div> Similar Posts:<ul><li><a
href="http://beerpla.net/2008/04/15/mysql-conference-liveblogging-explain-demystified-tuesday-200p/" rel="bookmark" title="April 15, 2008">MySQL Conference Liveblogging: EXPLAIN Demystified (Tuesday 2:00PM)</a></li><li><a
href="http://beerpla.net/2008/04/15/mysql-conference-liveblogging-the-future-of-mysql-tuesday-1155am-2/" rel="bookmark" title="April 15, 2008">MySQL Conference Liveblogging: The Future Of MySQL (Tuesday 11:55AM)</a></li><li><a
href="http://beerpla.net/2008/04/16/mysql-conference-liveblogging-benchmarking-tools-wednesday-425pm/" rel="bookmark" title="April 16, 2008">MySQL Conference Liveblogging: Benchmarking Tools (Wednesday 4:25PM)</a></li><li><a
href="http://beerpla.net/2008/04/15/mysql-conference-liveblogging-performance-guide-for-mysql-cluster-tuesday-1050am/" rel="bookmark" title="April 15, 2008">MySQL Conference Liveblogging: Performance Guide For MySQL Cluster (Tuesday 10:50AM)</a></li><li><a
href="http://beerpla.net/2009/03/18/mysql-indexing-considerations-of-implementing-a-priority-field-in-your-application/" rel="bookmark" title="March 18, 2009">MySQL Indexing Considerations Of Implementing A Priority Field In Your Application</a></li></ul><p><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbeerpla.net%2F2008%2F04%2F16%2Fmysql-conference-liveblogging-mysql-performance-under-a-microscope-the-tobias-and-jay-show-wednesday-200pm%2F&amp;title=MySQL%20Conference%20Liveblogging%3A%20MySQL%20Performance%20Under%20A%20Microscope%3A%20The%20Tobias%20And%20Jay%20Show%20%28Wednesday%202%3A00PM%29" id="wpa2a_10"><img
src="http://beerpla.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://beerpla.net/2008/04/16/mysql-conference-liveblogging-mysql-performance-under-a-microscope-the-tobias-and-jay-show-wednesday-200pm/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>MySQL Conference Liveblogging: Performance Guide For MySQL Cluster (Tuesday 10:50AM)</title><link>http://beerpla.net/2008/04/15/mysql-conference-liveblogging-performance-guide-for-mysql-cluster-tuesday-1050am/</link> <comments>http://beerpla.net/2008/04/15/mysql-conference-liveblogging-performance-guide-for-mysql-cluster-tuesday-1050am/#comments</comments> <pubDate>Tue, 15 Apr 2008 18:04:15 +0000</pubDate> <dc:creator>Artem Russakovskii</dc:creator> <category><![CDATA[Databases]]></category> <category><![CDATA[cluster]]></category> <category><![CDATA[guide]]></category> <category><![CDATA[MySQL]]></category> <category><![CDATA[Performance]]></category> <guid
isPermaLink="false">http://beerpla.net/2008/04/15/mysql-conference-liveblogging-performance-guide-for-mysql-cluster-tuesday-1050am/</guid> <description><![CDATA[<ul><li>Speaker: Mikael Ronstrom, PhD, the <strong>creator of the Cluster engine</strong></li><li>Explains the cluster structure</li><li>Aspects of performance<ul><li>Response times</li><li>Throughput</li><li>Low variation of response times</li></ul></li><li>Improving performance<ul><li>use low level API (NDB API), expensive, hard</li><li>use new features in MySQL Cluster Carrier Grade Edition 6.3 (currently 6.3.13), more on this later</li><li>proper partitioning of tables, minimize communication</li><li>use of hardware</li></ul></li><li>NDB API is a C++ record access API<ul><li>supports sending parallel record operations within the same transaction or in different transactions</li><li>asynchronous and synchronous</li><li>NDB kernel is programmed entirely asynchronously</li></ul></li><li>Looking at performance<ul><li>Fire synchronous insert transactions &#8211; 10x TCP/IP time cost</li><li>Five inserts in one synchronous transaction &#8211; 2x TCP/IP time cost</li><li><strong>Five asynchronous insert transactions &#8211; 2x TCP/IP </strong></li></ul></li>...<div
class=clear></div> <a
href="http://beerpla.net/2008/04/15/mysql-conference-liveblogging-performance-guide-for-mysql-cluster-tuesday-1050am/" class="read_more"><div
class=excerpt-end>Read the rest of this article &#187;</div></a></ul>]]></description> <content:encoded><![CDATA[<ul><li>Speaker: Mikael Ronstrom, PhD, the <strong>creator of the Cluster engine</strong></li><li>Explains the cluster structure</li><li>Aspects of performance<ul><li>Response times</li><li>Throughput</li><li>Low variation of response times</li></ul></li><li>Improving performance<ul><li>use low level API (NDB API), expensive, hard</li><li>use new features in MySQL Cluster Carrier Grade Edition 6.3 (currently 6.3.13), more on this later</li><li>proper partitioning of tables, minimize communication</li><li>use of hardware</li></ul></li><li>NDB API is a C++ record access API<ul><li>supports sending parallel record operations within the same transaction or in different transactions</li><li>asynchronous and synchronous</li><li>NDB kernel is programmed entirely asynchronously</li></ul></li><li>Looking at performance<ul><li>Fire synchronous insert transactions &#8211; 10x TCP/IP time cost</li><li>Five inserts in one synchronous transaction &#8211; 2x TCP/IP time cost</li><li><strong>Five asynchronous insert transactions &#8211; 2x TCP/IP time cost</strong></li></ul></li><li>Case study<ul><li>develop prototype using MySQL C API &#8211; performance X, response time Y</li><li>develop same functionality using synchronous NDB API &#8211; performance 3X, response time ~0.5Y</li><li><strong>develop same functionality using asynchronous NDB API &#8211; performance 6X, response time ~0.25Y</strong></li></ul></li><li>Conclusion on when to use NDB API<ul><li>performance is critical, need speed, response time, etc</li><li>queries are not very complex</li></ul></li><li>Conclusion on when not to use NDB API<ul><li>when design time is critical</li><li>when complex queries are executed, the MySQL optimizer may handle them better</li></ul></li><li>New features of MySQL Cluster Carrier Grade Edition 6.3.13</li><ul><li>polling based communication</li><ul><li>CPU used heavily even at lower throughput</li><li>avoids interrupt and wake-up delays for new messages</li><li>some good results in benchmarks</li><li>decreases performance when CPU is the limiting factor</li><li>10% performance improvement on 2, 4, and 8 data node clusters</li><li>20% improvement if using Dolphin Express</li></ul><li>epoll replacing select system calls (Linux)</li><ul><li>improved performance 20% on a 32-node cluster</li></ul><li>send buffer gathering</li><li>real-time scheduler for threads</li><li>lock threads to CPU</li><li>distribution awareness</li><ul><li>100-200% improvement when application is distribution aware</li></ul><li>avoid read before Update/Delete with PK</li><ul><li>UPDATE t SET a=const1 WHERE pk=x;</li><li>no need to do a read before UPDATE, all data is already known</li><li>~10% improvement</li></ul></ul><li><strong>old &#039;truths&#039; revisited</strong></li><ul><li><strong>previous recommendation was to run 1 data node per computer</strong></li><li><strong>this was due to bugs, which are now fixed</strong></li></ul><li>partitioning tricks</li><ul><li>if there is a table that has a lot of index scans (not primary key) on it, partitioning this table to only be in one node group can be a good idea</li><li>partition syntax for this: PARTITION BY KEY (id) (PARTITION p0 NODEGROUP 0);</li></ul><li><strong>new performance features in MySQL Cluster 5.0</strong></li><ul><li><strong>lock memory in main memory &#8211; ensure no swapping occurs in NDB kernel</strong></li><li><strong>batching IN (&#8230;) with primary keys</strong></li><ul><li><strong>100x SELECT FROM t WHERE pk=x;</strong></li><li><strong>SELECT * FROM t WHERE pk IN (x1, &#8230;, x100)</strong></li><li><strong>IN-statement is around 10x faster</strong></li></ul><li><strong>use of multi-INSERT</strong></li><ul><li><strong>similar 10x speedup</strong></li></ul></ul><li>new features in MySQL Cluster CGE version 6.4 (beta, only available in bitkeeper for now)</li><ul><li>multi-threaded data nodes &#8211; currently no benefit using DBT2 but 40% increase in throughput for some NDB API benchmarks</li><li>DBT2 improvements to follow later</li></ul><li>use of hardware, CPU choice</li><ul><li>Pentium D @ 2.8Ghz -&gt; Core 2 Duo @ 2.8Ghz =&gt; 75% improvement</li><li>doubling L2 cache doubles thread scalability</li><li>choice of Dolphin Express interconnect increases throughput 10-400%</li></ul><li>scalability of DBT2 threads</li><ul><li>1-2-4 threads &#8211; linear</li><li>4-8 threads &#8211; 40-70%</li><li>8-16 threads &#8211; 10-30%</li><li>decreasing scalability over 16 threads</li></ul><li>current recommendation by Mikael himself: use twice as many SQL nodes as data nodes</li><li>future software performance improvements</li><ul><li>batched key access &#8211; 0-400% performance improvement</li><li>improvement scan protocol &#8211; ~15% improvement</li><li>incremental backups</li><li>optimized backup code</li><li>parallel I/O on index scans using disk data</li></ul><li>Niagara-II benchmark from 2002</li><ul><ul><li>simple read, simple update, both transactional</li><li>72-CPU Sunfire 15k, 256GB RAM</li><li>CPUs: ultra sparc-III @ 900Mhz</li><li>32-node NDB Cluster, 1 data node locked to 1 CPU</li><li>db size 88GB, 900 mil records</li><li>simple reads 1.5mil reads per second</li><li>simple update 340,000 per second</li></ul></ul><li>Everyone is overwhelmed, so no questions are asked</li></ul><div
class="shr-bookmarks shr-bookmarks-expand"><ul
class="socials"><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=MySQL+Conference+Liveblogging%3A+Performance+Guide+For+MySQL+Cluster+%28Tuesday+10%3A50AM%29&amp;link=http://beerpla.net/2008/04/15/mysql-conference-liveblogging-performance-guide-for-mysql-cluster-tuesday-1050am/&amp;notes=%20%20%20Speaker%3A%20Mikael%20Ronstrom%2C%20PhD%2C%20the%20creator%20of%20the%20Cluster%20engine%20%20%20%20%20Explains%20the%20cluster%20structure%20%20%20%20%20Aspects%20of%20performance%20%20%20%20%20%20%20%20%20%20%20%20%20Response%20times%20%20%20%20%20%20%20%20%20Throughput%20%20%20%20%20%20%20%20%20Low%20variation%20of%20response%20times%20%20%20%20%20%20%20%20%20%20%20%20%20Improving%20performance%20%20%20%20%20%20%20%20%20%20%20%20%20use%20low%20level%20API%20%28NDB%20API%29%2C%20expensive&amp;short_link=http://bit.ly/bHmBOG&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%24%7Btitle%7D+-+%24%7Bshort_link%7D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=MySQL+Conference+Liveblogging%3A+Performance+Guide+For+MySQL+Cluster+%28Tuesday+10%3A50AM%29&amp;link=http://beerpla.net/2008/04/15/mysql-conference-liveblogging-performance-guide-for-mysql-cluster-tuesday-1050am/&amp;notes=%20%20%20Speaker%3A%20Mikael%20Ronstrom%2C%20PhD%2C%20the%20creator%20of%20the%20Cluster%20engine%20%20%20%20%20Explains%20the%20cluster%20structure%20%20%20%20%20Aspects%20of%20performance%20%20%20%20%20%20%20%20%20%20%20%20%20Response%20times%20%20%20%20%20%20%20%20%20Throughput%20%20%20%20%20%20%20%20%20Low%20variation%20of%20response%20times%20%20%20%20%20%20%20%20%20%20%20%20%20Improving%20performance%20%20%20%20%20%20%20%20%20%20%20%20%20use%20low%20level%20API%20%28NDB%20API%29%2C%20expensive&amp;short_link=http://bit.ly/bHmBOG&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-googlebuzz"> <a
href="http://www.shareaholic.com/api/share/?title=MySQL+Conference+Liveblogging%3A+Performance+Guide+For+MySQL+Cluster+%28Tuesday+10%3A50AM%29&amp;link=http://beerpla.net/2008/04/15/mysql-conference-liveblogging-performance-guide-for-mysql-cluster-tuesday-1050am/&amp;notes=%20%20%20Speaker%3A%20Mikael%20Ronstrom%2C%20PhD%2C%20the%20creator%20of%20the%20Cluster%20engine%20%20%20%20%20Explains%20the%20cluster%20structure%20%20%20%20%20Aspects%20of%20performance%20%20%20%20%20%20%20%20%20%20%20%20%20Response%20times%20%20%20%20%20%20%20%20%20Throughput%20%20%20%20%20%20%20%20%20Low%20variation%20of%20response%20times%20%20%20%20%20%20%20%20%20%20%20%20%20Improving%20performance%20%20%20%20%20%20%20%20%20%20%20%20%20use%20low%20level%20API%20%28NDB%20API%29%2C%20expensive&amp;short_link=http://bit.ly/bHmBOG&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=257&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a></li><li
class="shr-reddit"> <a
href="http://www.shareaholic.com/api/share/?title=MySQL+Conference+Liveblogging%3A+Performance+Guide+For+MySQL+Cluster+%28Tuesday+10%3A50AM%29&amp;link=http://beerpla.net/2008/04/15/mysql-conference-liveblogging-performance-guide-for-mysql-cluster-tuesday-1050am/&amp;notes=%20%20%20Speaker%3A%20Mikael%20Ronstrom%2C%20PhD%2C%20the%20creator%20of%20the%20Cluster%20engine%20%20%20%20%20Explains%20the%20cluster%20structure%20%20%20%20%20Aspects%20of%20performance%20%20%20%20%20%20%20%20%20%20%20%20%20Response%20times%20%20%20%20%20%20%20%20%20Throughput%20%20%20%20%20%20%20%20%20Low%20variation%20of%20response%20times%20%20%20%20%20%20%20%20%20%20%20%20%20Improving%20performance%20%20%20%20%20%20%20%20%20%20%20%20%20use%20low%20level%20API%20%28NDB%20API%29%2C%20expensive&amp;short_link=http://bit.ly/bHmBOG&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=40&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a></li><li
class="shr-hackernews"> <a
href="http://www.shareaholic.com/api/share/?title=MySQL+Conference+Liveblogging%3A+Performance+Guide+For+MySQL+Cluster+%28Tuesday+10%3A50AM%29&amp;link=http://beerpla.net/2008/04/15/mysql-conference-liveblogging-performance-guide-for-mysql-cluster-tuesday-1050am/&amp;notes=%20%20%20Speaker%3A%20Mikael%20Ronstrom%2C%20PhD%2C%20the%20creator%20of%20the%20Cluster%20engine%20%20%20%20%20Explains%20the%20cluster%20structure%20%20%20%20%20Aspects%20of%20performance%20%20%20%20%20%20%20%20%20%20%20%20%20Response%20times%20%20%20%20%20%20%20%20%20Throughput%20%20%20%20%20%20%20%20%20Low%20variation%20of%20response%20times%20%20%20%20%20%20%20%20%20%20%20%20%20Improving%20performance%20%20%20%20%20%20%20%20%20%20%20%20%20use%20low%20level%20API%20%28NDB%20API%29%2C%20expensive&amp;short_link=http://bit.ly/bHmBOG&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=202&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Submit this to Hacker News">Submit this to Hacker News</a></li><li
class="shr-delicious"> <a
href="http://www.shareaholic.com/api/share/?title=MySQL+Conference+Liveblogging%3A+Performance+Guide+For+MySQL+Cluster+%28Tuesday+10%3A50AM%29&amp;link=http://beerpla.net/2008/04/15/mysql-conference-liveblogging-performance-guide-for-mysql-cluster-tuesday-1050am/&amp;notes=%20%20%20Speaker%3A%20Mikael%20Ronstrom%2C%20PhD%2C%20the%20creator%20of%20the%20Cluster%20engine%20%20%20%20%20Explains%20the%20cluster%20structure%20%20%20%20%20Aspects%20of%20performance%20%20%20%20%20%20%20%20%20%20%20%20%20Response%20times%20%20%20%20%20%20%20%20%20Throughput%20%20%20%20%20%20%20%20%20Low%20variation%20of%20response%20times%20%20%20%20%20%20%20%20%20%20%20%20%20Improving%20performance%20%20%20%20%20%20%20%20%20%20%20%20%20use%20low%20level%20API%20%28NDB%20API%29%2C%20expensive&amp;short_link=http://bit.ly/bHmBOG&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=2&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a></li><li
class="shr-stumbleupon"> <a
href="http://www.shareaholic.com/api/share/?title=MySQL+Conference+Liveblogging%3A+Performance+Guide+For+MySQL+Cluster+%28Tuesday+10%3A50AM%29&amp;link=http://beerpla.net/2008/04/15/mysql-conference-liveblogging-performance-guide-for-mysql-cluster-tuesday-1050am/&amp;notes=%20%20%20Speaker%3A%20Mikael%20Ronstrom%2C%20PhD%2C%20the%20creator%20of%20the%20Cluster%20engine%20%20%20%20%20Explains%20the%20cluster%20structure%20%20%20%20%20Aspects%20of%20performance%20%20%20%20%20%20%20%20%20%20%20%20%20Response%20times%20%20%20%20%20%20%20%20%20Throughput%20%20%20%20%20%20%20%20%20Low%20variation%20of%20response%20times%20%20%20%20%20%20%20%20%20%20%20%20%20Improving%20performance%20%20%20%20%20%20%20%20%20%20%20%20%20use%20low%20level%20API%20%28NDB%20API%29%2C%20expensive&amp;short_link=http://bit.ly/bHmBOG&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=38&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=MySQL%20Conference%20Liveblogging%3A%20Performance%20Guide%20For%20MySQL%20Cluster%20%28Tuesday%2010%3A50AM%29&amp;link=http://beerpla.net/2008/04/15/mysql-conference-liveblogging-performance-guide-for-mysql-cluster-tuesday-1050am/&amp;notes=%20%20%20Speaker%3A%20Mikael%20Ronstrom%2C%20PhD%2C%20the%20creator%20of%20the%20Cluster%20engine%20%20%20%20%20Explains%20the%20cluster%20structure%20%20%20%20%20Aspects%20of%20performance%20%20%20%20%20%20%20%20%20%20%20%20%20Response%20times%20%20%20%20%20%20%20%20%20Throughput%20%20%20%20%20%20%20%20%20Low%20variation%20of%20response%20times%20%20%20%20%20%20%20%20%20%20%20%20%20Improving%20performance%20%20%20%20%20%20%20%20%20%20%20%20%20use%20low%20level%20API%20%28NDB%20API%29%2C%20expensive&amp;short_link=http://bit.ly/bHmBOG&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li></ul><div
style="clear: both;"></div></div> Similar Posts:<ul><li><a
href="http://beerpla.net/2008/04/16/mysql-conference-liveblogging-portable-scale-out-benchmarks-for-mysql-wednesday-1050am/" rel="bookmark" title="April 16, 2008">MySQL Conference Liveblogging: Portable Scale-out Benchmarks For MySQL (Wednesday 10:50AM)</a></li><li><a
href="http://beerpla.net/2008/03/26/setting-up-a-mysql-cluster/" rel="bookmark" title="March 26, 2008">Setting Up A MySQL Cluster</a></li><li><a
href="http://beerpla.net/2008/04/15/mysql-conference-liveblogging-the-future-of-mysql-tuesday-1155am-2/" rel="bookmark" title="April 15, 2008">MySQL Conference Liveblogging: The Future Of MySQL (Tuesday 11:55AM)</a></li><li><a
href="http://beerpla.net/2008/04/16/mysql-conference-liveblogging-applied-partitioning-and-scaling-your-oltp-database-system-wednesday-1155am/" rel="bookmark" title="April 16, 2008">MySQL Conference Liveblogging: Applied Partitioning And Scaling your (OLTP) Database System (Wednesday 11:55AM)</a></li><li><a
href="http://beerpla.net/2008/03/24/mysql-conference-2008/" rel="bookmark" title="March 24, 2008">MySQL Conference 2008</a></li></ul><p><a
class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fbeerpla.net%2F2008%2F04%2F15%2Fmysql-conference-liveblogging-performance-guide-for-mysql-cluster-tuesday-1050am%2F&amp;title=MySQL%20Conference%20Liveblogging%3A%20Performance%20Guide%20For%20MySQL%20Cluster%20%28Tuesday%2010%3A50AM%29" id="wpa2a_12"><img
src="http://beerpla.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded> <wfw:commentRss>http://beerpla.net/2008/04/15/mysql-conference-liveblogging-performance-guide-for-mysql-cluster-tuesday-1050am/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
