contactme has asked for the wisdom of the Perl Monks concerning the following question:

I have to write a simulation program which will be testing our server which supports many features(e.g. Email, FTP,WWW and many more). As it's a simulation test we would like to test these features in parallel,same as done in the real world. What would be the best approach: A thread model or multi-process model(using Proc:Simple?) or anything else ?

I don't know whether POE will fit into this scenario as I don't know much abt POE(in fact just have started reading about it) Thanks
  • Comment on threads or processes ? - Simulation test

Replies are listed 'Best First'.
Re: threads or processes ? - Simulation test
by perrin (Chancellor) on Feb 04, 2008 at 18:36 UTC
    If this is a unix server, processes will scale better than threads due to the memory savings from copy-on-write. POE would also be a good choice for testing network apps, if you can get your head around it. It is certainly the lightest on resources, but does require significant changes in the way you write your code.
Re: threads or processes ? - Simulation test
by moritz (Cardinal) on Feb 04, 2008 at 19:37 UTC
    If these tests don't have to interact with each other (and it doesn't like, from your description) I'd recommend processes.

    They are implemented very robustly, and in general easier to handle than threads (IMHO).

Re: threads or processes ? - Simulation test
by contactme (Initiate) on Feb 04, 2008 at 20:47 UTC
    As I would be testing the features like FTP,Email etc., So I would be using the Perl modules Net::FTP, Net::SMTP,POP3,IMAP etc in my script(s), which would be executing on a workstation (unix flavour) acting as a client and sending the request to server(unix flavour):

    The scenario could be like this: 1) send 10 mails after every 2 mins
    2) Try ftp for 10 users every 3 mins/5 mins>br> 3) Check if can access webpages (thru' Mechanize module) every 5 mins and other stuff (testing other features) which would be doing something every TIMEPERIOD.

    Those would be independent of each other and will not need to communicate with each other and would be sending the requests to the server.

    I may have to get the logs/reports after one iteration or after completion of some particular test , that I still need to figure out. But right now I am more concerned about the approach should I take related to threads or processes?
Re: threads or processes ? - Simulation test
by pc88mxer (Vicar) on Feb 04, 2008 at 21:57 UTC
    I would google 'http/ftp/email stress testing'. There's a lot already freely available, and some of it even may be written in perl. For starters, have a look at curl-loader.