Page 1 of 1
Quickest way to access files
Posted: Thu Jun 30, 2005 11:45 am
by pickle
Hi everyone.
I have a script running every 10 minutes that needs to access files on a remote server. What would be the fastest way to do this? I want as little overhead as possible. So far, I'm using the ftp commands, but would it be quicker to call scp through the command line? Thanks.
Re: Quickest way to access files
Posted: Thu Jun 30, 2005 12:01 pm
by Roja
pickle wrote:Hi everyone.
I have a script running every 10 minutes that needs to access files on a remote server. What would be the fastest way to do this? I want as little overhead as possible. So far, I'm using the ftp commands, but would it be quicker to call scp through the command line? Thanks.
SCP is actually much slower than ftp, because it has to build the secure connection up and tear it down for each session.
When you say access, you are unclear. Do you mean read or write? If its only read, http is faster than ftp (in my experience, depending on the server setup). From a purely protocol point of view, ftp's connections are more "simple", but they do require authentication - which can often be slower than the entire HTTP GET sequence.
Plus, with http you can do caching, load balancing.. the list goes on.
Posted: Thu Jun 30, 2005 12:24 pm
by pickle
I'd only be using this to download a log file from a server. Just connect, download, and disconnect.
How would I use http to download this file? Can it be done if the log file isn't in the server root or accessible by Apache (and never will be)?
Thanks.
Posted: Thu Jun 30, 2005 1:01 pm
by Roja
pickle wrote:I'd only be using this to download a log file from a server. Just connect, download, and disconnect.
Then its either http or ftp for the speed demon in you.
pickle wrote:
How would I use http to download this file? Can it be done if the log file isn't in the server root or accessible by Apache (and never will be)?
Well, again your wording is tricky. It sounds like you are saying that Apache itself can't even read the file. On most systems, you can (via scripting) allow Apache access to almost any portion of the filesystem - as long as you don't use safe_mode/chroot, and other protections of their ilk.
If Apache honestly cannot get to the file, then Apache cannot serve it, so its ftp or nothing.
However, a file does not have to be in the webroot to be accessible by apache. For example, my webroot /blah/public_html/game has scripts that write to /blah/cache_dir, which is *not* in the webroot, but IS accessible by apache.
Its just a matter of telling php where to look, and ensuring the file permissions are correct.
Posted: Thu Jun 30, 2005 1:26 pm
by pickle
Ok, ya. I don't want to run anything on these remote servers - just grab the file. It sounds like the only way to use HTTP to access the log file, is to do it through Apache. I don't want this log file to be accessible via Apache, for security concerns.
You've given me enough info to sate my desire for more speed. It sounds like FTP is a reasonable way to do this, so I'll stick with what I've got.
Thanks a bunch!