I have a Perl program with (typically) 32 threads, each of which uses a command-line utility (via a system() call) to download large files from one or more servers. These threads also write periodically to STDOUT, which I've redirected to a (log) file on my local drive.
When my program downloads these files onto my local hard-drive, everything works fine. However, when my program downloads the files and saves them onto a data-drive that is physically located on another machine (across a network), everything bogs down and becomes deadlocked (I think). If I use fewer threads (say, 4 or 8 on my 4-processor machine), my program usually works fine.
Obviously I'm overloading the network, but are there any strategies that I can use to minimize the problems I'm having? Thanks.