miyagawa / starman Goto Github PK
View Code? Open in Web Editor NEWStarman is a high-performance preforking Perl PSGI web server
Home Page: http://search.cpan.org/dist/Starman
License: Other
Starman is a high-performance preforking Perl PSGI web server
Home Page: http://search.cpan.org/dist/Starman
License: Other
If we send empty request to starman, we'v got an error like this "Read error: ".
It's because of "|| $read == 0" section after syscall.
Empty request is not an error, it doesn't set $! variable.
Sysread manual:
..Returns the number of bytes actually read, 0 at end of file, or undef if there was an error (in the latter case $! is also set)...
eval {
local $SIG{ALRM} = sub { die "Timed out\n"; };
alarm( READ_TIMEOUT );
while (1) {
# Do we have a full header in the buffer?
# This is before sysread so we don't read if we have a pipelined request
# waiting in the buffer
last if defined $self->{client}->{inputbuf} && $self->{client}->{inputbuf} =~ /$CRLF$CRLF/s;
# If not, read some data
my $read = sysread $self->{server}->{client}, my $buf, CHUNKSIZE;
if ( !defined $read || $read == 0 ) {
die "Read error: $!\n";
}
if ( DEBUG ) {
warn "[$$] Read $read bytes: " . dump($buf) . "\n";
}
$self->{client}->{inputbuf} .= $buf;
}
};
Hi,
When I start my psgi app with starman and provide a wrong lib path (for example), starman keeps retrying (endlessly) to start my app while reporting the same error.
Is this a bug?
If not, how can I make Starman die immediately on (compile) errors?
(Starman version 0.4001).
Hi,
I couldn't find any way to set sig_passthrough option for Net::Server out of box. Please advise if there is any known path, otherwise I will be happy to try and do a patch.
With the switch to Milla, you can install Starman on win32 by accident, while tests will most likely fail and doesn't run correctly.
We have to inject the check of OS in Build.PL with milla before-release script.
When running Starman with --Reload
and --daemonize
it isn't able to restart when a monitored file changes. It works fine when it isn't daemonized.
Output from error log (with --error_log
flag)
Process Backgrounded
2011/12/16-15:43:41 Starman::Server (type Net::Server::PreFork) starting! pid(18558)
Using default listen value of 128
Binding to TCP port 5000 on host *
Setting gid to "33 33 33"
Process Backgrounded
2011/12/16-15:43:49 Starman::Server (type Net::Server::PreFork) starting! pid(18573)
Using default listen value of 128
Binding to TCP port 5000 on host *
2011/12/16-15:43:49 Can't connect to TCP port 5000 on * [Address already in use]
at line 88 in file /usr/local/perls/perl-5.12.2/lib/site_perl/5.12.2/Net/Server/Proto/TCP.pm
2011/12/16-15:43:49 Server closing!
Hello,
I updated Starman (0.4001 -> 0.4006) and now i see many like these errors:
2013/09/02-21:21:58 Starman::Server (type Net::Server::PreFork) starting! pid(11390)
Binding to TCP port 2003 on host XX.XX.XX.XX with IPv4
Setting gid to "501 501 501"
write error: Broken pipe at /usr/local/lib/perl5/site_perl/5.16.2/Starman/Server.pm line 551.
write error: Broken pipe at /usr/local/lib/perl5/site_perl/5.16.2/Starman/Server.pm line 551, <$read> line 22.
write error: Broken pipe at /usr/local/lib/perl5/site_perl/5.16.2/Starman/Server.pm line 551, <$read> line 64205.
write error: Broken pipe at /usr/local/lib/perl5/site_perl/5.16.2/Starman/Server.pm line 551, <$read> line 16.
write error: Broken pipe at /usr/local/lib/perl5/site_perl/5.16.2/Starman/Server.pm line 551.
write error: Broken pipe at /usr/local/lib/perl5/site_perl/5.16.2/Starman/Server.pm line 551.
write error: Broken pipe at /usr/local/lib/perl5/site_perl/5.16.2/Starman/Server.pm line 551, <$read> line 8.
write error: Broken pipe at /usr/local/lib/perl5/site_perl/5.16.2/Starman/Server.pm line 551, <$read> line 97088.
write error: Broken pipe at /usr/local/lib/perl5/site_perl/5.16.2/Starman/Server.pm line 551, <$read> line 45.
Starman::Server::_finalize_response contains this code:
# Buffer the headers so they are sent with the first write() call
# This reduces the number of TCP packets we are sending
syswrite $conn, join( $CRLF, @headers, '' ) . $CRLF;
and later on the body is written:
syswrite $conn, $buffer;
This is doing two syscalls when only one is needed. I suggest saving the headers and prepend it to the first $buffer so for small responses only one call to write() is needed.
Starman::Server sets the process name to "starman master" and "starman worker". If multiple instances of starman run parallel on multiple ports this is confusing. It would help to be able to assign a process name to an instance of starman. How about a launcher option --name
?
To reproduce:
Sending children hup signal during HUP on prefork server
but the new code doesn't seem to be loaded. If starman is started without --preload-app it works as expected.
Tested with version 0.3005
Installing 0.4008 runs two tests for the new SSL functionality. On a system with LWP < version 6 they will fail because IO::Socket::SSL can be missing.
I asked on IRC and it was suggested that Starman should either depend on LWP::Protocol::https 6, or IO::Socket::SSL.
My personal preference is that SSL be a totally opt-in feature, and that SSL libs are not required for a basic installation.
If you need further details, please let me know.
With Plack 0.9971's $0 change, the HUP signal handling is broken, and the way Net::Server retrieves the original command line args.
We have the following test application with global sigdie handler:
#!/usr/bin/perl
use Carp qw(cluck);
BEGIN {$SIG{__DIE__} = sub {cluck @_}};
my $app = sub {
my $env = shift;
};
Starting it in common way:
starman --preload-app app.psgi
fires "commandline was not set during initialization" error
commandline was not set during initialization at /usr/local/perl-5.14.2/lib/site_perl/5.14.2/Net/Server.pm line 103.
at app.psgi line 9.
Plack::Sandbox::app_2epsgi::__ANON__('commandline was not set during initialization at /usr/local/p...') called at /usr/local/perl-5.14.2/lib/site_perl/5.14.2/Net/Server.pm line 103
Net::Server::commandline('Starman::Server=HASH(0x14fa6c8)') called at /usr/local/perl-5.14.2/lib/site_perl/5.14.2/Net/Server.pm line 92
eval {...} called at /usr/local/perl-5.14.2/lib/site_perl/5.14.2/Net/Server.pm line 92
Net::Server::_initialize('Starman::Server=HASH(0x14fa6c8)') called at /usr/local/perl-5.14.2/lib/site_perl/5.14.2/Net/Server.pm line 50
Net::Server::run('Starman::Server=HASH(0x14fa6c8)', 'port', 'ARRAY(0x1917740)', 'host', 'ARRAY(0x14e3348)', 'proto', 'ARRAY(0x1917770)', 'serialize', 'flock', ...) called at /usr/local/perl-5.14.2/lib/site_perl/5.14.2/Starman/Server.pm line 67
Starman::Server::run('Starman::Server=HASH(0x14fa6c8)', 'CODE(0x14e2e38)', 'HASH(0x14e30d8)') called at /usr/local/perl-5.14.2/lib/site_perl/5.14.2/Plack/Handler/Starman.pm line 18
Plack::Handler::Starman::run('Plack::Handler::Starman=HASH(0x14e2c10)', 'CODE(0x14e2e38)') called at /usr/local/perl-5.14.2/lib/site_perl/5.14.2/Plack/Loader.pm line 84
Plack::Loader::run('Plack::Loader=HASH(0x14dd5a8)', 'Plack::Handler::Starman=HASH(0x14e2c10)') called at /usr/local/perl-5.14.2/lib/site_perl/5.14.2/Plack/Runner.pm line 267
Plack::Runner::run('Plack::Runner=HASH(0x130fdb0)') called at /usr/local/perl-5.14.2/bin/starman line 31
2012/11/08-15:38:31 Starman::Server (type Net::Server::PreFork) starting! pid(6272)
Address family not supported by protocol at /usr/local/perl-5.14.2/lib/site_perl/5.14.2/Net/Server/Proto.pm line 133.
at app.psgi line 9.
Plack::Sandbox::app_2epsgi::__ANON__('Address family not supported by protocol at /usr/local/perl-5...') called at /usr/local/perl-5.14.2/lib/site_perl/5.14.2/Net/Server/Proto.pm line 133
eval {...} called at /usr/local/perl-5.14.2/lib/site_perl/5.14.2/Net/Server/Proto.pm line 133
Net::Server::Proto::get_addr_info('Net::Server::Proto', '*', 5000, 'tcp') called at /usr/local/perl-5.14.2/lib/site_perl/5.14.2/Net/Server/Proto.pm line 81
eval {...} called at /usr/local/perl-5.14.2/lib/site_perl/5.14.2/Net/Server/Proto.pm line 81
Net::Server::Proto::parse_info('Net::Server::Proto', 5000, '*', 'tcp', undef, 'Starman::Server=HASH(0x14fa6c8)') called at /usr/local/perl-5.14.2/lib/site_perl/5.14.2/Net/Server.pm line 279
Net::Server::port_info('Starman::Server=HASH(0x14fa6c8)', 5000, '*', 'tcp', undef) called at /usr/local/perl-5.14.2/lib/site_perl/5.14.2/Net/Server.pm line 264
Net::Server::prepared_ports('Starman::Server=HASH(0x14fa6c8)') called at /usr/local/perl-5.14.2/lib/site_perl/5.14.2/Net/Server.pm line 240
Net::Server::pre_bind('Starman::Server=HASH(0x14fa6c8)') called at /usr/local/perl-5.14.2/lib/site_perl/5.14.2/Net/Server.pm line 55
Net::Server::run('Starman::Server=HASH(0x14fa6c8)', 'port', 'ARRAY(0x1917740)', 'host', 'ARRAY(0x14e3348)', 'proto', 'ARRAY(0x1917770)', 'serialize', 'flock', ...) called at /usr/local/perl-5.14.2/lib/site_perl/5.14.2/Starman/Server.pm line 67
Starman::Server::run('Starman::Server=HASH(0x14fa6c8)', 'CODE(0x14e2e38)', 'HASH(0x14e30d8)') called at /usr/local/perl-5.14.2/lib/site_perl/5.14.2/Plack/Handler/Starman.pm line 18
Plack::Handler::Starman::run('Plack::Handler::Starman=HASH(0x14e2c10)', 'CODE(0x14e2e38)') called at /usr/local/perl-5.14.2/lib/site_perl/5.14.2/Plack/Loader.pm line 84
Plack::Loader::run('Plack::Loader=HASH(0x14dd5a8)', 'Plack::Handler::Starman=HASH(0x14e2c10)') called at /usr/local/perl-5.14.2/lib/site_perl/5.14.2/Plack/Runner.pm line 267
Plack::Runner::run('Plack::Runner=HASH(0x130fdb0)') called at /usr/local/perl-5.14.2/bin/starman line 31
Resolved [*]:5000 to [0.0.0.0]:5000, IPv4
Host [*] resolved to IPv6 address [::] but IO::Socket::INET6->new fails: Address family not supported by protocol at /usr/local/perl-5.14.2/lib/site_perl/5.14.2/Net/Server/Proto.pm line 133.
Binding to TCP port 5000 on host 0.0.0.0 with IPv4
Setting gid to "30328 30328 30328 30489 30490"
I am sorry for the lack of details, I am not able to share much and I fear this report will not be very useful. Miyagawa asked me to write it though
App: mod_perl/cgi app converted to plack using WrapCGI (not using execute flag)
When we enable starman's ssl we seem to have an issue where the page never fully loads.
I am afraid I cannot share the app or configuration that produces this issue, and I have not created a small sample test case yet, if I manage to do it I will attach it. According to Miyagawa others have mentioned the same issue.
If you have a psgi application that uses the FindBin module starman seems to crash when restarting worker processes.
For example if I have a simple app.psgi like
#!/usr/bin/perl
use FindBin;
my $app = sub {
my $env = shift;
return [
'200',
[ 'Content-Type' => 'text/plain' ],
[ "Hello World" ],
];
}
when I run it with starman -E development --max-requests=1 --workers=1 app.psgi
I just need to do one request make it crash. This what I see on my console:
starman -E development --max-requests=1 --workers=1 app.psgi
2011/02/22-15:25:20 Starman::Server (type Net::Server::PreFork) starting! pid(3022)
Binding to TCP port 5000 on host *
Setting gid to "100 100 33 100"
Starman: Accepting connections at http://*:5000/
Error while loading app.psgi: Cannot find current script 'starman master -E development --max- requests=1 --workers=1 app.psgi' at /usr/lib/perl5/5.10.0/FindBin.pm line 206
BEGIN failed--compilation aborted at /usr/lib/perl5/5.10.0/FindBin.pm line 206, <_READ> line 2.
Compilation failed in require at app.psgi line 2, <_READ> line 2.
BEGIN failed--compilation aborted at app.psgi line 2, <_READ> line 2.
Error while loading app.psgi: Cannot find current script 'starman master -E development --max-requests=1 --workers=1 app.psgi' at /usr/lib/perl5/5.10.0/FindBin.pm line 206
...
Maybe FindBin crashes because of the line
$0 = "starman worker " . join(" ", @{$self->{options}{argv} || []});
in Starman::Server::child_init_hook
On perl 5.14.0, CentOS 5.6 one of the harakiri test sometimes/mostly fails with:
# Failed test 'In non-harakiri mode, pid is reused'
# at /var/lib/hudson/jobs/combust/workspace/cpan/lib/perl5/Test/More.pm line 377.
# got: '3'
# expected: '5'
and make delayed loader the default, and calls psgi_app_builder in child_init_hook if it's set
to avoid issues with stupid frontend proxies like mod_proxy. We could probably do the same for all http-11 features as well?
This is on Pod::Usage 1.16:
$ starman --help
Can't locate object method "initialize" via package "Pod::Usage" ...
Upgrading to 1.36 makes the problem go away, so the initialize method was added somewhere between 1.16..1.36.
Starman either needs to have a dependency on the latest version or whatever version introduced that API.
I'm getting strange performance behaviour with Starman 0.1006.
Unfortunately my test case is "run this big complex webapp" so I'm not sure how useful this bug report is going to be.
Basically, on the new PSGI branch of WebGUI, I get stable ~300 req/sec when running under Starlet.
Performance is measured via: ab -t 5 -c 10 -k
Whereas when using Starman, I get anything from 1 req/sec to 30 req/sec. No errors or warnings that I can see, just crazy performance.
Tried --workers 1 but nothing changed.
Tried --disable-keepalive and problem immediately went away (getting stable ~370 req/sec).
To double-check that it wasn't a keepalive problem caused by WebGUI, I tried Starlet with --max-keepalive-reqs 100, but the reqs/sec didn't change.
Happy to help debug this, but not sure where to start.
Cheers,
Patrick
This is a new FreeBSD VM, and I've just used perlbrew to install 5.14.2 locally...
FreeBSD 8.2-RELEASE FreeBSD 8.2-RELEASE #1
prove -lvr t/suite.t
t/suite.t .. 2011/12/30-19:48:04 Starman::Server (type Net::Server::PreFork) starting! pid(77243)
Binding to TCP port 50026 on host 127.0.0.1
Setting gid to "1003 1003 1003"
not ok 46
# Failed test at /home/lpm/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/Plack/Test/Suite.pm line 248.
# got: 'REQUEST_METHOD:GET
# SCRIPT_NAME:
# PATH_INFO:/foo/
# QUERY_STRING:dankogai=kogaidan
# SERVER_NAME:179.25.7.30
# SERVER_PORT:50026
# '
# expected: 'REQUEST_METHOD:GET
# SCRIPT_NAME:
# PATH_INFO:/foo/
# QUERY_STRING:dankogai=kogaidan
# SERVER_NAME:127.0.0.1
# SERVER_PORT:50026
I didn't know how the box is configured (being a Debian person) but thought I'd report it, have just force installed :)
reported by @timbunce
When you run starman with start_server
with the development environment, it displays:
Starman: Accepting connections at http://*:5000/
when it's actually not listening on the port, which is wrong and confusing.
Reproduction steps:
create app.psgi containing:
my $app = die 'this app cannot be created!';
then:
starman --preload-app --error-log error.log app.psgi
The error log does not capture any details about the death (indeed it is totally empty). It should be obvious in the log that the app crashed, but it is not.
I'm not sure if this is really an issue with Plack::Runner or Net::Server::* ? Just doing plackup app.psgi properly dumps the error to the console.
Hello,
My situation is the following.
I use starman to serve a Perl Dancer API application. My main client timeout after 10 seconds. But the starman still run after if the request is really big (BigData project) then if a client call the API on the same server instance which still run then it doesn't answer.
Is there a way to set a time out on starman which stop the execution of Dancer request ?
Thank you
Nicolas
I believe that the option listen of starman (IP:PORT format for example) is decided by Net::Server inside as backlog option because the last looks in @argv as i think
From doc of Net::Server:
listen \d+ SOMAXCONN
I got messages in error.log of starman:
Argument "XX.XX.XX.XX:PPPP" isn't numeric in numeric gt (>) at /usr/local/lib/perl5/5.16.2/x86_64-linux-thread-multi/IO/Socket.pm line 224.
I looked in code, added 'carp' to $SIG{WARN} inside Socket.pm (224) and got:
Argument "XX.XX.XX.XX:PPPP" isn't numeric in numeric gt (>) at /usr/local/lib/perl5/5.16.2/x86_64-linux-thread-multi/IO/Socket.pm line 224.
at /usr/local/lib/perl5/site_perl/5.16.2/Net/Server.pm line 325
The submodule Net::Server::Proto::TCP has lines:
$sock->NS_listen(defined($info->{'listen'}) ? $info->{'listen'}
: defined($server->{'server'}->{'listen'}) ? $server->{'server'}->{'listen'}
: Socket::SOMAXCONN());
I am sure that listen there as my IP:PORT
So when i run:
starman --listen IP:PORT --backlog 6000
I have backlog as 'IP:PORT' (may be first digit in my IP address)
Please check up this
Thanks
Perlover
I start a mojolicious app (default mojolicious app) using starman:
$ starman script/app
And send request and receive Internal Server Error.
Error log:
Cannot find current script 'starman worker -I/tk/mojo/lib script/app' at /usr/lib/perl5/5.12.1/FindBin.pm line 205
BEGIN failed--compilation aborted at /usr/lib/perl5/5.12.1/FindBin.pm line 205.
Compilation failed in require at /tk/mojo/lib/Mojo/Home.pm line 12.
BEGIN failed--compilation aborted at /tk/mojo/lib/Mojo/Home.pm line 12.
Compilation failed in require at /tk/mojo/lib/Mojo.pm line 13.
BEGIN failed--compilation aborted at /tk/mojo/lib/Mojo.pm line 13.
Compilation failed in require at (eval 72) line 2.
...propagated at /usr/lib/perl5/5.12.1/base.pm line 94.
BEGIN failed--compilation aborted at /tk/mojo/lib/Mojolicious.pm line 8.
Compilation failed in require at (eval 71) line 2.
...propagated at /usr/lib/perl5/5.12.1/base.pm line 94.
BEGIN failed--compilation aborted at script/../lib/App.pm line 6.
Compilation failed in require at (eval 70) line 2.
But Mojolicious::Lite app works correctly.
And plackup works:
$ plackup script/app
Only starman fail.
hmm, jifty is not very happy with starman... maybe dbi and forking time issue
When using Plack::Middleware::Lint and Starman running with a Unix socket. Lint croaks due to the PSGI environment not having SERVER_NAME or SERVER_PORT values
If you're using delayed app loading (default) and a PSGI app can't be loaded, the error log is spammed with the following messages:
Error while loading /path/to/app.psgi: error message
This causes the log file to grow quickly even if there's no other activity on the server which can be pretty dangerous if it isn't detected soon enough.
The reason is that with delayed loading, the PSGI app is loaded in the child_init_hook
where an uncaught exception causes the child to terminate. Another child is respawned immediately which will result in the same error message again and again.
I'd like to have the option to shut the whole server down in this case but I'm not sure if this is possible with Net::Server
.
Another solution would be to catch exceptions in child_init_hook
, log them once and let the child run. Then another error could be logged on every request which should result in much less log spam.
REMOTE_ADDR
not set when running on unix socket. Maybe just set it it to 127.0.0.1
if not passed in?
What is the right way to reopen log file (--error-log) for graceful rotation ?
Plack version: 1.0020
Starman version: 0.3007
Perl version: v5.10.1
After Starman update(from 3.006 to 3.007) i've got error:
Error while loading development.pm: No such file or directory at (eval 7) line 4.
On 3.006 starman all works fine.
Starman starting comand:
/usr/local/bin/starman --user nginx --group nginx --error-log /var/log/starman/s_error.log --workers 5 -D -E development --pid /var/run/starman.pid -I/var/spool/app/lib --listen /var/run/starman.socket /var/spool/app/psgi/app.psgi >> /var/log/starman/starman.log
On another server without updates all fine.
Updated modules:
Starman
Plack
UPD: it seems, starman update OK. All works fine with Starman 0.3007 and Plack 1.0018.
if you use the application in the parent with --preload-app
and then use modules that calls rand(), such as File::Temp, and then later in the children again, your child processes get the same stream of rand() because the seed was initialized in the parent.
Does it make sense to call srand() by Starman, or at least should we document that as a known issue?
See File::Temp/Forking for details.
Setting $0 to starman master breaks the app loading FindBin.
In Starman::Server::_finalize_response()
if the protocol is HTTP/1.1 and there is no content-length header, but the body has already been Chunked encoded (such as via Plack::Middleware::Chunked), then an extra 'Transfer-Encoding' header is added to @headers and the body ends up being chunk encoded twice.
I think Starman::Server can override hup_server etc. and register its own $SIG{QUIT} to implement this.
So you can sudo to port to lower port but run the server as a non-root user
Starman ignores errors while buffering the full request body.
When the TEMPDIR is full Plack::TempBuffer->print() would return 0 and set $! to ENOSPC. But this possible error is not catched by Starman. This means that the application will get a silently truncated body with the expectation that buffering succeeded.
Starman should either die (or better return with status code 413) or stop transparently buffering (which might be hard) when printing to the buffer fails.
Tell me if you can reproduce this. Here's a simple app that streams and infinite response. Notice that a warning is emitted to the server console after each write():
my $app = sub {
return sub {
my $responder = shift;
my $headers = ['Content-Type' => 'text/plain'];
my $writer = $responder->( [200, $headers] );
while (1) {
$writer->write("SOME OUTPUT\n");
warn "Wrote stuff\n";
}
};
}
Now launch that on a remote machine, using just one worker (and keep the console open so you can see the warnings).
starman --workers 1 app.psgi
From a different machine, hit the server (e.g):
curl http://remotehost:5000
After you start receiving the stream on localhost, abort the curl
command by pressing Ctrl-C.
At this point, the next call to write() appears to block indefinitely, and the server does not emit any more warnings.
But if you do the same experiment using the same machine for both server and client, then write() does not block and the server continues to emit warnings.
I'm using a Mac and a Debian machine as my client & server (respectively). I suspect this has something to do with TCP/IP fundamentals more than it does Starman. So maybe you just need to educate me a bit here.
I've deploy a dancer app on Starman (cpan version v0.2004).
But the cpu usage is very high! I must to nice it, otherwise it will grownup to 100%.
So, I switch to Plack and FCGI handler, it works fine.
My app is deployed on:
So, any suggest about the problem? How can I deal this?
BTW, I can't install with git version, it fatal:
include /usr/local/src/Starman/inc/Module/Install.pm
String found where operator expected at Makefile.PL line 9, near "readme_from 'lib/Starman.pm'"
(Do you need to predeclare readme_from?)
syntax error at Makefile.PL line 9, near "readme_from 'lib/Starman.pm'"
Bareword "auto_set_repository" not allowed while "strict subs" in use at Makefile.PL line 25.
Execution of Makefile.PL aborted due to compilation errors.
Hello,
Now i see a following warning (in terminal) when i start Starman process: Use of uninitialized value $opt in lc at /usr/local/lib/perl5/site_perl/5.16.2/Starman/Server.pm line 70
When i had Starman version 0.4001 i got same error:
Use of uninitialized value $opt in lc at /usr/local/lib/perl5/site_perl/5.16.2/Starman/Server.pm line 69.
In previous versions i didn't see like these warnings
This is related to issue #448 in the Plack project.
My environment uses a sitecustomize.pl
file that loads FindBin. Even in the cases where the sitecustomize.pl
is a no-op, the fact that FindBin has already been loaded causes t/findbin.t
to fail.
The test can be made robust by adding a call to FindBin::again()
after the use FindBin
statement as described in the FindBin known issues section.
%starman -e "sub {return ['302', ['Content-Length' => '0'], ['']]}"
%telnet localhost 5000
GET / HTTP/1.1
Host: example.com
HTTP/1.1 302 Found
Content-Length: 0
Transfer-Encoding: chunked
Date: Tue, 01 Jun 2010 10:47:56 GMT
Connection: keep-alive
0
patch and test code is http://gist.github.com/420748
http://github.com/cho45/Starman/commits/ has very interesting fixes to allow server-status but this needs refactoring.
Because Starman mangles $0, using FindBin in the child process causes issues (actually crashes the process). Preloading FindBin with -MFindBin
will avoid the crash but it will return $FindBin::Bin as the 'plackup' or 'starman' path, not the .psgi path.
You're suggested to use __FILE__
instead. And maybe we can think of a way to trick FindBin (or at least localize $0 when evaluating .psgi)
Hi.
I have FreeBSD 8.2-PRERELEASE amd64 server (*default tag=RELENG_8)
CPU: Intel(R) Core(TM)2 Duo CPU E7400 @ 2.80GHz
real memory = 4294967296 (4096 MB)
avail memory = 4076785664 (3887 MB)
Im start myapp.pl ( Mojolicious::Lite )
/usr/local/bin/starman
-MMojolicious
-MDBI
--daemonize
--socket /tmp/socketfarm.sock
--pid /var/run/socketfarm.pid
--workers 32
--preload-app myapp.pl
--user www
--group www
--access-log ./socketfarm_access.log
--error-log ./socketfarm_error.log
--backlog 2048.
and test
/usr/local/apache/bin/ab -n 1000 -c 100 http://my_domen/login/
i have many errors from log
[Wed Jul 13 11:33:54 2011] [debug] 200 OK (0.002060s, 485.437/s).
[Wed Jul 13 11:33:54 2011] [debug] Rendering template "login.html.ep" from DATA section.
[Wed Jul 13 11:33:54 2011] [debug] GET /login/ (ApacheBench/1.3d).
[Wed Jul 13 11:33:54 2011] [debug] Dispatching callback.
...
[Wed Jul 13 11:33:54 2011] [debug] Dispatching callback.
[Wed Jul 13 11:33:54 2011] [debug] Template "login.html.ep" not found.
[Wed Jul 13 11:33:54 2011] [debug] 200 OK (0.001914s, 522.466/s).
[Wed Jul 13 11:33:54 2011] [debug] Template "login.html.ep" not found.
[Wed Jul 13 11:33:54 2011] [debug] GET /login/ (ApacheBench/1.3d).
...
[Wed Jul 13 11:33:54 2011] [error] Global symbol "$nosocks" requires explicit package name at (eval 244) line 35.
Global symbol "$lists" requires explicit package name at (eval 244) line 42.
Global symbol "$mydata" requires explicit package name at (eval 244) line 66.
Global symbol "$notask" requires explicit package name at (eval 244) line 107.
Global symbol "$tasks" requires explicit package name at (eval 244) line 112.
Global symbol "$tasks" requires explicit package name at (eval 244) line 114.
Global symbol "$tasks" requires explicit package name at (eval 244) line 115.
Global symbol "$tasks" requires explicit package name at (eval 244) line 116.
Global symbol "$tasks" requires explicit package name at (eval 244) line 116.
Global symbol "$tasks" requires explicit package name at (eval 244) line 118.
Global symbol "$tasks" requires explicit package name at (eval 244) line 127.
Global symbol "$tasks" requires explicit package name at (eval 244) line 130.
Global symbol "$nosocks" requires explicit package name at (eval 244) line 134.
Global symbol "$error" requires explicit package name at (eval 244) line 141.
Missing right curly or square bracket at (eval 244) line 151, at end of line
(eval 244) has too many errors.
This is ApacheBench, Version 1.3d <$Revision: 1.73 $> apache-1.3
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking contiblem.net (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Finished 1000 requests
Server Software: nginx/0.9.3
Server Hostname: contiblem.net
Server Port: 80
Document Path: /login/
Document Length: 973 bytes
Concurrency Level: 100
Time taken for tests: 2.605 seconds
Complete requests: 1000
Failed requests: 47
(Connect: 0, Length: 47, Exceptions: 0)
Broken pipe errors: 0
Non-2xx responses: 47
Total transferred: 1123472 bytes
HTML transferred: 934001 bytes
Requests per second: 383.88 #/sec
Time per request: 260.50 ms
Time per request: 2.61 [ms](mean, across all concurrent requests)
Transfer rate: 431.28 [Kbytes/sec] received
Connnection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 1
Processing: 19 249 57.5 232 499
Waiting: 18 248 57.4 232 498
Total: 19 249 57.5 232 499
ERROR: The median and mean for the initial connection time are more than twice the standard
deviation apart. These results are NOT reliable.
Percentage of the requests served within a certain time (ms)
50% 232
66% 237
75% 243
80% 248
90% 305
95% 396
98% 457
99% 476
100% 499 (last request)
Part of the query produces a 404 ...
nginx.conf
...
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_request_headers on;
proxy_pass_request_body on;
proxy_intercept_errors on;
proxy_pass http://unix:/tmp/socketfarm.sock;
proxy_redirect default;
}
This is perl 5, version 12, subversion 3 (v5.12.3) built for amd64-freebsd-thread-multi
[manu@orient Starman-0.3011]$ ./Build install --destdir /home/manu/tmp/foo
[..]
Installing /home/manu/tmp/foo/usr/local/share/man/man3/.::Starman.3pm
[...]
I'm not sure whether this comes from Starman or Module::Build::Tiny (0.018 was used here).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.