Created
October 17, 2012 07:11
-
-
Save toritori0318/3904166 to your computer and use it in GitHub Desktop.
Redisベンチマーク(Parallel::Benchmark / MBA版)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use strict; | |
| use warnings; | |
| use Data::Dumper; | |
| use Parallel::Benchmark; | |
| use RedisDB; | |
| my $bm = Parallel::Benchmark->new( | |
| setup => sub { | |
| my $self = shift; | |
| $self->stash->{redis} = RedisDB->new(host => 'localhost', port => 6379); | |
| }, | |
| benchmark => sub { | |
| my ($self, $id) = @_; | |
| my $redis = $self->stash->{redis}; | |
| my $status = $redis->set('hoge', 'fuga'); | |
| #my $status = $redis->lpush('list_key', '{"hyoro":"1234567890"}'); | |
| #$self->stash->{result}->{ success }++; | |
| 1; | |
| }, | |
| teardown => sub { | |
| my $self = shift; | |
| delete $self->stash->{redis}; | |
| }, | |
| time => 1, | |
| ); | |
| for my $c ( 1, 2, 4, 8, 16 ) { | |
| $bm->concurrency($c); | |
| my $result = $bm->run(); | |
| #print Dumper $result; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| torii-MBA:fujiwara:% perl pb_redis.pl 2012-10-17T16:09:42 [INFO] starting benchmark: concurrency: 1, time: 1 | |
| 2012-10-17T16:09:45 [INFO] done benchmark: score 11041, elapsed 1.001 sec = 11028.637 / sec | |
| 2012-10-17T16:09:45 [INFO] starting benchmark: concurrency: 2, time: 1 | |
| 2012-10-17T16:09:48 [INFO] done benchmark: score 18174, elapsed 1.001 sec = 18154.774 / sec | |
| 2012-10-17T16:09:48 [INFO] starting benchmark: concurrency: 4, time: 1 | |
| 2012-10-17T16:09:51 [INFO] done benchmark: score 26070, elapsed 1.001 sec = 26040.789 / sec | |
| 2012-10-17T16:09:51 [INFO] starting benchmark: concurrency: 8, time: 1 | |
| 2012-10-17T16:09:54 [INFO] done benchmark: score 28106, elapsed 1.004 sec = 27997.897 / sec | |
| 2012-10-17T16:09:54 [INFO] starting benchmark: concurrency: 16, time: 1 | |
| 2012-10-17T16:09:57 [INFO] done benchmark: score 28849, elapsed 1.014 sec = 28456.591 / sec | |
| torii-MBA:fujiwara:% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment