Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re^2: A Perl Daemon

by habit_forming (Monk)
on Sep 06, 2005 at 20:07 UTC ( #489659=note: print w/replies, xml ) Need Help??

in reply to Re: A Perl Daemon
in thread A Perl Daemon

HA! 3-4 millibits. If all my problems were that small!

While I am not a mod_perl expert I am well versed in it. I understand that forking will not be more expensive and I know that it does not load the modules everytime you fork, that is just silly. And yes getting rid of Apache is my goal here. I would like a Perl daemon. Something that loafs around with precompiled modules sitting in it just waiting to be used by a script that needs them. A kind of module pre-compiler. I want to be able to define which modules I am going to use very frequently have them precompiled, held in a pristine state and ready for use. The only thing close I could think of was mod_perl. Perhaps it was a bad example.


Replies are listed 'Best First'.
Re^3: A Perl Daemon
by perrin (Chancellor) on Sep 06, 2005 at 20:14 UTC
    There is PPerl and SpeedyCGI, but really they're about the same as using mod_perl. You haven't provided any reason why mod_perl wouldn't meet your needs here. Maybe if you gave a specific example of how you want to use this, it would become more clear.
      Good point. The reason mod_perl does not meet my needs is because the code these scripts will be running does a lot of forking. The scripts do a lot of qx()'ing and system()'ing and such. And while I have tried to influence those writing these scripts not to do this, the problem persists. After all there are some good reasons to qx(). I tried mod_perl for quite some time and while much much faster I was getting strange behavior from Apache. Once I moved to CGI the strange behavior (i.e. defunct processes, unkillable children(hung on sockets), out of semaphore space errors, etc) cleared up completely. That is why I begrudgingly moved off of mod_perl.

      My base problem here is that I have a number of scripts that use a large complex of code. That complex of code is so large that this perl -MBigModuleTree -e 1 takes an average of 1.1 seconds. Yeah, it is pretty bad. So I am looking for a way to preload the thus reducing the time it takes to execute these scripts and also hopefully bringing the load down on the box.
      Hope this clears things up a bit.


        If you need something that task specific, then maybe doing something standalone with Net::Server would be a workable approach. You could load up BigModuleTree in your server script and then have the server prefork and wait for inbound work requests. Then just have your cgi script (under mod_perl or not) call out to the standalone server to do the work. You could serialize the CGI parameters and pass them over the connection to control behavior and then read back the response.

        POE could be another standalone environment that might work for you.


        Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Re^3: A Perl Daemon
by blazar (Canon) on Sep 07, 2005 at 09:33 UTC
    And yes getting rid of Apache is my goal here. I would like a Perl daemon. Something that loafs around with precompiled modules sitting in it just waiting to be used by a script that needs them. A kind of module pre-compiler.
    I must say that I have at best and extremely limited experience in this application area, but... I can't understand what your stated goals as in the quotation above could have to do with "getting rid of Apache". That is: once you have your hypothetical perld, do you want to use it to run a webserver written in Perl instead of Apache? If so, then there are some. But I doubt this is what you really want...
      What was meant by "getting rid of Apache" was in reference to merlyn's response.

      The fact of the matter is that I have many different processes, that are not Apache, that come up on their own and use to do their work. I really like mod_perl and the way it handles things except for it's forking behavior. So a "standalone" mod_perl was the metaphor I was using to describe this perld idea.

      I still plan on using Apache to run the CGI's I have to run (with or without perld). I still plan on using mod_perl where ever I can (when not forking a bunch) but when not in Apache I would like to have something that could speed-up execution like mod_perl does. And since mod_perl accomplishes a lot of it's speed by being persistent... I thought, well why not a sort-of Apache divorced generalized mod_perl? That is where the idea started.


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2022-01-24 15:19 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (64 votes). Check out past polls.