Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Perl Performance Question

by Mungbeans (Pilgrim)
on Jun 14, 2001 at 14:44 UTC ( [id://88352]=note: print w/replies, xml ) Need Help??


in reply to How can I maximize performance for my router netflow analyzer? (was: Perl Performance Question)

You may be able to multi/thread this without using forks. I don't know what your data looks like so this may or may not work.

Architecture: 1 master co-ordinating process, an arbitrary number of children (depending on CPU's, OS) that do the work.

  • Packet comes in, master assigns it to a child.
  • Child reads packet and processes it, dumping the output in a central repository

The key bit is the children are always alive (you don't launch them with fork as this has a start up hit) but they're quiescent unless they've got something to do. The communication between the master and child processes needs to be very fast (disk io probably too slow) but you could use IPC (unix interprocess communication) between the processes which is faster I think.

If you keep losing packets, then add more children. This should work well if you have multiple CPUs on Unix. You will start to get processor bound with too many children.

Caveat: I haven't done this, I've seen it done in Informix 4gl which is much less functional than Perl. There should be some CPAN modules which look after IPC for you.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-24 19:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found