Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: HTTP::Server::Simple forking/SSL/IPv6

by cavac (Chaplain)
on Oct 24, 2011 at 13:56 UTC ( #933408=note: print w/ replies, xml ) Need Help??


in reply to Re: HTTP::Server::Simple forking/SSL/IPv6
in thread HTTP::Server::Simple forking/SSL/IPv6

To be absolutely honest: I have no idea.

I started to develop a small in-house webservice with HTTP::Server::Simple::CGI and it grew over time to a big, mission critical central service. Since i started, i extended HSSC. A few days ago, at a request from a friend, i pulled the relevant code from Maplat and put it into it's own module.

With HSSC it's somehow like a marriage. It's quite easy to start, but very time consuming and expensive to get rid of. And while it lasts, you get in trouble very quickly if you are unfaithful to your selected partner. So, no, i never took the time to compare with other frameworks.

I can only say this for performance and stability: I'm running a webservice with about 50 users and like cyclic 300-500 automated clients without any troubles on a midrange linux server. And it only ever fails on me when i don't test my updates. Other than that, HSSC(P) runs quite smoothly.

Don't use '#ff0000':
use Acme::AutoColor; my $redcolor = RED();
All colors subject to change without notice.


Comment on Re^2: HTTP::Server::Simple forking/SSL/IPv6
Re^3: HTTP::Server::Simple forking/SSL/IPv6
by Corion (Pope) on Oct 24, 2011 at 14:03 UTC

    Moving from HTTP::Server::Simple to a PSGI setup using Plack shouldn't be hard. In HTTP::Server::Simple(::CGI), you have the subroutine handle_request, which prints its output. In PSGI, you have an anonymous subroutine that returns the HTML to be sent.

    This is the part you need to change, instead of printing your HTML, you return a triplet of [ $status, $headers, $body ].

      Well, in my case there's probably a bit more work involved. I also do things like on-the-fly HTTP compression, keeping database connections open, etc...

      If i understand correctly, the various files are loaded on request and not on startup? Or am i misreading the documentation?

      If everything is in an anonymous subroutine, how does debugging work? With Maplat (my framework), i just start the script with the appropriate breakpoints set and then surf to the page i want to debug.

      Edit: On a personal note, Corion, i really love the Power-to-Ethernet cable on your homenode. Where can i get one?

      Don't use '#ff0000':
      use Acme::AutoColor; my $redcolor = RED();
      All colors subject to change without notice.

        Depending on the backend (HTTP::Server::Simple, Starman, Corona, ...) you get persistence of connections and other values, or not (for example with Plack::Handler::CGI). The files are loaded on program startup, which is server startup for the permanent servers and page request for CGI.

        Having in-process debugging is something I have no experience with. Only the outermost part of your web application is an anonymous subroutine, everything else can be named subroutines, so finding your way around should work the same still. I guess a quick test whether your debugging setup works would be to just use one of the Plack example applications, set your breakpoints and see whether the program is debuggable under whatever server you plan to use.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://933408]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2014-10-25 19:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (148 votes), past polls