<?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>Mozilla Web Development &#187; Graph Server</title>
	<atom:link href="http://blog.mozilla.com/webdev/category/graph-server/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mozilla.com/webdev</link>
	<description>Everybody Likes Ninjas</description>
	<lastBuildDate>Wed, 01 Feb 2012 16:41:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Introducing Perf-O-Matic 2.0</title>
		<link>http://blog.mozilla.com/webdev/2011/02/04/perfomatic2-0/</link>
		<comments>http://blog.mozilla.com/webdev/2011/02/04/perfomatic2-0/#comments</comments>
		<pubDate>Fri, 04 Feb 2011 23:08:30 +0000</pubDate>
		<dc:creator>rhelmer</dc:creator>
				<category><![CDATA[Graph Server]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://blog.mozilla.com/webdev/?p=1491</guid>
		<description><![CDATA[Here&#8217;s a quick transcript of the video: Hello, this is Rob Helmer from the Mozilla WebDev team. I&#8217;m here to introduce a project we&#8217;ve been working on for the past few months: Perf-O-Matic 2.0 Perf-O-Matic is the web application we use to display Firefox performance data. Every time a developer &#8220;checks in&#8221; a change to [...]]]></description>
			<content:encoded><![CDATA[<pre>
<video width="480" height="390" controls>
  <source src="http://people.mozilla.org/~rhelmer/perfomatic2_0v4.mov" type="video/mp4" />
  <source src="http://people.mozilla.org/~rhelmer/perfomatic2_0v4.webm" type="video/webm" />
  <source src="http://people.mozilla.org/~rhelmer/perfomatic2_0v4.mp4" type="video/mp4" />
  <source src="http://people.mozilla.org/~rhelmer/perfomatic2_0v4.theora.ogv" type="video/ogg" />
  <iframe title="YouTube video player" width="480" height="390" src="http://www.youtube.com/embed/QuUjMB81Bn8" frameborder="0" allowfullscreen></iframe>
</video>
</pre>
<p>Here&#8217;s a quick transcript of the video:</p>
<p><span id="more-1491"></span></p>
<p>Hello, this is Rob Helmer from the Mozilla WebDev team.<br />
I&#8217;m here to introduce a project  we&#8217;ve been working on<br />
for the past few months: Perf-O-Matic 2.0</p>
<p>Perf-O-Matic is the web application we use to display Firefox performance<br />
data. Every time a developer &#8220;checks in&#8221; a change to Firefox, a fleet of<br />
machines runs the browser through a battery of tests to measure performance.</p>
<p>These tests range from startup/shutdown performance, the time it takes to<br />
load a web page, and browser benchmark suites like WebKit&#8217;s SunSpider,<br />
Mozilla&#8217;s Kraken, and Google&#8217;s V8 Benchmark.</p>
<p>Perf-O-Matic 2.0 features a new, streamlined interface, designed by Chris Howse.</p>
<p>This is the dashboard, which allows for a quick overview of popular tests.</p>
<p>Clicking on any graph in the dashboard brings us to the<br />
&#8220;Custom Chart&#8221; screen. The graph is interactive &#8211; hover over any point<br />
to get a tooltip with more information about this test result. Every<br />
test result will have an associate changeset id in mercurial,<br />
which links to more information about what changes the developer made.</p>
<p>The toolbar of the &#8220;Custom Chart&#8221; screen allows us to select date range,<br />
data type (running time, time delta, time delta %), zoom in and out,<br />
and you can even show all changesets for a highlighted range.</p>
<p>The &#8220;Link&#8221; button gives a quick link to the chart you&#8217;re looking at.<br />
&#8220;Embed&#8221; gives you some HTML code you can use if you want to display<br />
interactive graphs on your own site. I&#8217;ll give a quick demo of this.<br />
Here&#8217;s an embedded, interactive chart; this is inspired by <a href="http://arewefastyet.com">arewefastyet.com</a>.</p>
<p>On the left, we have information about the currently loaded<br />
data series &#8211; SunSpider benchmark for Firefox on Windows 5.1. Each point on<br />
the graph is actually an average of several test machine runs, so we can<br />
&#8220;explode&#8221; the data series to see the raw, individual data. Clicking again<br />
will &#8220;implode&#8221; the data, showing us the more human-readable average.</p>
<p>Finally, more test data can be added, for making direct visual comparisons<br />
between multiple data series. You can multi-select here, to get multiple data series at once.</p>
<p>This project builds on the work of many others, including (but not limited to):<br />
vlad<br />
rdoherty<br />
anode<br />
ianbicking<br />
many, many others on the graphserver side</p>
<p>We also received valuable early design review and feedback from jonath, rsayre, eshan, and many others.</p>
<p>Perf-O-Matic uses many existing open-source projects, such as python, flot, and node.js</p>
<p>Perf-O-Matic 2.0 is being staged for testing.<br />
We&#8217;ve got a handful of known bugs, and we need your help to find the rest.</p>
<p>Please try it out at:<br />
<a href="http://graphs-stage2.mozilla.org">http://graphs-stage2.mozilla.org</a></p>
<p>You can find more information on the Perf-O-Matic UI wiki page, including links to mercurial and github:<br />
<a href="https://wiki.mozilla.org/Perfomatic:UI">https://wiki.mozilla.org/Perfomatic:UI</a><!--more--></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mozilla.com/webdev/2011/02/04/perfomatic2-0/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
<enclosure url="http://people.mozilla.org/~rhelmer/perfomatic2_0v4.webm" length="14275994" type="video/webm" />
<enclosure url="http://people.mozilla.org/~rhelmer/perfomatic2_0v4.mp4" length="7231452" type="video/mp4" />
<enclosure url="http://people.mozilla.org/~rhelmer/perfomatic2_0v4.mov" length="200" type="video/quicktime" />
		</item>
		<item>
		<title>Native JSON in Firefox 3.1</title>
		<link>http://blog.mozilla.com/webdev/2009/02/12/native-json-in-firefox-31/</link>
		<comments>http://blog.mozilla.com/webdev/2009/02/12/native-json-in-firefox-31/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 17:28:42 +0000</pubDate>
		<dc:creator>Ryan Doherty</dc:creator>
				<category><![CDATA[Graph Server]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://blog.mozilla.com/webdev/?p=222</guid>
		<description><![CDATA[In case you haven&#8217;t heard, one of Firefox 3.1&#8242;s awesome new features will be native JSON support. This is totally sweet for two reasons: eval&#8217;ing JSON in the browser is unsafe. Using native JSON parsing protects you against possible code execution. Safely eval&#8217;ing JSON with a 3rd party library can be orders of magnitude slower. [...]]]></description>
			<content:encoded><![CDATA[<p>In case you haven&#8217;t heard, one of Firefox 3.1&#8242;s awesome new features will be <a href="https://developer.mozilla.org/En/Using_JSON_in_Firefox">native JSON</a> support. This is totally sweet for two reasons:</p>
<ol>
<li>eval&#8217;ing JSON in the browser is <a href="http://yuiblog.com/blog/2007/04/10/json-and-browser-security/">unsafe</a>. Using native JSON parsing protects you against possible code execution.</li>
<li>Safely eval&#8217;ing JSON with a 3rd party library can be orders of magnitude <a href="http://starkravingfinkle.org/blog/2008/02/extension-developers-native-json-parsing/">slower</a>. Native JSON parsing is much faster.</li>
</ol>
<p>How does native JSON work compared to plain old eval? Simple:</p>
<pre>var jsonString = '{"name":"Ryan", "address":"Mountain View, CA"}';
var person = JSON.parse(jsonString);
// 'person' is now a JavaScript object with 2 properties; name and address</pre>
<p>Pretty easy huh? And here&#8217;s how to get a JSON string from an object:</p>
<pre>var personString = JSON.stringify(person);
// 'personString' now holds the string '{"name":"Ryan", "address":"Mountain View, CA"}'</pre>
<p>&#8220;But wait!&#8221;, you say. &#8220;How is it safer? How much faster is it compared to eval?&#8221;. Ok, I&#8217;ll show you.</p>
<p>Native JSON parsing in Firefox 3.1 is safer because it does not support objects with functions. Attempting to convert an object with functions into a JSON string will only convert its properties and not its functions. And any malformed JSON string will result in a parse error instead of possible code execution.</p>
<p>Now, regarding speed, native JSON parsing is faster, <strong>much</strong> faster. Instead of pretty charts and graphs, I&#8217;ll give you a real-world example.</p>
<p>The <a href="http://graphs-stage2.mozilla.org/graph.html">new Graph Server</a> uses a JSON API to fetch test information and results, so I figured it would be a good application to benchmark. So I wrapped our code that parses the JSON response with some Firebug profiler calls:</p>
<pre>    console.time('parsejson');
    var obj = eval('(' + resp + ')');
    console.timeEnd('parsejson');</pre>
<p>Loading a test&#8217;s results (array with 3,000 indexes, 24k gzipped) gave me a time of 125ms. (Repeated tests yielded results +/- 5ms). Then I changed eval to JSON.parse:</p>
<pre>    console.time('parsejson');
    var obj = JSON.parse(resp);
    console.timeEnd('parsejson');</pre>
<p>Which resulted in an average time of 40ms! That&#8217;s about 2.7 times faster with 1 line of code changed. Not bad!</p>
<p>Granted, a difference of 80ms isn&#8217;t that much, but in an AJAX (or, more accurately, AJAJ?) application, it can add up.</p>
<p>What&#8217;s the use of native JSON if it&#8217;s only available in Firefox? Luckily, IE8 has implemented it in RC1, which is rumored to be released in March. Hopefully other browsers will follow suit too, but for now it&#8217;s best to use a JSON parser such as the one on <a href="http://www.json.org/js.html">json.org</a>. It&#8217;s small, safe and will not override native JSON implementation if detected.</p>
<p>Points to remember:</p>
<ul>
<li>Plain old eval is unsafe (especially if you don&#8217;t trust the source), use a JSON library to protect yourself.</li>
<li>Use native JSON when available.</li>
<li>Bug other <a href="http://webkit.org/">browser</a> <a href="http://www.opera.com/">vendors</a> to implement native JSON</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.mozilla.com/webdev/2009/02/12/native-json-in-firefox-31/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Graph Server Re-Write</title>
		<link>http://blog.mozilla.com/webdev/2009/02/06/graph-server-rewrite/</link>
		<comments>http://blog.mozilla.com/webdev/2009/02/06/graph-server-rewrite/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 18:12:24 +0000</pubDate>
		<dc:creator>Ryan Doherty</dc:creator>
				<category><![CDATA[Graph Server]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://blog.mozilla.com/webdev/?p=204</guid>
		<description><![CDATA[Over the past few months the Graph Server team and I have been hard at work re-writing the back end for the Graph Server and it&#8217;s finally come to fruition. For those that don&#8217;t know, the Graph Server is used to display performance test data of Firefox builds reported by Talos. Our work initially started [...]]]></description>
			<content:encoded><![CDATA[<p>Over the past few months the <a href="https://wiki.mozilla.org/Perfomatic#People">Graph Server team</a> and I have been hard at work re-writing the back end for the <a href="http://graphs.mozilla.org">Graph Server</a> and it&#8217;s finally come to fruition. </p>
<p>For those that don&#8217;t know, the Graph Server is used to display performance test data of Firefox builds reported by <a href="https://wiki.mozilla.org/Buildbot/Talos">Talos</a>.</p>
<p><img src="http://people.mozilla.org/~rdoherty/graph-server.jpg" width="450" height="317" alt="Graph Server screenshot" /></p>
<p>Our work initially started as performance improvements and some new features, but the more we worked with the old architecture, it became quite apparent it would not scale (performance and feature-wise). </p>
<p>The old database schema duplicated test data in multiple tables and stored similar, but different data in the same tables. Tables had ballooned to millions (and billions) of rows that were queried for basic information such as all unique test names, resulting in queries that ran forever. And the queries that did finish were looped over in JavaScript to pull out test information, resulting in the browser locking up because it was looping over hundreds of thousands of rows.</p>
<p>If it&#8217;s not clear already, one of main issues was with the database schema; it needed to be normalized.</p>
<p>Here&#8217;s the old, non-normalized schema:</p>
<p><a href="http://people.mozilla.org/~rdoherty/old-schema.png"><img src="http://people.mozilla.org/~rdoherty/old-schema-small.gif" width="450" height="199" alt="Old Graph Server schema" /></a></p>
<p>And here&#8217;s the new, normalized schema after the team was locked in a room for an afternoon:</p>
<p><a href="https://wiki.mozilla.org/images/d/d2/Graph_server_new_db_schema2.png"><img src="http://people.mozilla.org/~rdoherty/graph-server-new.jpg" width="450" height="294" alt="New Graph Server schema" /></a></p>
<p><strong>Much</strong> cleaner, no duplicated data, easy to understand the various machines, branches and tests that are used for displaying test data. No need look at entire tables to find basic information such as test names.</p>
<p>With this new schema in place, it also required a re-write of our server-side scripts we use to fetch test information for the front end graphing component. Since Mozilla is as open as possible, instead of just changing what was needed, I decided to implement a <a href="https://wiki.mozilla.org/Perfomatic:API">JSON API</a> that would allow anyone to easily retrieve test data.</p>
<p>Lastly, our Talos <--> Graph Server communication needed to be re-written. Lars rewrote the collector script that accepts values from Talos and Alice rewrote the pieces of Talos that send data to the Graph Server.</p>
<p>After all that work, we now have a <a href="http://graphs-stage2.mozilla.org/graph.html">working stage server</a> (Firefox 3.1 or higher required due to native JSON requirement) with our new code. We have a bit more testing and some performance benchmarking to do before it goes live, but we&#8217;re happy that all the pieces are working. </p>
<p>Want to know more? We have a wiki page with more information at <a href="https://wiki.mozilla.org/Perfomatic#Rearchitecture">https://wiki.mozilla.org/Perfomatic#Rearchitecture</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mozilla.com/webdev/2009/02/06/graph-server-rewrite/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

