Created
September 4, 2009 07:41
-
-
Save yappo/180787 to your computer and use it in GitHub Desktop.
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 Benchmark ':all'; | |
| use LWP::Simple; | |
| use Cache::Memcached::Fast; | |
| use WWW::Curl::Easy; | |
| use WWW::Curl::Share; | |
| my $mc = Cache::Memcached::Fast->new({ servers => [ 'localhost:12321' ] }); | |
| cmpthese(10000, { | |
| memcached => sub { | |
| die unless ($mc->get('/yappo') eq 'yappo'); | |
| }, | |
| curl => sub { | |
| my $curl = WWW::Curl::Easy->new; | |
| $curl->setopt(CURLOPT_URL, 'http://localhost:8080/yappo'); | |
| open my $content_fh, '>', \my $content; | |
| $curl->setopt( CURLOPT_WRITEDATA, $content_fh); | |
| $curl->perform; | |
| die unless ($content eq 'yappo'); | |
| }, | |
| http => sub { | |
| die unless (get 'http://localhost:8080/yappo') eq 'yappo'; | |
| }, | |
| }); | |
| __END__ | |
| Rate curl http memcached | |
| curl 2033/s -- -17% -44% | |
| http 2457/s 21% -- -32% | |
| memcached 3610/s 78% 47% -- | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment