![]() |
|
"be consistent" | |
PerlMonks |
Re: Structure (timer) calling a method regularly in case of inactivityby Joost (Canon) |
on Jul 27, 2007 at 23:03 UTC ( [id://629222]=note: print w/replies, xml ) | Need Help?? |
Just how many servers (switches) are we talking about?
If it's a fairly small number and/or your program is reasonably memory efficient, you could fork a separate process for each server. That would probably simplify the timeout issues, since you only need to deal with one connection and timer per process. If you have many servers and you can't afford to fork a process for each, my approach would be to use IO::Select with non-blocking IO. It's low-level but very efficient if done right. On the other hand, it's not a very easy technique if you're not familiar with select() and/or perl. Perl threads are IMHO completely useless for this kind of thing, since you can probably not share enough data to make it significantly more efficient than just fork()ing more processes.
In Section
Seekers of Perl Wisdom
|
|