Skip to content

Instantly share code, notes, and snippets.

@kazeburo
Created August 12, 2011 01:30
Show Gist options
  • Save kazeburo/1141248 to your computer and use it in GitHub Desktop.
Save kazeburo/1141248 to your computer and use it in GitHub Desktop.
--- memcachedos.pl 2011-08-12 10:30:29.000000000 +0900
+++ dos/memcachedos.pl 2011-08-11 14:13:09.000000000 +0900
@@ -7,11 +7,17 @@
use strict;
use warnings;
+use FindBin;
+use lib "$FindBin::Bin/extlib/lib/perl5";
use AnyEvent;
use AnyEvent::Socket;
+use BSD::Resource;
die "$0 <host> <port> <fork num>" unless @ARGV;
+setrlimit(RLIMIT_NOFILE,300000,300000);
+warn getrlimit(RLIMIT_NOFILE);
+
# Options
my $maxconn = 10000;
my $activeconn = 900;
@@ -45,9 +51,11 @@
};
};
+ my $prev=0;
my $logger = AE::timer 0, 3, sub {
- printf "TIME:%s PID:%s Connect:%s Active:%s Success:%s Closed:%s Fail:%s Msg:%s\n", time - $start_at, $$,
- $i, scalar @fh, $success, $closed, $fail, $last_error;
+ printf "TIME:%s PID:%s Connect:%s QPS:%s Active:%s Success:%s Closed:%s Fail:%s Msg:%s\n", time - $start_at, $$,
+ $i, $success - $prev, scalar @fh, $success, $closed, $fail, $last_error;
+ $prev = $success;
};
# my $t1 = AE::timer 1000, 0, sub { $cv->send };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment