Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: keep a module in shared memory

by afoken (Parson)
on Sep 13, 2009 at 10:36 UTC ( #794980=note: print w/ replies, xml ) Need Help??


in reply to keep a module in shared memory

Start a small process for each email that just puts the incoming email into a queue. Have second, large process that processes the queue step by step. Look at the docs of your Mail Transport Agent, it may already have a usable queueing mechanism and a hook to process the queue elements.

The MTA hook may start a process for each queue element. Instead of using a fat perl script there, you could again resort to a small process that connects to a permanently running, fat server process.

For IPC, you could use Unix sockets, named pipes, raw TCP sockets, or HTTP, for example. Raw TCP or Unix sockets are easy to implement, about 100 lines C-Code, resulting in a fast and small executable.

I prefer using daemontools to manage servers, because daemontools take care of turining a simple and stupid script into a fully-featured daemon, complete with reliable logging, restarting, managing and so on.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)


Comment on Re: keep a module in shared memory

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2014-09-17 10:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (72 votes), past polls