News for hackers. Stuff that matters.
Re:Really Slow Site for Testing HTTP Caches. by mnutt on Saturday October 23, 2010 @10:19PM (#1824983)
This is one of the things that node.js is really good at, and it's interesting that the sample code on the front page of nodejs.org was pretty similar to this app. Here's the rough equivalent in node:

  require('http').createServer(function (request, response) {
    response.writeHead(200, {'Content-Type': 'text/plain'});
    var time = Math.max(0, Math.min(60000, parseInt(request.url.slice(1)) || 0));
    setTimeout(function() { 
      response.end('This page load took ' + time + 'ms\n'); 
    }, time);
  }).listen(8124);
(They have since changed it, and I suspect that it was because new users were confused as to why their supposedly "fast" server always took 2 seconds to respond to requests)

(edit: code formatting)

Re:Really Slow Site for Testing HTTP Caches. by vog on Sunday October 24, 2010 @04:35AM (#1825653)
> This is one of the things that node.js is really good at

Why does every simple task motivate people to show some kind of "hello world" code in their favorite language and framework?

This web service is just a tiny exercise that is easily realized with a few lines in any language (even C or Bash) using any web server. In particular, I don't see in how far this code demonstrates the strengths of node.js.

Re:Really Slow Site for Testing HTTP Caches. by mnutt on Sunday October 24, 2010 @03:01PM (#1826898)
Perhaps because, though Sinatra is actually one of my favorite frameworks, it doesn't work very well for this. The author comments that it's limited to 10 seconds because each connection is handled by a blocking Thin. Eventmachine could also solve this problem, in a similar amount of code.

And I was just pointing out that this happened to be the official hello world for node.js.

Re:Really Slow Site for Testing HTTP Caches. by 0x44 on Monday October 25, 2010 @05:53AM (#1829172)
shmeedog wrote a server in eventlet that solves the blocking thin problem.
Re:Really Slow Site for Testing HTTP Caches. by 0x44 on Sunday October 24, 2010 @05:11AM (#1825702)
Amusingly, my involvement came from showing shmeedog how nice his service would look in Sinatra versus WSGI.