Thursday, May 27, 2010

Node.js vs. lua microbenchmarking

Node.js surely seems to be a pretty interesting contender. At least according to the microbenchmarks (ab -c 5 -n 100000):

Node.js:



Document Path: /
Document Length: 12 bytes

Concurrency Level: 5
Time taken for tests: 17.526 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Total transferred: 7600000 bytes
HTML transferred: 1200000 bytes
Requests per second: 5705.94 [#/sec] (mean)
Time per request: 0.876 [ms] (mean)
Time per request: 0.175 [ms] (mean, across all concurrent requests)
Transfer rate: 423.49 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 1
Processing: 0 1 0.5 1 14
Waiting: 0 1 0.5 1 14
Total: 0 1 0.5 1 14

Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 1
80% 1
90% 1
95% 2
98% 2
99% 2
100% 14 (longest request)


And here goes the Lua result:


Document Path: /
Document Length: 11 bytes

Concurrency Level: 5
Time taken for tests: 6.666 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Total transferred: 34600000 bytes
HTML transferred: 1100000 bytes
Requests per second: 15001.08 [#/sec] (mean)
Time per request: 0.333 [ms] (mean)
Time per request: 0.067 [ms] (mean, across all concurrent requests)
Transfer rate: 5068.72 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 4
Processing: 0 0 0.1 0 4
Waiting: 0 0 0.1 0 4
Total: 0 0 0.1 0 5

Percentage of the requests served within a certain time (ms)
50% 0
66% 0
75% 0
80% 0
90% 0
95% 1
98% 1
99% 1
100% 5 (longest request)


The node.js code was as follows:



var sys = require('sys'),
http = require('http');

http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('Hello World\n');
}).listen(8000);
sys.puts('Server running at http://127.0.0.1:8000/');


And in its turn, the Lua script used to run the server is here:
http://lua-users.org/lists/lua-l/2002-04/msg00180.html - slightly tweaked to make it run.

This is not anunfair comparison, since node.js runs a heavily optimized server, and the lua runs an off-the-shelp example, and yet outperforms Node.js almost 3x.

Though, more complicated code might result mostly in slowing down - so, the ballpark should be about right.

I will update this post if I get anything more complex on the lua side.

EDIT: in fact, a little bit of reverse engineering shows that Node.js code is also somewhat naive: "FOO /\n\n" works perfectly as a "request" for the above app. So the tests are more or less adequately show the status quo. Roughly 3x speed difference, that is.

EDIT2: http://factor-language.blogspot.com/2010/05/comparing-factors-performance-against.html has some more interesting stats.

Tuesday, May 11, 2010

prosody one-shot makefile on 64-bit arch

Today I tested my prosody-one-shot-makefile on my Xen VPS which happens to sit atop the 64-bit CPU.

After a few tweaks it now compiles and makes a self-contained copy of prosody on both 32-bit and 64-bit linuxes.

Interesting how the XMPP server immediately got got integrated when I launched it, and I could communicate with a demo account from my other XMPP accounts. Admittedly, I did not expect such a plug'n'play.

Sunday, May 9, 2010

Haute couture 2010: Privacy
Your latest luxury item to brag about

Pied Piper of Hamelin
The fate of chronic privacy deprivation that we are facing worries quite a few, and spurs a lot of heated discussions "we will do it better!".

Those inevitably bring up a question: "But Facebook is free, who is going to pay you ?"

So here's my take on it. Similar to how you have to be "rich" to control your weight, you will have to be "rich" to control your privacy.

So, the new services would have free accounts that are all-public (which is how you have to treat your info now, anyway - just extrapolate).

The paid accounts (something in the ballpark of $9/month) would allow making the information private. Or, one could go a bit more creative and sell privacy apiece - the more you pay, the more you can hide, and you pay only for the stuff you want to hide - so the distinction between the paid and free accounts would blur.

All of the accounts would allow the export of data into other services, should "this" social provider go off-rail.

The data formats as well as the interaction between the different providers would be standardized, so it would not really matter whether you and your friends are on the same provider or not.

This may not seem pretty, but I think this approach would be better than changing the smallprint in the ToS overtime.

Because there's no free lunch. It's just about charging in different currencies.


Now, I am curious (and you probably are curious too) about the correctness of the assumptions above, so here's a poll for you.

What would you choose ?
Stay on current social network
Get a free all-public account - or host your own instance with the privacy settings you choose
All-inclusive privacy paid account
Privacy sold apiece
  
pollcode.com free polls