开发者

How big is FTP performance load in PHP?

I have a PHP script on a domain (say example.com) and this domain has three subdomains:

a.example.com

b.example.com

c.example.com

IP addresses of this all this domains is xxx.yyy.zzz.ddd and domains differ only in last octet ("ddd" part). I think it's quite ordinary for subdomains.

My question is if this fact will improve the perfor开发者_如何学编程mance of the FTP extension (the task is to create the same folder on each subdomain (every company has its own folder on each subdomain)). My idea is that FTP may use local network of hosting provider and therefory it should be pretty fast.

I will try some tests but I would like to know if it is even possible or it's a "rubbish idea".

Thank you for replies!


It seems like your question is: will the FTP routine in your script execute faster because all of the target machines are on the same subnet?

Short answer is no. The long answer is that there are two big things that will affect the performance of that task: 1) The network interconnect between where the script is running and the FTP servers will determine how fast the commands are sent and received. 2) The speed of the machine and write speed of its physical media (hard drive) will determine how long it takes the commands to execute.

Certainly it is possible to have the script login to three different FTP servers and execute a mkdir command. I think its probably not such a great idea from a security perspective to do this from a php script that is accessible to the whole internet.


If your script is on the same network as the other machines then yes, it will be pretty fast, even while FTP itself is slow in startup time (login and sending commands). It will probably be pretty fast even if your PHP script is run from some other network, but then it could take a couple of seconds to finish (which may or may not be "fast" for you).

You should probably have some error handling, if your script doesn't succeed in making the folders due to network errors or some other reason (so you can create them at a later time).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜