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.
Quickest way to access files
Moderator: General Moderators
Quickest way to access files
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Re: Quickest way to access files
SCP is actually much slower than ftp, because it has to build the secure connection up and tear it down for each session.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.
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.
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.
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.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Then its either http or ftp for the speed demon in you.pickle wrote:I'd only be using this to download a log file from a server. Just connect, download, and disconnect.
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.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)?
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.
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!
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!
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.