<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom"><title>Simon Willison's Weblog: twisted</title><link href="http://simonwillison.net/" rel="alternate"/><link href="http://simonwillison.net/tags/twisted.atom" rel="self"/><id>http://simonwillison.net/</id><updated>2010-02-22T19:00:47+00:00</updated><author><name>Simon Willison</name></author><entry><title>node-v0.1.30</title><link href="https://simonwillison.net/2010/Feb/22/node/#atom-tag" rel="alternate"/><published>2010-02-22T19:00:47+00:00</published><updated>2010-02-22T19:00:47+00:00</updated><id>https://simonwillison.net/2010/Feb/22/node/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://groups.google.com/group/nodejs/browse_thread/thread/e6cc6f04cd0ddf14"&gt;node-v0.1.30&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
A very significant new release of Node.js: the Twisted/Dojo-style Promise abstraction has been removed entirely, causing backwards incompatible changes to a bunch of core APIs. This means the pseudo-blocking Promise.wait() method is gone too, making it even harder to accidentally block your event loop. Instead, user-level libraries are encouraged to add Promise-style abstractions. I’m pleased to see Node sticking to the low-level stuff.

    &lt;p&gt;&lt;small&gt;&lt;/small&gt;Via &lt;a href="http://howtonode.org/do-it-fast"&gt;howtonode.org&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/async"&gt;async&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/dojo"&gt;dojo&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/javascript"&gt;javascript&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/nodejs"&gt;nodejs&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/promise"&gt;promise&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/twisted"&gt;twisted&lt;/a&gt;&lt;/p&gt;



</summary><category term="async"/><category term="dojo"/><category term="javascript"/><category term="nodejs"/><category term="promise"/><category term="twisted"/></entry><entry><title>Socket Benchmark of Asynchronous Servers in Python</title><link href="https://simonwillison.net/2009/Dec/22/benchmark/#atom-tag" rel="alternate"/><published>2009-12-22T22:34:01+00:00</published><updated>2009-12-22T22:34:01+00:00</updated><id>https://simonwillison.net/2009/Dec/22/benchmark/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://nichol.as/asynchronous-servers-in-python"&gt;Socket Benchmark of Asynchronous Servers in Python&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
A comparison of eight different asynchronous networking frameworks in Python. Tornado comes out on top in most of the benchmarks, but the post is most interesting for the direct comparison of simple code examples for each of the frameworks.


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/async"&gt;async&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/benchmarks"&gt;benchmarks&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/dieselweb"&gt;dieselweb&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/eventio"&gt;eventio&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/eventlet"&gt;eventlet&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/gevent"&gt;gevent&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/orbited"&gt;orbited&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/python"&gt;python&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/stackless"&gt;stackless&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/tornado"&gt;tornado&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/twisted"&gt;twisted&lt;/a&gt;&lt;/p&gt;



</summary><category term="async"/><category term="benchmarks"/><category term="dieselweb"/><category term="eventio"/><category term="eventlet"/><category term="gevent"/><category term="orbited"/><category term="python"/><category term="stackless"/><category term="tornado"/><category term="twisted"/></entry><entry><title>Perl: Love it, or hate it, but don't ignore it.</title><link href="https://simonwillison.net/2009/Nov/27/perl/#atom-tag" rel="alternate"/><published>2009-11-27T07:51:45+00:00</published><updated>2009-11-27T07:51:45+00:00</updated><id>https://simonwillison.net/2009/Nov/27/perl/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://blog.newint.org/tech/2009/11/26/perl-dont-ingore-it/"&gt;Perl: Love it, or hate it, but don&amp;#x27;t ignore it.&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
Phillip Smith calls me out for omitting Perl from my list of Node.js event loop alternatives (I only mentioned Twisted and EventMachine). No conspiracy here, I’m just not connected enough to the Perl community to know what the popular event loop libraries are. To Perl’s credit, Perlbal was the first piece of software I saw that showed me how a single threaded, event loop based system could massively outperform a threaded alternative.


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/async"&gt;async&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/eventio"&gt;eventio&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/eventloop"&gt;eventloop&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/eventmachine"&gt;eventmachine&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/nodejs"&gt;nodejs&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/perl"&gt;perl&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/perlbal"&gt;perlbal&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/twisted"&gt;twisted&lt;/a&gt;&lt;/p&gt;



</summary><category term="async"/><category term="eventio"/><category term="eventloop"/><category term="eventmachine"/><category term="nodejs"/><category term="perl"/><category term="perlbal"/><category term="twisted"/></entry><entry><title>Node.js is genuinely exciting</title><link href="https://simonwillison.net/2009/Nov/23/node/#atom-tag" rel="alternate"/><published>2009-11-23T12:50:22+00:00</published><updated>2009-11-23T12:50:22+00:00</updated><id>https://simonwillison.net/2009/Nov/23/node/#atom-tag</id><summary type="html">
    &lt;p&gt;I gave a talk on Friday at &lt;a href="http://2009.full-frontal.org/"&gt;Full Frontal&lt;/a&gt;, a new one day JavaScript conference in my home town of Brighton. I ended up throwing away my intended topic (JSONP, APIs and cross-domain security) three days before the event in favour of a technology which first crossed my radar &lt;a href="http://simonwillison.net/2009/Nov/9/node/"&gt;less than two weeks ago&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;That technology is Ryan Dahl's &lt;a href="http://nodejs.org/"&gt;Node&lt;/a&gt;. It's the most exciting new project I've come across in quite a while.&lt;/p&gt;

&lt;p&gt;At first glance, Node looks like yet another take on the idea of server-side JavaScript, but it's a lot more interesting than that. It builds on JavaScript's excellent support for event-based programming and uses it to create something that truly plays to the strengths of the language.&lt;/p&gt;

&lt;p&gt;Node describes itself as "evented I/O for V8 javascript". It's a toolkit for writing extremely high performance non-blocking event driven network servers in JavaScript. Think similar to &lt;a href="http://twistedmatrix.com/"&gt;Twisted&lt;/a&gt; or &lt;a href="http://rubyeventmachine.com/"&gt;EventMachine&lt;/a&gt; but for JavaScript instead of Python or Ruby.&lt;/p&gt;

&lt;h4&gt;Evented I/O?&lt;/h4&gt;

&lt;p&gt;As I discussed in my talk, event driven servers are a powerful alternative to the threading / blocking mechanism used by most popular server-side programming frameworks. Typical frameworks can only handle a small number of requests simultaneously, dictated by the number of server threads or processes available. Long-running operations can tie up one of those threads - enough long running operations at once and the server runs out of available threads and becomes unresponsive. For large amounts of traffic, each request must be handled as quickly as possible to free the thread up to deal with the next in line.&lt;/p&gt;

&lt;p&gt;This makes certain functionality extremely difficult to support. Examples include handling large file uploads, combining resources from multiple backend web APIs (which themselves can take an unpredictable amount of time to respond) or providing comet functionality by holding open the connection until a new event becomes available.&lt;/p&gt;

&lt;p&gt;Event driven programming takes advantage of the fact that network servers spend most of their time waiting for I/O operations to complete. Operations against in-memory data are incredibly fast, but anything that involves talking to the filesystem or over a network inevitably involves waiting around for a response.&lt;/p&gt;

&lt;p&gt;With Twisted, EventMachine and Node, the solution lies in specifying I/O operations in conjunction with callbacks. A single event loop rapidly switches between a list of tasks, firing off I/O operations and then moving on to service the next request. When the I/O returns, execution of that particular request is picked up again.&lt;/p&gt;

&lt;p&gt;(In the talk, I attempted to illustrate this with a questionable metaphor involving &lt;a href="http://www.slideshare.net/simon/evented-io-based-web-servers-explained-using-bunnies"&gt;hamsters, bunnies and a hyperactive squid&lt;/a&gt;).&lt;/p&gt;

&lt;iframe src="https://www.slideshare.net/slideshow/embed_code/key/B8ICSKJbZ2cBHw?startSlide=1" width="597" height="486" frameborder="0"   marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC; border-width:1px;   margin-bottom:5px;max-width: 100%;" allowfullscreen="allowfullscreen"&gt;
&lt;/iframe&gt;

&lt;h4&gt;What makes Node exciting?&lt;/h4&gt;

&lt;p&gt;If systems like this already exist, what's so exciting about Node? Quite a few things:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;JavaScript is extremely well suited to programming with callbacks&lt;/strong&gt;. Its anonymous function syntax and closure support is perfect for defining inline callbacks, and client-side development in general uses event-based programming as a matter of course: run this function when the user clicks here / when the Ajax response returns / when the page loads. JavaScript programmers already understand how to build software in this way.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Node represents a clean slate&lt;/strong&gt;. Twisted and EventMachine are hampered by the existence of a large number of blocking libraries for their respective languages. Part of the difficulty in learning those technologies is understanding which Python or Ruby libraries you can use and which ones you have to avoid. Node creator Ryan Dahl has a stated aim for Node to never provide a blocking API - even filesystem access and DNS lookups are catered for with non-blocking callback based APIs. This makes it much, much harder to screw things up.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Node is small&lt;/strong&gt;. I read through the &lt;a href="http://nodejs.org/api.html"&gt;API documentation&lt;/a&gt; in around half an hour and felt like I had a pretty comprehensive idea of what Node does and how I would achieve things with it.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Node is fast&lt;/strong&gt;. V8 is the fast and keeps getting faster. Node's event loop uses Marc Lehmann's highly regarded &lt;a href="http://software.schmorp.de/pkg/libev.html"&gt;libev&lt;/a&gt; and &lt;a href="http://software.schmorp.de/pkg/libeio.html"&gt;libeio&lt;/a&gt; libraries. Ryan Dahl is himself something of a speed demon - he just replaced Node's HTTP parser implementation (already pretty speedy due to it's Ragel / Mongrel heritage) with a &lt;a href="http://four.livejournal.com/1033160.html"&gt;hand-tuned C implementation&lt;/a&gt; with some impressive characteristics.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Easy to get started&lt;/strong&gt;. Node ships with all of its dependencies, and compiles cleanly on Snow Leopard out of the box.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With both my JavaScript and server-side hats on, Node just feels right. The APIs make sense, it fits a clear niche and despite its youth (the project started in February) everything feels solid and well constructed. The rapidly growing community is further indication that Ryan is on to something great here.&lt;/p&gt;

&lt;h4&gt;What does Node look like?&lt;/h4&gt;

&lt;p&gt;Here's how to get Hello World running in Node in 7 easy steps:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;samp&gt;git clone git://github.com/ry/node.git&lt;/samp&gt; (or download and extract &lt;a href="http://github.com/ry/node/archives/master" title="Download ry/node from GitHub"&gt;a tarball&lt;/a&gt;)&lt;/li&gt;
  &lt;li&gt;&lt;samp&gt;./configure&lt;/samp&gt;&lt;/li&gt;
  &lt;li&gt;&lt;samp&gt;make&lt;/samp&gt; (takes a while, it needs to compile V8 as well)&lt;/li&gt;
  &lt;li&gt;&lt;samp&gt;sudo make install&lt;/samp&gt;&lt;/li&gt;
  &lt;li&gt;Save the below code as &lt;samp&gt;helloworld.js&lt;/samp&gt;&lt;/li&gt;
  &lt;li&gt;&lt;samp&gt;node helloworld.js&lt;/samp&gt;&lt;/li&gt;
  &lt;li&gt;Visit &lt;samp&gt;http://localhost:8080/&lt;/samp&gt; in your browser&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here's helloworld.js:&lt;/p&gt;

&lt;pre&gt;&lt;code class="javascript"&gt;var sys = require('sys'), 
  http = require('http');

http.createServer(function(req, res) {
  res.sendHeader(200, {'Content-Type': 'text/html'});
  res.sendBody('&amp;lt;h1&amp;gt;Hello World&amp;lt;/h1&amp;gt;');
  res.finish();
}).listen(8080);

sys.puts('Server running at http://127.0.0.1:8080/');
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you have Apache Bench installed, try running &lt;samp&gt;ab -n 1000 -c 100 'http://127.0.0.1:8080/'&lt;/samp&gt; to test it with 1000 requests using 100 concurrent connections. On my MacBook Pro I get 3374 requests a second.&lt;/p&gt;

&lt;p&gt;So Node is fast - but where it really shines is concurrency with long running requests. Alter the helloworld.js server definition to look like this:&lt;/p&gt;

&lt;pre&gt;&lt;code class="javascript"&gt;http.createServer(function(req, res) {
  setTimeout(function() {
    res.sendHeader(200, {'Content-Type': 'text/html'});
    res.sendBody('&amp;lt;h1&amp;gt;Hello World&amp;lt;/h1&amp;gt;');
    res.finish();
  }, 2000);
}).listen(8080);&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We're using &lt;samp&gt;setTimeout&lt;/samp&gt; to introduce an artificial two second delay to each request. Run the benchmark again - I get 49.68 requests a second, with every single request taking between 2012 and 2022 ms. With a two second delay, the best possible performance for 1000 requests 100 at a time is  &lt;em&gt;1000 requests / (1000 / 100) * 2 seconds = 50 requests a second&lt;/em&gt;. Node hits it pretty much bang on the nose.&lt;/p&gt;

&lt;p&gt;The most important line in the above examples is &lt;code&gt;res.finish()&lt;/code&gt;. This is the mechanism Node provides for explicitly signalling that a request has been fully processed and should be returned to the browser. By making it explicit, Node makes it easy to implement comet patterns like long polling and streaming responses - stuff that is decidedly non trivial in most server-side frameworks.&lt;/p&gt;

&lt;h4&gt;djangode&lt;/h4&gt;

&lt;p&gt;Node's core APIs are pretty low level - it has HTTP client and server libraries, DNS handling, asynchronous file I/O etc, but it doesn't give you much in the way of high level web framework APIs. Unsurprisingly, this has lead to a cambrian explosion of lightweight web frameworks based on top of Node - the &lt;a href="http://wiki.github.com/ry/node"&gt;projects using node page&lt;/a&gt; lists a bunch of them. Rolling a framework is a great way of learning a low-level API, so I've thrown together my own - &lt;a href="http://github.com/simonw/djangode"&gt;djangode&lt;/a&gt; - which brings Django's regex-based URL handling to Node along with a few handy utility functions. Here's a simple djangode application:&lt;/p&gt;

&lt;pre&gt;&lt;code class="javascript"&gt;var dj = require('./djangode');

var app = dj.makeApp([
  ['^/$', function(req, res) {
    dj.respond(res, 'Homepage');
  }],
  ['^/other$', function(req, res) {
    dj.respond(res, 'Other page');
  }],
  ['^/page/(\\d+)$', function(req, res, page) {
    dj.respond(res, 'Page ' + page);
  }]
]);
dj.serve(app, 8008);&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;djangode is currently a throwaway prototype, but I'll probably be extending it with extra functionality as I explore more Node related ideas.&lt;/p&gt;

&lt;h4&gt;nodecast&lt;/h4&gt;

&lt;p&gt;My main demo in the Full Frontal talk was nodecast, an extremely simple broadcast-oriented comet application. Broadcast is my favourite "hello world" example for comet because it's both simpler than chat and more realistic - I've been involved in plenty of projects that could benefit from being able to broadcast events to their audience, but few that needed an interactive chat room.&lt;/p&gt;

&lt;p&gt;The source code for the version I demoed can be found on GitHub in &lt;a href="http://github.com/simonw/nodecast/tree/no-redis"&gt;the no-redis branch&lt;/a&gt;. It's a very simple application - the client-side JavaScript simply uses jQuery's getJSON method to perform long-polling against a simple URL endpoint:&lt;/p&gt;

&lt;pre&gt;&lt;code class="javascript"&gt;function fetchLatest() {
  $.getJSON('/wait?id=' + last_seen, function(d) {
    $.each(d, function() {
      last_seen = parseInt(this.id, 10) + 1;
      ul.prepend($('&amp;lt;li&amp;gt;&amp;lt;/li&amp;gt;').text(this.text));
    });
    fetchLatest();
  });
}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Doing this recursively is probably a bad idea since it will eventually blow the browser's JavaScript stack, but it works OK for the demo.&lt;/p&gt;

&lt;p&gt;The more interesting part is the server-side &lt;samp&gt;/wait&lt;/samp&gt; URL which is being polled. Here's the relevant Node/djangode code:&lt;/p&gt;

&lt;pre&gt;&lt;code class="javascript"&gt;var message_queue = new process.EventEmitter();

var app = dj.makeApp([
  // ...
  ['^/wait$', function(req, res) {
    var id = req.uri.params.id || 0;
    var messages = getMessagesSince(id);
    if (messages.length) {
      dj.respond(res, JSON.stringify(messages), 'text/plain');
    } else {
      // Wait for the next message
      var listener = message_queue.addListener('message', function() {
        dj.respond(res, 
          JSON.stringify(getMessagesSince(id)), 'text/plain'
        );
        message_queue.removeListener('message', listener);
        clearTimeout(timeout);
      });
      var timeout = setTimeout(function() {
        message_queue.removeListener('message', listener);
        dj.respond(res, JSON.stringify([]), 'text/plain');
      }, 10000);
    }
  }]
  // ...
]);&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The wait endpoint checks for new messages and, if any exist, returns immediately. If there are no new messages it does two things: it hooks up a listener on the &lt;samp&gt;message_queue&lt;/samp&gt; EventEmitter (Node's equivalent of jQuery/YUI/Prototype's custom events) which will respond and end the request when a new message becomes available, and also sets a timeout that will cancel the listener and end the request after 10 seconds. This ensures that long polls don't go on too long and potentially cause problems - as far as the browser is concerned it's just talking to a JSON resource which takes up to ten seconds to load.&lt;/p&gt;

&lt;p&gt;When a message does become available, calling &lt;samp&gt;message_queue.emit('message')&lt;/samp&gt; will cause all waiting requests to respond with the latest set of messages.&lt;/p&gt;

&lt;h4&gt;Talking to databases&lt;/h4&gt;

&lt;p&gt;nodecast keeps track of messages using an in-memory JavaScript array, which works fine until you restart the server and lose everything. How do you implement persistent storage?&lt;/p&gt;

&lt;p&gt;For the moment, the easiest answer lies with the NoSQL ecosystem. Node's focus on non-blocking I/O makes it hard (but not impossible) to hook it up to regular database client libraries. Instead, it strongly favours databases that speak simple protocols over a TCP/IP socket - or even better, databases that communicate over HTTP. So far I've tried using CouchDB (with &lt;a href="http://github.com/sixtus/node-couch"&gt;node-couch&lt;/a&gt;) and redis (with &lt;a href="http://github.com/fictorial/redis-node-client"&gt;redis-node-client&lt;/a&gt;), and both worked extremely well. nodecast &lt;a href="http://github.com/simonw/nodecast"&gt;trunk&lt;/a&gt; now uses redis to store the message queue, and provides a nice example of working with a callback-based non-blocking database interface:&lt;/p&gt;

&lt;pre&gt;&lt;code class="javascript"&gt;var db = redis.create_client();
var REDIS_KEY = 'nodecast-queue';

function addMessage(msg, callback) {
  db.llen(REDIS_KEY, function(i) {
    msg.id = i; // ID is set to the queue length
    db.rpush(REDIS_KEY, JSON.stringify(msg), function() {
      message_queue.emit('message', msg);
      callback(msg);
    });
  });
}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Relational databases are coming to Node. Ryan has a &lt;a href="http://github.com/ry/node_postgres"&gt;PostgreSQL adapter&lt;/a&gt; in the works, thanks to that database already featuring a mature non-blocking client library. MySQL will be a bit tougher - Node will need to grow a separate thread pool to integrate with the official client libs - but you can talk to MySQL right now by dropping in &lt;a href="https://open.nytimes.com/introducing-dbslayer-64d7168a143f"&gt;DBSlayer&lt;/a&gt; from the NY Times which provides an HTTP interface to a pool of MySQL servers.&lt;/p&gt;

&lt;h4&gt;Mixed environments&lt;/h4&gt;

&lt;p&gt;I don't see myself switching all of my server-side development over to JavaScript, but Node has definitely earned a place in my toolbox. It shouldn't be at all hard to mix Node in to an existing server-side environment - either by running both behind a single HTTP proxy (being event-based itself, &lt;a href="http://nginx.net/"&gt;nginx&lt;/a&gt; would be an obvious fit) or by putting Node applications on a separate subdomain. Node is a tempting option for anything involving comet, file uploads or even just mashing together potentially slow loading web APIs. Expect to hear a lot more about it in the future.&lt;/p&gt;

&lt;h4&gt;Further reading&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href="http://s3.amazonaws.com/four.livejournal/20091117/jsconf.pdf"&gt;Ryan's JSConf.eu presentation&lt;/a&gt; is the best discussion I've seen anywhere of the design philosophy behind Node.&lt;/li&gt;
  &lt;li&gt;&lt;a href="http://nodejs.org/api.html"&gt;Node's API documentation&lt;/a&gt; is essential reading.&lt;/li&gt;
  &lt;li&gt;&lt;a href="http://debuggable.com/posts/streaming-file-uploads-with-node-js:4ac094b2-b6c8-4a7f-bd07-28accbdd56cb"&gt;Streaming file uploads with node.js&lt;/a&gt; illustrates how well suited Node is to accepting large file uploads.&lt;/li&gt;
  &lt;li&gt;&lt;a href="http://groups.google.com/group/nodejs"&gt;The nodejs Google Group&lt;/a&gt; is the hub of the Node community.&lt;/li&gt;
&lt;/ul&gt;
    
        &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/async"&gt;async&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/comet"&gt;comet&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/couchdb"&gt;couchdb&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/eventio"&gt;eventio&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/http"&gt;http&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/javascript"&gt;javascript&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/nodejs"&gt;nodejs&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/nosql"&gt;nosql&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/redis"&gt;redis&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/ryan-dahl"&gt;ryan-dahl&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/my-talks"&gt;my-talks&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/tornado"&gt;tornado&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/twisted"&gt;twisted&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/v8"&gt;v8&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/highlights"&gt;highlights&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/annotated-talks"&gt;annotated-talks&lt;/a&gt;&lt;/p&gt;
    

</summary><category term="async"/><category term="comet"/><category term="couchdb"/><category term="eventio"/><category term="http"/><category term="javascript"/><category term="nodejs"/><category term="nosql"/><category term="redis"/><category term="ryan-dahl"/><category term="my-talks"/><category term="tornado"/><category term="twisted"/><category term="v8"/><category term="highlights"/><category term="annotated-talks"/></entry><entry><title>node.js</title><link href="https://simonwillison.net/2009/Nov/9/node/#atom-tag" rel="alternate"/><published>2009-11-09T23:25:47+00:00</published><updated>2009-11-09T23:25:47+00:00</updated><id>https://simonwillison.net/2009/Nov/9/node/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://nodejs.org/"&gt;node.js&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
“Evented I/O for V8 JavaScript”—a JavaScript environment built on top of the super-fast V8 engine which provides event-based IO functionality for building highly concurrent TCP and HTTP servers. The API design is superb—everything is achieved using JavaScript events and callbacks (even regular file IO) and the small standard library ships with comprehensive support for HTTP and DNS. Overall it’s very similar to Twisted and friends, but JavaScript’s anonymous function syntax feels more natural than the Python equivalent. It compiles cleanly on Snow Leopard. Definitely a project to watch.


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/dns"&gt;dns&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/eventbasedio"&gt;eventbasedio&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/http"&gt;http&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/io"&gt;io&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/javascript"&gt;javascript&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/nodejs"&gt;nodejs&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/twisted"&gt;twisted&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/v8"&gt;v8&lt;/a&gt;&lt;/p&gt;



</summary><category term="dns"/><category term="eventbasedio"/><category term="http"/><category term="io"/><category term="javascript"/><category term="nodejs"/><category term="twisted"/><category term="v8"/></entry><entry><title>Twisted inlineCallbacks and deferredGenerator</title><link href="https://simonwillison.net/2009/Oct/25/twisted/#atom-tag" rel="alternate"/><published>2009-10-25T23:30:20+00:00</published><updated>2009-10-25T23:30:20+00:00</updated><id>https://simonwillison.net/2009/Oct/25/twisted/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://blog.mekk.waw.pl/archives/14-Twisted-inlineCallbacks-and-deferredGenerator.html"&gt;Twisted inlineCallbacks and deferredGenerator&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
inlineCallbacks are a brilliant (but seemingly under-promoted) feature of Twisted which use the ability to return a value from a yield statement to make asynchronous callbacks look much more like regular sequential programming.


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/async"&gt;async&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/callbacks"&gt;callbacks&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/generators"&gt;generators&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/python"&gt;python&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/twisted"&gt;twisted&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/yield"&gt;yield&lt;/a&gt;&lt;/p&gt;



</summary><category term="async"/><category term="callbacks"/><category term="generators"/><category term="python"/><category term="twisted"/><category term="yield"/></entry><entry><title>Introducing Cloudera Desktop</title><link href="https://simonwillison.net/2009/Oct/21/cloudera/#atom-tag" rel="alternate"/><published>2009-10-21T18:48:36+00:00</published><updated>2009-10-21T18:48:36+00:00</updated><id>https://simonwillison.net/2009/Oct/21/cloudera/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://www.cloudera.com/blog/2009/10/01/introducing-cloudera-desktop/"&gt;Introducing Cloudera Desktop&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
It’s a GUI for Hadoop, and under the hood is a whole stack of open source software, including Python, Django, MooTools, Twisted, lxml, CherryPy, Mako, Java and AspectJ.


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/aspectj"&gt;aspectj&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/cherrypy"&gt;cherrypy&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/cloudera"&gt;cloudera&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/django"&gt;django&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/hadoop"&gt;hadoop&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/java"&gt;java&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/lxml"&gt;lxml&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/mako"&gt;mako&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/mootools"&gt;mootools&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/open-source"&gt;open-source&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/python"&gt;python&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/twisted"&gt;twisted&lt;/a&gt;&lt;/p&gt;



</summary><category term="aspectj"/><category term="cherrypy"/><category term="cloudera"/><category term="django"/><category term="hadoop"/><category term="java"/><category term="lxml"/><category term="mako"/><category term="mootools"/><category term="open-source"/><category term="python"/><category term="twisted"/></entry><entry><title>Twisted Web in 60 seconds</title><link href="https://simonwillison.net/2009/Oct/8/twisted/#atom-tag" rel="alternate"/><published>2009-10-08T11:48:50+00:00</published><updated>2009-10-08T11:48:50+00:00</updated><id>https://simonwillison.net/2009/Oct/8/twisted/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://jcalderone.livejournal.com/tag/sixty seconds"&gt;Twisted Web in 60 seconds&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
A common complaint about Twisted is how hard it is to figure out the web stack. Jp Calderon’s tutorial (in nine installments and counting) is the best documentation on web development in Twisted I’ve seen.


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/jp-calderon"&gt;jp-calderon&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/python"&gt;python&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/twisted"&gt;twisted&lt;/a&gt;&lt;/p&gt;



</summary><category term="jp-calderon"/><category term="python"/><category term="twisted"/></entry><entry><title>svnpubsub.py</title><link href="https://simonwillison.net/2009/Sep/6/svnpubsub/#atom-tag" rel="alternate"/><published>2009-09-06T21:50:01+00:00</published><updated>2009-09-06T21:50:01+00:00</updated><id>https://simonwillison.net/2009/Sep/6/svnpubsub/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="https://svn.apache.org/repos/infra/infrastructure/trunk/projects/svnpubsub/svnpubsub.py"&gt;svnpubsub.py&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
A Twisted/Python powered comet API for pushing out Subversion commits, built for Apache Foundation projects.

    &lt;p&gt;&lt;small&gt;&lt;/small&gt;Via &lt;a href="https://blogs.apache.org/infra/entry/apache_org_downtime_report"&gt;apache.org incident report for 8/28/2009&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/comet"&gt;comet&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/python"&gt;python&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/subversion"&gt;subversion&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/svnpubsub"&gt;svnpubsub&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/twisted"&gt;twisted&lt;/a&gt;&lt;/p&gt;



</summary><category term="comet"/><category term="python"/><category term="subversion"/><category term="svnpubsub"/><category term="twisted"/></entry><entry><title>Exploring OAuth-Protected APIs</title><link href="https://simonwillison.net/2009/Aug/23/oauth/#atom-tag" rel="alternate"/><published>2009-08-23T11:06:42+00:00</published><updated>2009-08-23T11:06:42+00:00</updated><id>https://simonwillison.net/2009/Aug/23/oauth/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://mojodna.net/2009/08/21/exploring-oauth-protected-apis.html"&gt;Exploring OAuth-Protected APIs&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
One of the downsides of OAuth is that it makes debugging APIs in your browser much harder. Seth Fitzsimmons’ oauth-proxy solves this by running a Twisted-powered proxy on your local machine which OAuth-signs every request going through it using your consumer key, secret and tokens for that API. Using it with a browsers risks exposing your key and token (but not secret) to sites you accidentally browse to—it would be useful if you could pass a whitelist of API domains as a command line option to the proxy.


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/apis"&gt;apis&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/oauth"&gt;oauth&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/proxies"&gt;proxies&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/python"&gt;python&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/seth-fitzsimmons"&gt;seth-fitzsimmons&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/twisted"&gt;twisted&lt;/a&gt;&lt;/p&gt;



</summary><category term="apis"/><category term="oauth"/><category term="proxies"/><category term="python"/><category term="seth-fitzsimmons"/><category term="twisted"/></entry><entry><title>Python logging from multiple processes</title><link href="https://simonwillison.net/2009/Aug/13/python/#atom-tag" rel="alternate"/><published>2009-08-13T23:55:02+00:00</published><updated>2009-08-13T23:55:02+00:00</updated><id>https://simonwillison.net/2009/Aug/13/python/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://www.huyng.com/archives/418"&gt;Python logging from multiple processes&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
Use Python’s socket log handler to send all log messages to a single server—the python-loggingserver project implements such a server as a Twisted application with a handy web interface for viewing the aggregated logs.


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/logging"&gt;logging&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/python"&gt;python&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/twisted"&gt;twisted&lt;/a&gt;&lt;/p&gt;



</summary><category term="logging"/><category term="python"/><category term="twisted"/></entry><entry><title>Introducing Yardbird</title><link href="https://simonwillison.net/2009/May/22/yardbird/#atom-tag" rel="alternate"/><published>2009-05-22T23:13:39+00:00</published><updated>2009-05-22T23:13:39+00:00</updated><id>https://simonwillison.net/2009/May/22/yardbird/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://zork.net/motd/nick/django/introducing-yardbird.html"&gt;Introducing Yardbird&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
I absolutely love it—an IRC bot built on top of Twisted that passes incoming messages off to Django code running in a separate thread. Requests and Response objects are used to represent incoming and outgoing messages, and Django’s regex-based URL routing is used to dispatch messages to different handling functions based on their content.


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/django"&gt;django&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/irc"&gt;irc&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/regular-expressions"&gt;regular-expressions&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/threads"&gt;threads&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/twisted"&gt;twisted&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/yardbird"&gt;yardbird&lt;/a&gt;&lt;/p&gt;



</summary><category term="django"/><category term="irc"/><category term="regular-expressions"/><category term="threads"/><category term="twisted"/><category term="yardbird"/></entry></feed>