Ok, here is a little test prog with HTTP::Daemon it has a smaller memfootprint than any of my apache servers and serves about 800 requests/sec for a "hello world" example. Here is the output of ab followed by the script for your tests at home.
~/httpd/bin/ab -c 10 -n 500 http://peggy:9876/hello This is ApacheBench, Version 1.3d <$Revision: 1.69 $> apache-1.3 Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustec +h.net/ Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apa +che.org/ Benchmarking peggy (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Finished 500 requests Server Software: libwww-perl-daemon/1.26 Server Hostname: peggy Server Port: 9876 Document Path: /hello Document Length: 12 bytes Concurrency Level: 10 Time taken for tests: 0.621 seconds Complete requests: 500 Failed requests: 0 Broken pipe errors: 0 Total transferred: 73500 bytes HTML transferred: 6000 bytes Requests per second: 805.15 [#/sec] (mean) Time per request: 12.42 [ms] (mean) Time per request: 1.24 [ms] (mean, across all concurrent request +s) Transfer rate: 118.36 [Kbytes/sec] received
#!/usr/bin/perl use bytes; use HTTP::Daemon; use HTTP::Status; $SIG{PIPE} = 'IGNORE'; my $res = HTTP::Response->new(RC_OK); $res->content("Hello World\n"); $res->content_type('text/plain'); $|++; my $d = HTTP::Daemon->new( LocalPort => 9876, ReuseAddr => 1 ) || die; print "Please contact me at: <URL:", $d->url, ">\n"; for ( 1 .. 20 ) { my $pid = fork; next if $pid; next unless defined $pid; do { flock $d, 2; my $c = $d->accept; flock $d, 8; my $oldfh = select($c); $|++; select($oldfh); while ( my $r = $c->get_request ) { if ( $r->method eq 'GET' ) { #and $r->url->path eq "/hello" ) { $c->send_response($res); } else { $c->send_error(RC_FORBIDDEN); } } $c->close; undef($c); } while (1); exit 0; } while (1) { waitpid( -1, 0 ) }
Boris

In reply to Re: Re: using HTTP::Daemon instead of Apache by borisz
in thread using HTTP::Daemon instead of Apache by schweini

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.