views:

73

answers:

2

Hello,

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 performance 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!

+4  A: 

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.

nont
+1! great answer
George
Thank you for the answer. My question is concerning your "1)" - and the question is if this part will be faster. Emil Vikström says it is more probable it will. Do you think so either? And thank you once more for the answer!
MartyIX
" 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."-> Only admins are allowed to run the PHP script via web administration. I don't like the solution of creating folders on subdomains either but are there any other option how to do it instead of FTP? (and not manually :-)) I was thinking about usage of htaccess (company_name_of_file.extension) but the folders for every company seems easier and better for our needs. We were thinking also about usage of database for storing files + htaccess but ...
MartyIX
... it would be a big load for the database.
MartyIX
MartyIX, the FTP communication won't be any faster by virtue of all three target machines being on the same subnet. However, if that subnet is the same as the source machine where the commands are originating, that would make it faster than if it were located further away - like on the internet somewhere. However, I suspect the total runtime will be dominated by the execution time of the mkdir command - but only testing will tell you that.
nont
Thank you for help!
MartyIX
+1  A: 

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).

Emil Vikström