Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

benchmark: make http profiling easier #4831

Closed
bnoordhuis opened this issue Feb 22, 2013 · 3 comments
Closed

benchmark: make http profiling easier #4831

bnoordhuis opened this issue Feb 22, 2013 · 3 comments

Comments

@bnoordhuis
Copy link
Member

The new http benchmarks are set up in a way that effectively makes profiling impossible because the interesting code runs in a child process.

That is, if you prof / strace / etc. it, all you see is the master process that spends 99% of the time sleeping in a syscall.

@isaacs
Copy link

isaacs commented Feb 22, 2013

If you specify all the args, then it'll run the actual test. Like this:

node benchmark/http/simple.js type=bytes length=1024 c=500

If you don't specify all the args, then it'll run with the combinations listed in the script.

@bnoordhuis
Copy link
Member Author

Maybe for the other tests but benchmark/http/simple.js spawns benchmark/http_simple.js in a child process.

I hacked around it like (see below) but it's not very convenient.

diff --git a/benchmark/http/simple.js b/benchmark/http/simple.js
index 04a2a29..ed8545f 100644
--- a/benchmark/http/simple.js
+++ b/benchmark/http/simple.js
@@ -12,7 +12,8 @@ function main(conf) {
   process.env.PORT = PORT;
   var spawn = require('child_process').spawn;
   var simple = require('path').resolve(__dirname, '../http_simple.js');
-  var server = spawn(process.execPath, [simple]);
+  //var server = spawn(process.execPath, [simple]);
+  var server = spawn('perf', ['record', '-i', '-g', '-e', 'cycles:u', process.execPath, simple]);
   setTimeout(function() {
     var path = '/' + conf.type + '/' + conf.length; //+ '/' + conf.chunks;
     var args = ['-r', 5000, '-t', 8, '-c', conf.c];

@isaacs
Copy link

isaacs commented Feb 23, 2013

Ohh... right. It should probably not spawn http_simple in a child proc, and instead just require() it, like the benchmark/http/cluster.js workers do.

@isaacs isaacs closed this as completed in 88befa6 Feb 26, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants