For file transfer, does ftp perform better than http?

20,539

Solution 1

Stolen from eHow, link at the bottom

Advantages and Disadvantages of HTTP

HTTP uploads provide an incredibly simple method of uploading files to a server, with minimal knowledge about file transfers. Downloading a file is also incredibly easy too. However, the disadvantages lie in HTTP's lack of power when it comes to file uploading. Also, a programmer needs to have the knowledge required to create the form in HTML, in order to upload the file in question. This especially is true if the file is for a social network similar to Myspace or Facebook that they're creating.

Advantages and Disadvantages of FTP

Using a FTP server offers advantages of its own. For one, a user can use a program to perform a mass upload to a server, not having to worry about repeatedly having to rebrowse for files and re-upload them using one form. Downloads can also be done en masse as well. Unfortunately, an FTP server still requires an FTP client to use, and the use of one would be particularly cumbersome to those who just wanted to upload a picture or two.

Differences

Ultimately, FTP and HTTP file transfers have completely different purposes. FTP's file transfer purpose is more or less for website maintenance and batch uploads, while HTTP is for client-end work and for end users to upload things such as movies, pictures and other files to the server. Often times, a programmer will use FTP to upload the files that allow an end-user to upload files via HTML/HTTP as well.

Read more: HTTP Vs. FTP File Transfer | https://www.techwalla.com/articles/http-vs-ftp-file-transfer#ixzz0wlUSkVIY

Solution 2

In general, general answers about network performance of a protocol are very difficult, because performance very much depends on the specific network setup, often more than on the protocol used.

That said, I do not know of any reason why the data throughput of http and ftp should be different. Both basically just send data over a TCP stream, so the actual data transfer process is the same. So, no, in general download speeds should be the same for ftp and http.

http is usually preferred for other reasons: It works better with firewalls (can be proxied), it allows restart of interrupted downloads, and can supply the media type along with the download (MIME), it is easier to encrypt (TLS/SSL), etc...

Solution 3

To me one of the biggest pitfalls of FTP is its inability to reuse sockets. FTP has 3 transfer modes, Stream, Block, and Compressed, however support for the last two is not common. In the default, and most widely used mode (Stream), the data is basically transferred as a raw stream of bytes and since it has no metadata about when it is finished with that file it must CLOSE the connection when it is done. This means if you transfer 100,000 files over FTP you are opening and closing 100,000 TCP connections. If that wasn't bad enough when one of these connections is closed it must be put in a TIME_WAIT state for a period of time. The default delay for that port to be reused on windows is 240 seconds (4 minutes). To top it all off, you only have up to 5,000 ports to use by default. This makes FTP a nightmare for transferring large amounts of small files. By tweaking the registry you can get the cooldown delay to 30 seconds and increase the max user ports to about 65,000 which will help a lot but is in no way ideal.

HTTP on the other hand can reuse the same socket for transferring multiple files. So if you have lots of files (especially smaller files) then HTTP would be the better choice without a doubt.

If you are doing just a few large files then it would not matter as much which protocol you use. I think FTP just comes to mind when people think of transferring files but that certainly doesn't mean it is better at it.

Share:
20,539

Related videos on Youtube

user882903
Author by

user882903

Updated on September 17, 2022

Comments

  • user882903
    user882903 over 1 year

    When I have http as well as ftp options (like the Hadoop download page), should I prefer ftp?

    I have tried ftp before and did not notice any significant difference. Is it supposed to perform better?

  • Julian
    Julian over 13 years
    http doesn't allow interrupted downloads, are you sure you don't mean ftp? ftp can be proxied and ecrypted also. Http downloads is preferred only preferred because it does not require anyone to install a ftp client (or a server for the content provider)
  • sleske
    sleske over 13 years
    Yes, I do mean http. http lets you resume a download (by using the "Range:" header). I stand corrected as to FTP, however: It also allows resuming downloads.
  • sleske
    sleske over 13 years
    As to proxying/encrypting: Yes, FTP can do this, but it's apparently more complicated, and more importantly, less widespread, while support for HTTP proxies and TLS is practically universal.
  • sleske
    sleske over 13 years
    This is mostly about advantages/disadvantages when uploading. That is not what the question was about.
  • sleske
    sleske over 13 years
    And btw, ftp download does not usually require the installation of an ftp client, as most browsers can download by ftp (using an ftp:// URL). However, most browsers cannot upload by ftp.
  • unforgettableidSupportsMonica
    unforgettableidSupportsMonica about 7 years
    @sleske: Agreed. I've downvoted Nifle's answer.