I'm the lead developer in a team of 2. My partner has only just joined the project and despite using GIT for version control etc, we are still stuck in the dark ages when it comes to code deployment.

Currently I make all site updates via FTP (this way I have control / responsibility over everything that goes live), using Filezilla.

I've done this for years, but we now have some large PHP classes (300KB), and a lot of traffic.

So in short, every time I upload a key class "general" for example, the site goes down until the file finishes uploading. This is only 5/6 seconds at a time, but this is increasingly unacceptable.

I realise I can upload the file under a different name and then rename both files... but really there must be a better way?

I've heard about rsyncing code across from another server, but I don't see how this prevents switching to the new file whilst uploading.

We only have one server (for DB and Apache) but also use some cloud servers (for openx as an example).


rsync does exactly that in the default transfer mode: it creates a new file on the destination for the duration of the transmission and renames it after the transmission completes.

Nontheless, this will not help with situations where your upload is "inconsistent" - i.e. you have uploaded files which depend on other, not yet uploaded files. If this is a concern, you would need to upload to an entirely different directory structure and switch after your entire transfer completes.

  • Thanks. What method do larger sites use? In rsync, is it possible to specify the order in which files are updated? – Jon M Jul 1 '11 at 7:58
  • @Jenkz I think large sites have either planned downtime or a staged release where they update half their serves, switch to them, upload the other half, and then put everything back online. – TheLQ Jul 6 '11 at 2:15

WinSCP has a directory "synchronization" feature that will auto-synchronize to a remote FTP server, such as Filezilla Server. Filezilla client doesn't have this feature. You can get a SFTP server in this list. If you choose the right SFTP server, then a file lock will not be held while uploading until the very last bit is transferred and the file is replaced.

Alternatively, you can keep a non-live server FTP directory that you upload to and then use another piece of local software (like WinSCP) to do a instant synchronization to the live directory on the same server. This way you avoid the file lock during the upload latency.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.