<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Experiment on bramp.net</title>
    <link>https://blog.bramp.net/</link>
    <description>Recent content in Experiment on bramp.net</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-GB</language>
    <lastBuildDate>Fri, 04 Dec 2009 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://blog.bramp.net/tags/experiment/" rel="self" type="application/rss+xml" />
    
    <item>
      <title>Google DNS Benchmarked</title>
      <link>https://blog.bramp.net/post/2009/12/04/google-dns-benchmarked/</link>
      <pubDate>Fri, 04 Dec 2009 00:00:00 +0000</pubDate>
      
      <guid>https://blog.bramp.net/post/2009/12/04/google-dns-benchmarked/</guid>
      <description><p>Today <a href="http://googleblog.blogspot.com/2009/12/introducing-google-public-dns.html">Google announced</a> a public DNS service they are hosting. They claim that their DNS infrastructure is <a href="http://code.google.com/speed/public-dns/docs/performance.html">faster and more secure</a>, because their servers do some clever things. I wanted to test their performance claims, so I wrote a <a href="dns.php">little script</a> to measure a lookup times for different domains across a number of DNS servers.</p>
<h3 id="methodology">Methodology</h3>
<p>Firstly I found a <a href="http://www.quantcast.com/top-sites-1">list of the 1 million most popular sites</a>. I then picked a number of DNS servers to test against. I chose <a href="http://code.google.com/speed/public-dns/">Google</a>‘s, <a href="http://www.opendns.com/">OpenDNS</a>‘s, my ISP (<a href="http://broadband.sky.com/">Sky/Easynet</a>) and my old ISP’s (<a href="http://www.plus.net/">Plus.net</a>).</p>
<p>I decided I would query an <a href="http://en.wikipedia.org/wiki/List_of_DNS_record_types">A record</a> for each of the domains in the list, one at a time, starting with the most popular. I would query each server three times for the same domain name. The ordering was like this:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-php" data-lang="php"><span class="line"><span class="cl"><span class="k">foreach</span> <span class="p">(</span><span class="nx">domain</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">   <span class="k">for</span> <span class="p">(</span><span class="nx">i</span> <span class="o">=</span><span class="mi">0</span><span class="p">;</span> <span class="nx">i</span><span class="o">&lt;</span><span class="mi">3</span><span class="p">;</span><span class="nx">i</span><span class="o">++</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">      <span class="k">foreach</span> <span class="p">(</span><span class="nx">server</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">         <span class="nx">query</span><span class="p">(</span><span class="nx">server</span><span class="p">,</span> <span class="nx">domain</span><span class="p">)</span>
</span></span></code></pre></div><p>I recorded the time it took for each query to be answered, and I also recorded the replies. I was curious to see if some servers replied with different answers, or if some returned more information, i.e. additional records.</p>
<p>I <a href="dns.php">wrote a script</a> in PHP 5.3, and ran it from the command line on my Windows Server 2008 machine. The script used PEAR&rsquo;s Net_DNS to craft and send the DNS questions. I was not using my operating system&rsquo;s resolver, and I was not using any form of client side caching. I ran the experiments from my home ADSL connection and as far as I know my ISP was not interfering with my DNS requests in any way. I live in the North West of the UK.</p>
<h3 id="results">Results</h3>
<p>After letting this run for a few hours, and querying roughly the top 10,000 domains, I have some preliminary results.</p>















<table class="table">
  <thead>
      <tr>
          <th>DNS Server</th>
          <th class="text- center">Min (ms)</th>
          <th class="text- center">Max (ms)</th>
          <th class="text- center">Median</th>
          <th class="text- center">Mean (ms)</th>
          <th class="text- center">Standard Dev (ms)</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Google A (8.8.8.8)</td>
          <td class="text- center">38.50</td>
          <td class="text- center">4932</td>
          <td class="text- center">42.45</td>
          <td class="text- center">122.8</td>
          <td class="text- center">181.6</td>
      </tr>
      <tr>
          <td>Google B (8.8.4.4)</td>
          <td class="text- center">38.65</td>
          <td class="text- center">4927</td>
          <td class="text- center">41.84</td>
          <td class="text- center">94.52</td>
          <td class="text- center">154.8</td>
      </tr>
      <tr>
          <td>OpenDNS A (208.67.222.222)</td>
          <td class="text- center">29.77</td>
          <td class="text- center">4035</td>
          <td class="text- center">31.87</td>
          <td class="text- center">74.37</td>
          <td class="text- center">115.4</td>
      </tr>
      <tr>
          <td>OpenDNS B (208.67.220.220)</td>
          <td class="text- center">29.76</td>
          <td class="text- center">1171</td>
          <td class="text- center">31.82</td>
          <td class="text- center">35.28</td>
          <td class="text- center">32.4</td>
      </tr>
      <tr>
          <td>Easynet A (90.207.238.97)</td>
          <td class="text- center">33.90</td>
          <td class="text- center">2578</td>
          <td class="text- center">61.29</td>
          <td class="text- center">105.2</td>
          <td class="text- center">103.7</td>
      </tr>
      <tr>
          <td>Easynet B (90.207.238.99)</td>
          <td class="text- center">33.65</td>
          <td class="text- center">4253</td>
          <td class="text- center">44.96</td>
          <td class="text- center">96.11</td>
          <td class="text- center">104.8</td>
      </tr>
      <tr>
          <td>Plusnet A (212.159.11.150)</td>
          <td class="text- center">43.78</td>
          <td class="text- center">4423</td>
          <td class="text- center">52.56</td>
          <td class="text- center">100.8</td>
          <td class="text- center">156.5</td>
      </tr>
      <tr>
          <td>Plusnet B (212.159.13.150)</td>
          <td class="text- center">38.87</td>
          <td class="text- center">4991</td>
          <td class="text- center">42.76</td>
          <td class="text- center">90.78</td>
          <td class="text- center">169.1</td>
      </tr>
  </tbody>
</table>

<p>From this table of results, we can see that Google&rsquo;s median response time is 41-42ms, however, OpenDNS performs much better with a result of ~31ms. Both my current ISP and my old ISP don&rsquo;t perform as well and each achieved a result between 42ms and 61ms. To get a better feel for the data I plotted an empirical CDF of the lookup times for each server.</p>
<p><a href="ecdf_overview.pdf"><figure><img src="/post/2009/12/04/google-dns-benchmarked/ecdf_overview.png" width="700" height="700"><figcaption>
      <h4>Click for a larger PDF version</h4>
    </figcaption>
</figure>
</a></p>
<p>The first impression I can make from this CDF is that OpenDNS serves far more of the queries faster than anyone else. Secondly the secondary DNS servers all seem to be faster than their primaries. I suspect this is because most hosts query the primary, and rarely query the secondary. I even read that <a href="https://www.isc.org/software/bind">BIND</a> (a popular DNS server) has/had <a href="http://homepages.tesco.net/J.deBoynePollard/FGA/dns-database-replication.html">a bug in it which favoured the primary DNS</a>.</p>
<p>The minimum lookup time for each pair of DNS servers seems to be the same, most likely caused by the network latency between me and the servers. Even so, if we normalise all the data by taking the servers&rsquo; minimum value away from each sample, we still find that OpenDNS performs better than Google, and Google performs slightly better than Plus.net and quite a bit better than my current ISP, Easynet.</p>
<p>Rather worryingly is that the latency to OpenDNS is smaller than the latency to my own ISP&rsquo;s DNS servers. This makes me wonder where the hell my ISP hosts their DNS servers. Also, the ~38ms minimum time with Google indicates that at least some of their DNS servers are hosted in Europe, and possibly the UK.</p>
<p>SInce I ran each lookup three times, I wanted to compare the lookup times for each request. This time I plotted the empirical CDF of each iteration of request.</p>
<p><a href="ecdf_requests.pdf"><figure><img src="/post/2009/12/04/google-dns-benchmarked/ecdf_requests.png" width="700" height="700"><figcaption>
      <h4>Click for a larger PDF version</h4>
    </figcaption>
</figure>
</a></p>
<p>This CDF seems to show that the 2nd and 3rd requests always get served quicker than the first. In most cases the 2nd and 3rd request have equal ranking, but the first is always slow. This could easily be attributed to the fact that the caching DNS server does not have the record in its cache, and thus must be fetched. The second time I request the domain name (only moments later), the server already has the query, and most likely has it stored in RAM or L1/L2 CPU cache.</p>
<p>OpenDNS_B seems to respond equally quick for the first, second and third request. This could be because I would always query OpenDNS_A first, then move on to B. If A and B were actually the same machine, it would be like sending 6 requests to the machine instead of 3. Therefore, B&rsquo;s 1st request is actually its second. Even if A and B were different machines, there could be some clever replication, or shared caching going on to cause this behaviour.</p>
<p>Finally, I&rsquo;m surprised that the 2nd and 3rd requests are slower, especially since I&rsquo;m requesting the most popular domain names. Surely others would have already requested the domain name, and thus the DNS server has no need to fetch it. Looking through the list of domain names I see that none of them have the www prefix. I personally never type the www and just hope the site works, but perhaps many users do. Maybe I should re-run the experiment with the www prefix.</p>
<h3 id="conclusion">Conclusion</h3>
<p>For now I would stick to using OpenDNS, as this is clearly the winner. However, the Google DNS service is very new, so perhaps the servers haven&rsquo;t had enough time to fill their caches, and their admins haven&rsquo;t had enough time to tweak them. I will perhaps rerun this experiment in a few weeks and see what happens.</p>
<h3 id="todo">TODO</h3>
<p>I still have some analysis to do, for example, looking at packet loss, the type of records returned, and anything else I can think of.</p>
</description>
    </item>
    
    <item>
      <title>Power Consumption</title>
      <link>https://blog.bramp.net/post/2009/10/26/power-consumption/</link>
      <pubDate>Mon, 26 Oct 2009 00:00:00 +0000</pubDate>
      
      <guid>https://blog.bramp.net/post/2009/10/26/power-consumption/</guid>
      <description><p>I have mentioned many times that I would like to know how much current something is drawing, so today Nic brought me a mains power meter. It is a very simple meter which plugs between the mains and the device and can measure volts, amps, watts, frequency, and a few other metrics. I decided to run around my house measuring everything I could.</p>
<h3 id="methodology">Methodology</h3>
<p>A couple notes about my methodology, firstly, I was very lazy in my measurement taking. I repeated some of the measurements, but not all. However, when I did repeat the measurements they always seem to have the same value, so this discouraged me from repeating.</p>
<p>To test a device I would plug the meter between it and the mains electricity and give it a some time to settle. Once settled I would take the reading. Sometimes the reading would flicker between two values, in these cases I took the higher of the two. Finally, I noticed that after I turned the devices off the meter would always read 8W. Either the meter was unable to read less than 8W, or zero was not calibrated correctly on the meter.</p>
<p>All these measurements were taken in my house in the UK, which according to my meter has mains electricity at 248V and at a AC frequency of 59.9Hz</p>
<h3 id="results">Results</h3>















<table class="table">
  <thead>
      <tr>
          <th>Device (status)</th>
          <th class="text- center">Power Usage (watts)</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>xTune Speakers (standby)</td>
          <td class="text- center">24W</td>
      </tr>
      <tr>
          <td>xTune Speakers (on no music)</td>
          <td class="text- center">25W</td>
      </tr>
      <tr>
          <td>xTune Speakers (on vol30)</td>
          <td class="text- center">25W</td>
      </tr>
      <tr>
          <td>xTune Speakers (on vol60)</td>
          <td class="text- center">50W</td>
      </tr>
      <tr>
          <td> </td>
          <td class="text- center"></td>
      </tr>
      <tr>
          <td>TFT Monitor 15″ (standby)</td>
          <td class="text- center">11W</td>
      </tr>
      <tr>
          <td>TFT Monitor 15″ (on)</td>
          <td class="text- center">27W</td>
      </tr>
      <tr>
          <td> </td>
          <td class="text- center"></td>
      </tr>
      <tr>
          <td>TFT Monitor 17″ (standby)</td>
          <td class="text- center">9W</td>
      </tr>
      <tr>
          <td>TFT Monitor 17″ (on)</td>
          <td class="text- center">38W</td>
      </tr>
      <tr>
          <td> </td>
          <td class="text- center"></td>
      </tr>
      <tr>
          <td>Nic’s laptop (web browsing)</td>
          <td class="text- center">35W</td>
      </tr>
      <tr>
          <td>Nic’s laptop (playing game)</td>
          <td class="text- center">59W</td>
      </tr>
      <tr>
          <td> </td>
          <td class="text- center"></td>
      </tr>
      <tr>
          <td>xbox 360 (standby)</td>
          <td class="text- center">10W</td>
      </tr>
      <tr>
          <td>xbox 360 (dashboard)</td>
          <td class="text- center">150W</td>
      </tr>
      <tr>
          <td>xbox 360 (game)</td>
          <td class="text- center">158W</td>
      </tr>
      <tr>
          <td> </td>
          <td class="text- center"></td>
      </tr>
      <tr>
          <td>Sky+ Box (standby)</td>
          <td class="text- center">20W</td>
      </tr>
      <tr>
          <td>Sky+ Box (on)</td>
          <td class="text- center">29W</td>
      </tr>
      <tr>
          <td> </td>
          <td class="text- center"></td>
      </tr>
      <tr>
          <td>Wii (standby – red light)</td>
          <td class="text- center">9W</td>
      </tr>
      <tr>
          <td>Wii (on)</td>
          <td class="text- center">24W</td>
      </tr>
      <tr>
          <td> </td>
          <td class="text- center"></td>
      </tr>
      <tr>
          <td>TV (standby)</td>
          <td class="text- center">9W</td>
      </tr>
      <tr>
          <td>TV (on)</td>
          <td class="text- center">95W</td>
      </tr>
      <tr>
          <td> </td>
          <td class="text- center"></td>
      </tr>
      <tr>
          <td>Kettle</td>
          <td class="text- center">2300W</td>
      </tr>
      <tr>
          <td> </td>
          <td class="text- center"></td>
      </tr>
      <tr>
          <td>My PC (off)</td>
          <td class="text- center">10W</td>
      </tr>
      <tr>
          <td>My PC (booting during POST)</td>
          <td class="text- center">230W</td>
      </tr>
      <tr>
          <td>My PC (booting)</td>
          <td class="text- center">130W</td>
      </tr>
      <tr>
          <td>My PC (idle – Windows)</td>
          <td class="text- center">128W</td>
      </tr>
      <tr>
          <td>My PC (game)</td>
          <td class="text- center">154W</td>
      </tr>
      <tr>
          <td>My PC (1 core prime #)</td>
          <td class="text- center">142W</td>
      </tr>
      <tr>
          <td>My PC (2 core prime #)</td>
          <td class="text- center">152W</td>
      </tr>
      <tr>
          <td>My PC (3 core prime #)</td>
          <td class="text- center">160W</td>
      </tr>
      <tr>
          <td>My PC (4 core prime #)</td>
          <td class="text- center">163W</td>
      </tr>
      <tr>
          <td>My PC (sleep)</td>
          <td class="text- center">13W</td>
      </tr>
      <tr>
          <td>My PC (idle – Linux)</td>
          <td class="text- center">150W</td>
      </tr>
  </tbody>
</table>

<p>Some observations I made about these results:</p>
<ul>
<li>My speakers use the same amount of power playing music as when they aren’t. I assume this is because the amps in them are always trying to amplify the signal.</li>
<li>My Sky+ box is pretty poor at conserving power. I found this interesting because Sky made a big deal about the Sky box automatically turning off at night. It even advertises this fact in big letters on the side of the packaging.</li>
<li>My PC which has a 800W power supply, with a quad core Intel, 4GB of RAM, and 6 harddrives, obviously doesn’t need 800W of power. The peak value, which I found during POST, was only 230W, with it idling (in Windows) at 128W.</li>
<li>Linux uses more power than Windows! This is using the latest Debian testing (2.6.30-8), and Windows Server 2008. Clearly, Linux has less energy efficient drivers, or is not powering something down that Windows is.</li>
</ul>
</description>
    </item>
    
  </channel>
</rss>
