I have a test script that uses Plack::Create to benchmark my server application. A stripped down, runnable version looks like this:
#!/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; } }
The real application is obviously more complex (it uses a DB, among others).
The problem with this is that Starman has a number of options, --max_requests and --workers being relevant here, that I can set from the command line (when starting as 'starman --workers' etc.), but not when starting it standalone like in the code above.
Is there a way to pass options to the server in the code above?
In reply to Starman options with Plack::Create by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |