<?xml version="1.0" encoding="utf-8"?>
<!-- If you are running a bot please visit this policy page outlining rules you must respect. http://www.livejournal.com/bots/ -->
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:lj="http://www.livejournal.com">
  <id>urn:lj:livejournal.com:atom1:four</id>
  <title>ryah</title>
  <subtitle>ryah</subtitle>
  <author>
    <name>ryah</name>
  </author>
  <link rel="alternate" type="text/html" href="http://four.livejournal.com/"/>
  <link rel="self" type="text/xml" href="http://four.livejournal.com/data/atom"/>
  <updated>2009-11-21T16:00:59Z</updated>
  <lj:journal userid="1329" username="four" type="personal"/>
  <link rel="service.feed" type="application/x.atom+xml" href="http://four.livejournal.com/data/atom" title="ryah"/>
  <link rel="hub" href="http://pubsubhubbub.appspot.com/"/>
  <entry>
    <id>urn:lj:livejournal.com:atom1:four:1033160</id>
    <link rel="alternate" type="text/html" href="http://four.livejournal.com/1033160.html"/>
    <link rel="self" type="text/xml" href="http://four.livejournal.com/data/atom/?itemid=1033160"/>
    <title>New HTTP Parser</title>
    <published>2009-11-21T15:42:58Z</published>
    <updated>2009-11-21T16:00:59Z</updated>
    <content type="html">I've implemented a new HTTP/1.1 request and response parser by hand. (My previous parser was written with the help of Ragel.) It requires 124 bytes per HTTP connection, makes zero allocations, has no dependencies, is nearly optimal in its use of CPU instructions, interruptible on any character, has &lt;a href="http://github.com/ry/http-parser/blob/v0.3/test.c#L79"&gt;extensive tests&lt;/a&gt;, and is MIT licensed.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://github.com/ry/http-parser/blob/v0.3/README.md"&gt;README&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://github.com/ry/http-parser/blob/v0.3/http_parser.h"&gt;http_parser.h&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://github.com/ry/http-parser/blob/v0.3/http_parser.c"&gt;http_parser.c&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(Only one user at the moment: &lt;a href="http://github.com/ry/node/commit/7719ce33db2a68f65f1bed58faece83a2342c7c3"&gt;I've just merged it into Node.&lt;/a&gt;)</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:four:1032726</id>
    <link rel="alternate" type="text/html" href="http://four.livejournal.com/1032726.html"/>
    <link rel="self" type="text/xml" href="http://four.livejournal.com/data/atom/?itemid=1032726"/>
    <title>UC tuition</title>
    <published>2009-11-19T21:01:15Z</published>
    <updated>2009-11-19T21:01:15Z</updated>
    <content type="html">&lt;a href="http://www.nytimes.com/2009/11/20/education/20tuition.html"&gt;http://www.nytimes.com/2009/11/20/education/20tuition.html&lt;/a&gt;&lt;blockquote&gt;The University of California Board of Regents was expected to approve a plan on Thursday to raise undergraduate fees — the equivalent of tuition — 32 percent by next fall, to help make up for steep cuts in state funding.&lt;br /&gt;&lt;br /&gt;[...]&lt;br /&gt;&lt;br /&gt;Since the school year began, thousands of students have protested both the budget cuts and the proposal for higher fees, &lt;em&gt;which would bring in-state tuition to more than $10,000 a year&lt;/em&gt;. On Wednesday 14 protesters, including 12 students, were arrested at U.C.L.A., for disrupting the meeting of the Regents Finance Committee, which was eventually closed to visitors.&lt;/blockquote&gt;</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:four:1028595</id>
    <link rel="alternate" type="text/html" href="http://four.livejournal.com/1028595.html"/>
    <link rel="self" type="text/xml" href="http://four.livejournal.com/data/atom/?itemid=1028595"/>
    <title>working on presentation</title>
    <published>2009-11-01T08:18:15Z</published>
    <updated>2009-11-01T08:30:37Z</updated>
    <category term="screenshot"/>
    <content type="html">&lt;a href="http://s3.amazonaws.com/four.livejournal/20091101/screenshot.png"&gt;&lt;img src="http://s3.amazonaws.com/four.livejournal/20091101/screenshot-small.png"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;i hate beamer, but what else is there?</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:four:1026710</id>
    <link rel="alternate" type="text/html" href="http://four.livejournal.com/1026710.html"/>
    <link rel="self" type="text/xml" href="http://four.livejournal.com/data/atom/?itemid=1026710"/>
    <title>anvil shooting</title>
    <published>2009-10-25T22:08:32Z</published>
    <updated>2009-10-25T22:08:32Z</updated>
    <content type="html">&lt;lj-embed id="31" /&gt;</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:four:1026200</id>
    <link rel="alternate" type="text/html" href="http://four.livejournal.com/1026200.html"/>
    <link rel="self" type="text/xml" href="http://four.livejournal.com/data/atom/?itemid=1026200"/>
    <title>Smart Vanpool</title>
    <published>2009-10-25T20:02:57Z</published>
    <updated>2009-10-27T09:00:54Z</updated>
    <category term="idea"/>
    <content type="html">&lt;a href="http://en.wikipedia.org/wiki/Fuel_efficiency_in_transportation"&gt;Vans are energy efficent when filled with 6 people, more so than any form of rail or bus transportation.&lt;/a&gt; (link &lt;a href="http://easwaran.livejournal.com/492466.html"&gt;via&lt;/a&gt; &lt;span class='ljuser ljuser-name_easwaran' lj:user='easwaran' style='white-space: nowrap;'&gt;&lt;a href='http://easwaran.livejournal.com/profile'&gt;&lt;img src='http://l-stat.livejournal.com/img/userinfo.gif' alt='[info]' width='17' height='17' style='vertical-align: bottom; border: 0; padding-right: 1px;' /&gt;&lt;/a&gt;&lt;a href='http://easwaran.livejournal.com/'&gt;&lt;b&gt;easwaran&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;.) It seems creating an intellgent network of vans could be a good means of public transport. There are many factors involved, but it is imaginable that such a vanpool could be made profitable for the operators (not require city subsidies) and affordable for average people (vastly cheaper than a private taxi). I imagine vans with drivers, routed by a UMTS-capable navigation system to drop and pick-up passengers. The passengers request pick-ups via a telephone operator or website. They give a destination, and are given various choices of pick-up location&amp;mdash;the ones more convenient for the vans in rotation will cost less, off-route locations cost more, short wait-times are more expensive, longer wait-times are cheaper. Passengers can be made to make transfers to other vans going in their direction. Perhaps instructions are sent to the passenger via SMS ("Get out at the next stop, wait 5 minutes for van 45"). The implementation of this is difficult, but tractable. It's certainly not on the same order of cost as installing light-rail infrastructure. Probably, a smart-vanshare program could be implemented with several millions of dollars&amp;mdash;which is nothing when compared to digging tunnels for subway systems. Furthermore, the software development is a one-time cost, the system can be extended to other cities by simply adding vans, drivers, and telephone operators.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:four:1025754</id>
    <link rel="alternate" type="text/html" href="http://four.livejournal.com/1025754.html"/>
    <link rel="self" type="text/xml" href="http://four.livejournal.com/data/atom/?itemid=1025754"/>
    <title>nginx_http_push_module</title>
    <published>2009-10-16T11:51:34Z</published>
    <updated>2009-10-16T12:04:56Z</updated>
    <category term="sweetcode"/>
    <content type="html">http://github.com/slact/nginx_http_push_module 

&lt;blockquote&gt;Nginx HTTP push module - Turn nginx into a long-polling message queuing HTTP push server.
&lt;br&gt;&lt;br&gt;
If you want a long-polling server but don't want to wait on idle connections 
via upstream proxies or make your applications totally asynchronous, use 
this module to have nginx accept and hold long-polling client connections. 
Send responses to those clients by sending an HTTP request to a different 
location.&lt;/blockquote&gt; (I wish I had thought of this!)</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:four:1025019</id>
    <link rel="alternate" type="text/html" href="http://four.livejournal.com/1025019.html"/>
    <link rel="self" type="text/xml" href="http://four.livejournal.com/data/atom/?itemid=1025019"/>
    <title>Pro-Köln</title>
    <published>2009-10-08T19:56:28Z</published>
    <updated>2009-10-08T20:07:52Z</updated>
    <category term="nazis"/>
    <content type="html">I forgot to post about our own local nazis. These posters were seen depressingly often in Cologne during the recent election:&lt;br /&gt;&lt;br /&gt;&lt;img src="http://www.pro-koeln-online.de/plakate/plakat01klein.jpg"&gt;&lt;br /&gt;&lt;br /&gt;"The Mayor AGAINST the Mosque!"&lt;br /&gt;"He's for you!"&lt;br /&gt;&lt;br /&gt;&lt;img src="http://calito89.files.wordpress.com/2009/08/pro-koln.jpg"&gt;</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:four:1024552</id>
    <link rel="alternate" type="text/html" href="http://four.livejournal.com/1024552.html"/>
    <link rel="self" type="text/xml" href="http://four.livejournal.com/data/atom/?itemid=1024552"/>
    <title>Stop / Yes to Minaret Ban</title>
    <published>2009-10-08T19:52:16Z</published>
    <updated>2009-10-08T19:52:16Z</updated>
    <category term="die schweiz"/>
    <category term="nazis"/>
    <content type="html">&lt;img src="http://www.tagesschau.de/multimedia/bilder/minarett104_v-mittel16x9.jpg"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.tagesschau.de/ausland/minarett102.html"&gt;http://www.tagesschau.de/ausland/minarett102.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.minarette.ch/"&gt;http://www.minarette.ch/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://four.livejournal.com/800085.html"&gt;previously&lt;/a&gt;</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:four:1021939</id>
    <link rel="alternate" type="text/html" href="http://four.livejournal.com/1021939.html"/>
    <link rel="self" type="text/xml" href="http://four.livejournal.com/data/atom/?itemid=1021939"/>
    <title>four @ 2009-09-19T23:59:00</title>
    <published>2009-09-19T21:58:26Z</published>
    <updated>2009-09-19T21:59:17Z</updated>
    <content type="html">&lt;a href="http://lionet.livejournal.com/42016.html"&gt;Nice benchmarks&lt;/a&gt;. Must copy. (Had no idea the TCP backlog had any effect.)</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:four:1021660</id>
    <link rel="alternate" type="text/html" href="http://four.livejournal.com/1021660.html"/>
    <link rel="self" type="text/xml" href="http://four.livejournal.com/data/atom/?itemid=1021660"/>
    <title>raphaeljs</title>
    <published>2009-09-19T13:13:31Z</published>
    <updated>2009-09-19T13:15:26Z</updated>
    <category term="sweetcode"/>
    <content type="html">&lt;a href="http://raphaeljs.com/"&gt;http://raphaeljs.com/&lt;/a&gt;&lt;br /&gt;very impressive demos&lt;br /&gt;&lt;br /&gt;i would love to write a nginx stats module which used this...</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:four:1020129</id>
    <link rel="alternate" type="text/html" href="http://four.livejournal.com/1020129.html"/>
    <link rel="self" type="text/xml" href="http://four.livejournal.com/data/atom/?itemid=1020129"/>
    <title>yabm</title>
    <published>2009-09-11T14:59:58Z</published>
    <updated>2009-09-11T14:59:58Z</updated>
    <category term="benchmark"/>
    <content type="html">I made &lt;a href="http://s3.amazonaws.com/four.livejournal/20090911/benchmark.html"&gt;a little benchmark&lt;/a&gt; this morning with Facebook's new &lt;a href="http://www.tornadoweb.org/"&gt;Tornado web server&lt;/a&gt;. (I am the only person who enjoys looking at response time histograms? I never see them elsewhere.)&lt;br /&gt;&lt;br /&gt;&lt;img src="http://s3.amazonaws.com/four.livejournal/20090911/hist300.png"&gt;</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:four:1019177</id>
    <link rel="alternate" type="text/html" href="http://four.livejournal.com/1019177.html"/>
    <link rel="self" type="text/xml" href="http://four.livejournal.com/data/atom/?itemid=1019177"/>
    <title>Combined benchmark</title>
    <published>2009-09-06T16:28:27Z</published>
    <updated>2009-09-06T18:10:23Z</updated>
    <category term="benchmark"/>
    <category term="node"/>
    <content type="html">&lt;a href="http://tinyclouds.org/node"&gt;node&lt;/a&gt; v0.1.9&lt;br /&gt;thin v1.2.1, ruby 1.8.7, em 0.12.8&lt;br /&gt;v8cgi v0.6.0, apache 2.2.8 (Ubuntu)&lt;br /&gt;narwhal/Rhino d147c160f11fdfb7f3c0763acf352b2b0e2713f7&lt;br /&gt;&lt;br /&gt;The setup is similar to the &lt;a href="http://four.livejournal.com/1018997.html"&gt;last&lt;/a&gt; &lt;a href="http://four.livejournal.com/1018026.html"&gt;two&lt;/a&gt; benchmarks. &lt;br /&gt;&lt;br /&gt;The point I want to make with these benchmarks is that Node is on the same order of magnitude in speed as production systems like EventMachine/Thin. Furthermore that at least two of the other proposed javascript systems are not on that order. &lt;br /&gt;&lt;br /&gt;I think more can be done to clean up these numbers for Node. I haven't tried to optimize anything much yet. &lt;br /&gt;&lt;a name="cutid1"&gt;&lt;/a&gt;&lt;br /&gt;&lt;b&gt;1 concurrent client&lt;/b&gt;&lt;br /&gt;completed requests:&lt;br /&gt;node 23782&lt;br /&gt;thin 22606&lt;br /&gt;v8cgi 1990&lt;br /&gt;narwhal 1234&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&amp;gt; summary(node1$ttime)
    Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
  0.0000   0.0000   1.0000   0.7437   1.0000 106.0000 

&amp;gt; summary(thin1$ttime)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  0.000   1.000   1.000   1.122   1.000  74.000 

&amp;gt; summary(narwhal1$ttime)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  15.00   22.00   23.00   23.74   24.00   88.00 

&amp;gt; summary(v8cgi1$ttime)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  12.00   13.00   13.00   14.49   18.00   39.00 
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="http://s3.amazonaws.com/four.livejournal/20090906/combined_hist_c1.png"&gt;&lt;img src="http://s3.amazonaws.com/four.livejournal/20090906/combined_ts_c1.png"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;5 concurrent clients&lt;/b&gt;&lt;br /&gt;completed requests:&lt;br /&gt;thin 36899&lt;br /&gt;node 34303&lt;br /&gt;narwhal 2553&lt;br /&gt;(v8cgi falls apart with more than one concurrent client)&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;gt; summary(node5$ttime)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   1.00    2.00    3.00    3.79    4.00  142.00 

&amp;gt; summary(thin5$ttime)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  2.000   3.000   3.000   3.633   3.000 179.000 

&amp;gt; summary(narwhal5$ttime)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  16.00   42.00   51.00   58.12   63.00 5079.00 &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="http://s3.amazonaws.com/four.livejournal/20090906/combined_hist_c5.png"&gt;&lt;img src="http://s3.amazonaws.com/four.livejournal/20090906/combined_ts_c5.png"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;30 concurrent clients&lt;/b&gt;&lt;br /&gt;completed requests:&lt;br /&gt;thin 40575 &lt;br /&gt;node 35928&lt;br /&gt;narwhal 2438&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&amp;gt; summary(node30$ttime)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   2.00   13.00   22.00   24.48   32.00  169.00 

&amp;gt; summary(thin30$ttime)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  10.00   18.00   19.00   21.64   20.00  133.00 

&amp;gt; summary(narwhal30$ttime)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  215.0   303.0   362.0   366.1   422.0   674.0 
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="http://s3.amazonaws.com/four.livejournal/20090906/combined_hist_c30.png"&gt;&lt;img src="http://s3.amazonaws.com/four.livejournal/20090906/combined_ts_c30.png"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;300 concurrent clients&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;completed requests:&lt;br /&gt;thin 36045&lt;br /&gt;node 35668&lt;br /&gt;narwhal 2921&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&amp;gt; summary(node300$ttime)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   12.0    66.0   112.0   239.4   157.0 12200.0 

&amp;gt; summary(thin300$ttime)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   71.0    84.0    87.0   208.7   107.0 23950.0 

&amp;gt; summary(narwhal300$ttime)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
    928    2837    2935    2921    3018    8759 &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="http://s3.amazonaws.com/four.livejournal/20090906/combined_ts_c300.png"&gt;&lt;img src="http://s3.amazonaws.com/four.livejournal/20090906/combined_hist_c300.png"&gt;&lt;br /&gt;&lt;br /&gt;(&lt;a href="http://s3.amazonaws.com/four.livejournal/20090906/combined_test.tar.gz"&gt;raw data, scripts&lt;/a&gt;)</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:four:1018997</id>
    <link rel="alternate" type="text/html" href="http://four.livejournal.com/1018997.html"/>
    <link rel="self" type="text/xml" href="http://four.livejournal.com/data/atom/?itemid=1018997"/>
    <title>node vs v8cgi benchmark</title>
    <published>2009-09-06T14:10:23Z</published>
    <updated>2009-09-06T18:25:23Z</updated>
    <category term="benchmark"/>
    <category term="node"/>
    <content type="html">A simple benchmark between node.js v0.1.9 and v8cgi v0.6.0 (via the apache module, apache version 2.2.8 (Ubuntu)). I used &lt;code&gt;ab -t 30 -g data.csv -c X&lt;/code&gt; for X=1 and X=2.&lt;br /&gt;&lt;a name="cutid1"&gt;&lt;/a&gt;&lt;br /&gt;The v8cgi script I used was&lt;blockquote&gt;&lt;pre&gt;response.write("hello world\n");&lt;/pre&gt;&lt;/blockquote&gt;The node script I used was&lt;blockquote&gt;&lt;pre&gt;body = "hello world\n";
node.http.createServer(function (request, response) {
  response.sendHeader(200, {
    "Date": "Sun, 06 Sep 2009 13:13:02 GMT",
    "Server": "Server: Apache/2.2.8 (Ubuntu) mod_v8cgi",
    "Content-Type": "text/html", 
    "Content-Length": body.length
  });
  response.sendBody(body);
  response.finish();
}).listen(8000);
puts("Server running at http://127.0.0.1:8000/");
&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;One client at a time (-c 1)&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Node completed 23389 requests&lt;br /&gt;v8cgi completed 1971.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://s3.amazonaws.com/four.livejournal/20090906/v8cgi_hist1.png"&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="http://s3.amazonaws.com/four.livejournal/20090906/v8cgi_ts1.png"&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Two clients at a time (-c 2)&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Node completed 28622 requests&lt;br /&gt;v8cgi completed 66.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://s3.amazonaws.com/four.livejournal/20090906/v8cgi_hist2.png"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(&lt;a href="http://s3.amazonaws.com/four.livejournal/20090906/v8cgi_stats.tar.gz"&gt;raw data, scripts, configuration&lt;/a&gt;)</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:four:1018159</id>
    <link rel="alternate" type="text/html" href="http://four.livejournal.com/1018159.html"/>
    <link rel="self" type="text/xml" href="http://four.livejournal.com/data/atom/?itemid=1018159"/>
    <title>four @ 2009-09-05T23:08:00</title>
    <published>2009-09-05T21:09:55Z</published>
    <updated>2009-09-05T21:10:44Z</updated>
    <content type="html">&lt;a href="http://housing.barringtoncollective.org/Napa_House/Casa_Zimbabwe"&gt;&lt;img src="http://housing.barringtoncollective.org/Napa_House/Casa_Zimbabwe?action=AttachFile&amp;amp;do=get&amp;amp;target=yourhouse.jpg" border="1"&gt;&lt;/a&gt;</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:four:1018026</id>
    <link rel="alternate" type="text/html" href="http://four.livejournal.com/1018026.html"/>
    <link rel="self" type="text/xml" href="http://four.livejournal.com/data/atom/?itemid=1018026"/>
    <title>node vs narwhal benchmark</title>
    <published>2009-09-05T13:19:09Z</published>
    <updated>2009-09-06T18:25:41Z</updated>
    <category term="benchmark"/>
    <category term="node"/>
    <content type="html">A simple benchmark against two popular "Server-Side Javascript" programs: &lt;a href="http://tinyclouds.org/node/"&gt;node.js&lt;/a&gt; v0.1.9 and &lt;a href="http://narwhaljs.org/"&gt;Narwhal&lt;/a&gt; version d147c160f11fdfb7f3c0763acf352b2b0e2713f7 using the Rhino backend.&lt;br /&gt;&lt;a name="cutid1"&gt;&lt;/a&gt;&lt;br /&gt;The script I used for Node was this&lt;blockquote&gt;&lt;pre&gt;body = "Hello, Web!";
node.http.createServer(function (request, response) {
  response.sendHeader(200, {
    "Content-Type": "text/plain", 
    "Content-Length": body.length, 
  });
  response.sendBody(body);
  response.finish();
}).listen(8000);
puts("Server running at http://127.0.0.1:8000/");&lt;/pre&gt;&lt;/blockquote&gt;and the script I used for Narwhal was what I found on &lt;a href="http://narwhaljs.org/quick-start.html"&gt;the quick start page&lt;/a&gt;: &lt;blockquote&gt;&lt;pre&gt;var jack = require("jack");

exports.app = jack.ContentLength(function (env) {
    return [200, {"Content-type": "text/plain"}, ["Hello, Web!"]];
})&lt;/pre&gt;&lt;/blockquote&gt;Then I ran apache bench on the two of them, each for 30 seconds (&lt;code&gt;-t 30&lt;/code&gt;), each with the &lt;code&gt;-c 30&lt;/code&gt; option. The web servers ran on my 32bit Linux system, 512mb ram, 1200 mhz - apache bench was running on a nearby computer.  I recorded the data with &lt;code&gt;-g&lt;/code&gt; and analyzed the data with R. The scripts I used and the data I collected are in &lt;a href="http://s3.amazonaws.com/four.livejournal/20090905/narwhal_stats.tar.gz"&gt;this tarball&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Node completed 37018 requests.&lt;br /&gt;Narwhal completed 2716. &lt;br /&gt;&lt;br /&gt;Time series (smaller is better):&lt;br /&gt;&lt;img src="http://s3.amazonaws.com/four.livejournal/20090905/ts.png"&gt;&lt;br /&gt;&lt;br /&gt;Response time histogram (left is better):&lt;br /&gt;&lt;img src="http://s3.amazonaws.com/four.livejournal/20090905/hist.png"&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;gt; summary(node$ttime)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   1.00   14.00   20.00   23.68   31.00  158.00 

&amp;gt; summary(narwhal$ttime)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
    187     269     313     329     368     992 
&lt;/pre&gt;ttime = total response time in milliseconds.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:four:1017295</id>
    <link rel="alternate" type="text/html" href="http://four.livejournal.com/1017295.html"/>
    <link rel="self" type="text/xml" href="http://four.livejournal.com/data/atom/?itemid=1017295"/>
    <title>music / future</title>
    <published>2009-08-31T12:10:08Z</published>
    <updated>2009-08-31T12:10:08Z</updated>
    <content type="html">&lt;lj-embed id="29" /&gt;</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:four:1016247</id>
    <link rel="alternate" type="text/html" href="http://four.livejournal.com/1016247.html"/>
    <link rel="self" type="text/xml" href="http://four.livejournal.com/data/atom/?itemid=1016247"/>
    <title>Devendra Banhart -- Dragonflys</title>
    <published>2009-08-19T13:19:54Z</published>
    <updated>2009-08-19T13:21:35Z</updated>
    <content type="html">I don't &lt;br /&gt;owe me any money&lt;br /&gt;You don't &lt;br /&gt;owe me a thing&lt;br /&gt;When we drink beer&lt;br /&gt;Dragonflies appear&lt;br /&gt;Dragonflies appear</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:four:1015792</id>
    <link rel="alternate" type="text/html" href="http://four.livejournal.com/1015792.html"/>
    <link rel="self" type="text/xml" href="http://four.livejournal.com/data/atom/?itemid=1015792"/>
    <title>connect(2)</title>
    <published>2009-08-12T13:10:55Z</published>
    <updated>2009-08-12T13:14:31Z</updated>
    <content type="html">Connecting a non-blocking socket is tricky . Here is the essential trick from &lt;code&gt;connect(2)&lt;/code&gt;:

&lt;code&gt;&lt;blockquote&gt;EINPROGRESS&lt;blockquote&gt;
              The  socket  is non-blocking and the connection cannot be completed immediately.  It is possible
              to select(2) or poll(2) for completion by selecting the socket  for  writing.   &lt;b&gt;After  select(2)
              indicates  writability,  use  getsockopt(2)  to  read the SO_ERROR option at level SOL_SOCKET to
              determine  whether  connect()  completed  successfully &lt;/b&gt;  (SO_ERROR  is  zero)  or  unsuccessfully
              (SO_ERROR is one of the usual error codes listed here, explaining the reason for the failure).&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;/code&gt;</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:four:1014910</id>
    <link rel="alternate" type="text/html" href="http://four.livejournal.com/1014910.html"/>
    <link rel="self" type="text/xml" href="http://four.livejournal.com/data/atom/?itemid=1014910"/>
    <title>node v0.1.3</title>
    <published>2009-08-06T12:27:24Z</published>
    <updated>2009-08-06T12:28:41Z</updated>
    <category term="programming"/>
    <category term="node"/>
    <content type="html">node.js development is coming along nicely! &lt;br /&gt;&lt;br /&gt;I've just made the 10th release, &lt;a href="http://groups.google.com/group/nodejs/browse_thread/thread/050cd43c7e481ab2#"&gt;v0.1.3&lt;/a&gt;. Fixing bugs, adding features. The project is still very rough&amp;mdash;I think the average time-to-encountering-a-bug-after-first-compile is about 20 minutes. We've got a little IRC channel with 6 or 7 regulars and an usually active mailing list (which doubles as a bug tracking system).</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:four:1014560</id>
    <link rel="alternate" type="text/html" href="http://four.livejournal.com/1014560.html"/>
    <link rel="self" type="text/xml" href="http://four.livejournal.com/data/atom/?itemid=1014560"/>
    <title>non-blocking stdio hack</title>
    <published>2009-08-03T09:43:10Z</published>
    <updated>2009-08-03T09:43:33Z</updated>
    <category term="programming"/>
    <content type="html">&lt;a href="http://s3.amazonaws.com/four.livejournal/20090803/nonblocking_stdio.tar.gz"&gt;http://s3.amazonaws.com/four.livejournal/20090803/nonblocking_stdio.tar.gz&lt;/a&gt;&lt;br /&gt;&lt;pre&gt;
 The problem with stdout, stderr, and stdin is that they are necessarily
 blocking when associated with a file. Like file descriptors for normal
 files, they cannot be used with select() or poll().

 If one does 
 
   my_program &amp;gt; /mnt/nfs_filesystem/output

 even printf() system calls might block the entire process's execution.
 This is bad for high performance servers which juggle many sockets and
 must never block execution.

 This function can help with that. Now STDOUT_FILENO, STDERR_FILENO, and
 STDIN_FILENO can be used with select(). All are set non-blocking and will
 act like pipe end-points (they are actually).

 This is done by internally using a ring buffer, pipe, and child process
 to pump data to the blocking file descriptor. 

 Compile with -pthreads. Call nonblocking_stdio() as quickly as possible
 after your program starts. Expect strange behavior with using printf()
 and friends--those are buffered and expect blocking file descriptors.&lt;/pre&gt;</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:four:1013948</id>
    <link rel="alternate" type="text/html" href="http://four.livejournal.com/1013948.html"/>
    <link rel="self" type="text/xml" href="http://four.livejournal.com/data/atom/?itemid=1013948"/>
    <title>dns.c</title>
    <published>2009-07-25T12:48:12Z</published>
    <updated>2009-07-25T13:04:30Z</updated>
    <category term="sweetcode"/>
    <content type="html">&lt;a href="http://25thandclement.com/~william/projects/dns.c.html"&gt;http://25thandclement.com/~william/projects/dns.c.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;A recursive, reentrant, non-blocking DNS resolver library in a single .c file. By William Ahern.&lt;br /&gt;&lt;br /&gt;Download and compile it. I like how he does testing. Also how he does private variables in public structs. There's a lot to learn here.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:four:1012285</id>
    <link rel="alternate" type="text/html" href="http://four.livejournal.com/1012285.html"/>
    <link rel="self" type="text/xml" href="http://four.livejournal.com/data/atom/?itemid=1012285"/>
    <title>ascii doc</title>
    <published>2009-06-28T21:18:30Z</published>
    <updated>2009-06-28T21:18:30Z</updated>
    <category term="sweetcode"/>
    <content type="html">&lt;a href="http://www.methods.co.nz/asciidoc/"&gt;http://www.methods.co.nz/asciidoc/&lt;/a&gt;</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:four:1011092</id>
    <link rel="alternate" type="text/html" href="http://four.livejournal.com/1011092.html"/>
    <link rel="self" type="text/xml" href="http://four.livejournal.com/data/atom/?itemid=1011092"/>
    <title>libev</title>
    <published>2009-06-25T16:52:24Z</published>
    <updated>2009-06-25T16:56:25Z</updated>
    <content type="html">Have I mentioned how much I like libev? You must have noticed, since I haven't written a thing without it for the past year and half. It's such a small and simple API and yet I continue to discover new things. Just this week, I learned about &lt;code&gt;ev_ref()&lt;/code&gt; and &lt;code&gt;ev_unref()&lt;/code&gt;. (They allow the event loop to drop out naturally even when a watcher is still in use. This is useful to me because I have to always watch for updates from the thread pool (via a pipe). It's almost perfectly bug free, works on every computer imaginable, and has a nice embedding API.&lt;br /&gt;&lt;br /&gt;I consider it a work of art.</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:four:1010190</id>
    <link rel="alternate" type="text/html" href="http://four.livejournal.com/1010190.html"/>
    <link rel="self" type="text/xml" href="http://four.livejournal.com/data/atom/?itemid=1010190"/>
    <title>popen() for node</title>
    <published>2009-06-21T14:04:06Z</published>
    <updated>2009-06-21T14:28:16Z</updated>
    <category term="programming"/>
    <category term="node"/>
    <content type="html">I just implemented a neat process launching thing in Node. (It's the first time I've ever used &lt;code&gt;vfork()&lt;/code&gt;!) It's great because it allows one to stream data in and out of child process. Here's a simple example:&lt;pre&gt;
 var cat = new node.Process("cat");
 cat.onOutput = function (chunk) {
   puts("cat said: " + chunk);
 };
 cat.onExit = function (status) {
   puts("cat exited with status " + status);
 };
 cat.write("hello");
 cat.write(" ");
 cat.write("world");
 cat.close();
&lt;/pre&gt;It will be easy to implement &lt;a href="http://www.whatwg.org/specs/web-workers/current-work/"&gt;Web Workers&lt;/a&gt; on top of this in pure javascript.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://s3.amazonaws.com/four.livejournal/20090621/api.html#processes"&gt;Check out the docs&lt;/a&gt;</content>
  </entry>
  <entry>
    <id>urn:lj:livejournal.com:atom1:four:1009204</id>
    <link rel="alternate" type="text/html" href="http://four.livejournal.com/1009204.html"/>
    <link rel="self" type="text/xml" href="http://four.livejournal.com/data/atom/?itemid=1009204"/>
    <title>Why isn't there a bidirectional popen()?</title>
    <published>2009-06-19T16:29:14Z</published>
    <updated>2009-06-19T17:49:10Z</updated>
    <category term="programming"/>
    <content type="html">Good read: &lt;a href="http://lua-users.org/lists/lua-l/2007-10/msg00189.html"&gt;http://lua-users.org/lists/lua-l/2007-10/msg00189.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In node I think it will look like this&lt;br /&gt; &lt;pre&gt;var cat = popen("cat");

cat.onOutput = function (chunk) {
  puts("cat said: '" + chunk + "'");
};

cat.onExit = function (code) {
  puts("the cat program exited with code " + code);
};

cat.write("hello world");
cat.close();
cat.kill(); &lt;/pre&gt;</content>
  </entry>
</feed>
