$ ab -n 3000000 -c 100
http://127.0.0.1:8000/
Requests per second: 3515.67 [#/sec] (mean)
Failed requests: 0
Transfer rate: 391.39 [Kbytes/sec] received
Watching 'top' showed node using 34-35m resident memory. It does not
grow. Good stuff.
Regarding the missing HandleScope. I'm not intimately familiar with
the V8 API. However, I whipped up this little Perl script to
**maybe** find other cases like this in the Node V8 code. YMMV.
It found one thing that may or may not be a problem:
http.cc:153 - no HandleScope found in function
Function started at line 136
Concern is from line content: return Local<String>();
static inline Local<String>
GetMethod (int method)
{
switch (method) {
case HTTP_COPY: return String::NewSymbol("COPY");
case HTTP_DELETE: return String::NewSymbol("DELETE");
case HTTP_GET: return String::NewSymbol("GET");
case HTTP_HEAD: return String::NewSymbol("HEAD");
case HTTP_LOCK: return String::NewSymbol("LOCK");
case HTTP_MKCOL: return String::NewSymbol("MKCOL");
case HTTP_MOVE: return String::NewSymbol("MOVE");
case HTTP_OPTIONS: return String::NewSymbol("OPTIONS");
case HTTP_POST: return String::NewSymbol("POST");
case HTTP_PROPFIND: return String::NewSymbol("PROPFIND");
case HTTP_PROPPATCH: return String::NewSymbol("PROPPATCH");
case HTTP_PUT: return String::NewSymbol("PUT");
case HTTP_TRACE: return String::NewSymbol("TRACE");
case HTTP_UNLOCK: return String::NewSymbol("UNLOCK");
}
return Local<String>();
}
Again, I'm not really sure if you need a HandleScope here. I suppose
it's unclear to me if the HandleScope in the caller of GetMethod is
"good enough" to grab the returned Local. Not sure.
Here's the script. Run it from the node/src dir like: $ perl
find_handle_scope_issues.pl
#!/usr/bin/perl
use strict;
foreach my $filename (<*.cc>) {
local $/;
open(FH, $filename) or die "$filename: $!";
my @lines = split /\n/, <FH>;
close(FH);
my $most_recent_func_start_line = 0;
my $most_recent_handle_scope_line = 0;
my $line_no = 0;
foreach my $line (@lines) {
++$line_no;
if ( $line =~ /^{/ ) {
$most_recent_func_start_line = $line_no;
next;
}
if ( $line =~ /^}/ ) {
$most_recent_func_start_line = 0;
next;
}
if ( $line =~ /HandleScope/ ) {
$most_recent_handle_scope_line = $line_no;
next;
}
if ( $line =~ /\b(?:Local|Handle)\b/ ) {
if ( $most_recent_handle_scope_line <
$most_recent_func_start_line and
$most_recent_func_start_line > 0 ) {
warn "$filename:$line_no - no HandleScope found in function
\n".
"\tFunction started at line $most_recent_func_start_line
\n".
"\tConcern is from line content: $line\n";