Subscribed unsubscribe Subscribe Subscribe

Hateburo: kazeburo hatenablog

Operations Engineer / Site Reliability / 運用系小姑 / Perl Monger

Starlet 0.20 supports HTTP/1.1 / Benchmark by wrk

PSGI/Plack HTTP server Starlet 0.20 that was released last week, supports HTTP/1.1.

https://metacpan.org/release/Starlet
https://github.com/kazuho/Starlet

Previous versions of Starlet only support HTTP/1.0 and HTTP/1.0 keepalive, but finally support HTTP/1.1 in 0.20. These specs are supported.

  • HTTP/1.1 keepalive
  • Transfer-Encoding: chunked (Request & Response)
  • Expect
  • HTTP Pipelining

benchmark with wrk

I did benchmark with wrk. wrk is a HTTP/1.1 benchmark tool.

f:id:kazeburo:20130826163535p:plain

Starlet has good performace. 2x faster than Starman on "OK" most simple benchmark.

I did this benchmark on servers that have Xeon L5630 2.13GHz (4core/8thread) * 2. softwares were.

perl-5.18.0
Starman (0.4006)
Starlet (0.20)
Monoceros (0.19)
EV (4.15)
Guard (1.022)
Plack (1.0029)
HTTP::Parser::XS (0.16)

I started plack servers with these options.

[Starman] plackup -s Starman -E produnction --workers=16 --max-requests 10000  -a app.psgi
[Starlet] plackup -s Starlet -E produnction --max-workers 16 --max-keepalive-reqs 10000 --max-reqs-per-child 10000  -a app.psgi
[Monoceros] plackup -s Monoceros -E produnction --max-workers 16 --max-reqs-per-child 10000 --max-readahead-reqs 500 -a app.psgi

and for "OK" benchmark

[Starman] plackup -s Starman -E produnction --workers=16 --max-requests 10000 -e "sub {[200,[],["OK"]]}"

app.psgi were

use Plack::Builder;
use Plack::Request;||<my $length = 12;
my $body = 'x'x$length;
builder {
    enable 'AccessLog', logger => sub { };
    sub {
        my $env = shift;
        my $req = Plack::Request->new($env);
        my @params = $req->param('foo');   
        [200, ['Content-Type'=>'text/plain'],[$body]]
    }
};

and wrk options

$ wrk -c 15 -t 5 -d 10 'http://x.x.x.x:5000/foo?foo=bar&bar=baz&baz=hoge&hoge=foo'