Picking the right value for BlockSize is very important.  I have encountered
an over one order of magnitude difference in transfer rates using different
values for BlockSize when using Net::FTP.

I think the default value is 1K.  I tried powers of 2 from 1K up to 64K.  For
me a BlockSize value of 4K worked best for transferring ~200Kb files from
a Windows NT system to a Sun Solaris system over a 100BaseT switched
network.  I was surprised to see that the larger values were sometimes
just as slow as the smaller values.  The transfer speed decreased as I tried
BlockSize values further away from 4K in either direction.

I would suggest that you try various values to see what works best for you.
To specify a BlockSize, add it to your Net::FTP->new call:

$ftp = Net::FTP->new($host, BlockSize => $::FTP_BLKSIZE);

Graham Barr wrote:

> When transfering in ASCII mode (the default) Net::FTP will be slower
> due to doing the CRLF translation. But transfering in binary mode
> should be comparable. Increasing the transfer blocksize should
> also help.
>
> Graham.
>
> On Thu, Apr 18, 2002 at 11:17:24PM -0400, Terrence Brannon wrote:
> > Hi Brian,
> >
> > You might put this question on the [EMAIL PROTECTED] list as
> > Net::FTP is maintained by Graham Barr and you are raising an issue
> > specific to his module, not my application layer on top of it.
> >
> > I am Cc'ing this message there
> >
> > brian_turner_98006 writes:
> >  : When I do an ftp using:
> >  :         `ftp -i -n $dbshost << 'EOF'
> >  : user $remoteuser $remotepwd
> >  : get $remotefile $localfile
> >  : quit
> >  : EOF`;
> >  :
> >  : It takes an average of about 0.024 seconds/request
> >  :
> >  : However, when I try it with
> >  :
> >  :     $ftp = Net::FTP->new($dbshost,Debug => 0);
> >  :     $ftp->login($remoteuser,$remotepwd);
> >  :
> >  : then loop with:
> >  :
> >  : $ftp->get($remotefile, $localfile)
> >  :
> >  : It takes about 1.3 seconds/request.
> >  :
> >  : Version info:
> >  :
> >  : Summary of my perl5 (revision 5.0 version 6 subversion 0)
> >  : configuration:
> >  :   Platform:
> >  :     osname=solaris, osvers=2.6, archname=sun4-solaris
> >  :     uname='sunos rmdsun01 5.6 generic_105181-21 sun4u sparc
> >  : sunw,ultra-4 '
> >  :
> >  : I'm assuming that the login stays connected when I use Net::FTP so
> >  : this doesn't make sense to me.  Spawning a process+connecting should
> >  : be slower.  Any suggestions?
> >  :
> >  : FWIW, my application requires a large number of small file transfers
> >  : at random intervals.
> >  :
> >  : (I didn't see that Net::FTP was modifed in 5.6.1 based on
> >  : http://www.perldoc.com/perl5.6.1/Changes.html, but I'm open to
> >  : upgrading if there's a reasonable chance of fixing this issue)
> >  :
> >  : Thanks,
> >  :
> >  : Brian
> >  :
> >  :
> >  :
> >  :
> >  :
> >  : ------------------------ Yahoo! Groups Sponsor ---------------------~-->
> >  : Buy Stock for $4
> >  : and no minimums.
> >  : FREE Money 2002.
> >  : http://us.click.yahoo.com/k6cvND/n97DAA/ySSFAA/ndFolB/TM
> >  : ---------------------------------------------------------------------~->
> >  :
> >  : To unsubscribe from this group, send an email to:
> >  : [EMAIL PROTECTED]
> >  :
> >  :
> >  :
> >  : Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
> >  :
> >  :
> >  :
> >

--

James D. White   ([EMAIL PROTECTED])
Department of Chemistry and Biochemistry
University of Oklahoma
620 Parrington Oval, Room 313
Norman, OK 73019-3051
Phone: (405) 325-4912, FAX: (405) 325-7762



Reply via email to