2

We have a site load balanced behind three servers, and we are using lsync and csync2 to replicate file changes across the servers. In the past we used a GFS system to handle this, which worked great at fencing the other servers until the files were synchronized. But we ran into issues with the servers locking up and the site going down when something went wrong.

With lsync and csync2 we are hoping to avoid the lock-up issues. However, the lag between the file sync is between 5 and 15 seconds for small files, and up to 120 for large file uploads.

Is there a way to change the file saving process, or even the node/entity saving process, to wait until the file has been synchronized on the other servers? Once the files are synchronized on the other servers the process can continue.

We use both public and private files, and we aggregate CSS and JS. This question is mainly concerned with the public and private files.

3
  • Without hacking the core file (and maybe image) module(s), I doubt it. Drupal does HTTP uploads the 'standard' way, and moves the posted file data from the temp location to the target location as soon as possible; as would be the desired effect in 99% of cases. I guess you'd need to implement something on the server-side that PHP can connect to to find out the status of the sync, and react/wait accordingly. I'd get your sysadmin/resident-server-and-bash-guru involved to be honest, it's hard to see a totally Drupal/PHP solution to this
    – Clive
    Aug 1, 2013 at 14:39
  • I was thinking of hook_file_insert and hook_file_update as starting points Aug 2, 2013 at 14:17
  • Using hook_file_move() and hook_file_delete() and curl, I was able to get this working for public and file uploads, changes and deletes. No solution for the css/js aggregation files, however. Aug 5, 2013 at 16:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.