#!/usr/bin/perl use Modern::Perl '2015'; use Plack::Test; use Plack::Builder; use HTTP::Request::Common; use Benchmark; my $real_app = sub { my $env = shift; $env->{user_id} = 1; return [200, ['Content-Type', 'text/plain'], ['ok']]; }; $Plack::Test::Impl = 'Server'; $ENV{PLACK_SERVER} = 'Starman'; my $test_starman = Plack::Test->create($real_app); my $count = $ARGV[0] // 10_000; my $block = $ARGV[1] // 1; for (0..$count) { my $response = $test_starman->request(POST "/test/ok", Content => '' ); if ($response->code() == 200) { print "$_\r"; } else { print "\n$_\n"; last; } }