Deleting the files associated with my node is VERY slow I've got a node which has around 50 files associated with it. The files are stored on Rackspace Cloud Files. Interacting with Cloud Files was very slow, but I've fixed that now and the actual delete operations are running very quickly now. However, there is sometimes a gap of 3-5 seconds between each attempt to delete a file. I added some logging to the unlink() method so I could track how fast the requests were happening.. here is an abbreviation snippet of the log:

[11:55:31 2012] starting to delete rcf://videos/thumbnails/1702/thumbnail-1702_0001.png
[11:55:31 2012] deletion complete

[11:55:36 2012] starting to delete rcf://videos/thumbnails/1702/thumbnail-1702_0002.png
[11:55:36 2012] deletion complete

[11:55:40 2012] starting to delete rcf://videos/thumbnails/1702/thumbnail-1702_0003.png
[11:55:40 2012] deletion complete


So, each delete operation is taking essentially no time, but in between each call to unlink() there is 4-5 seconds. This continues for the remaining files, so it takes SOOO long to delete a node and I'm in danger of the php process being killed for running too long.

Why would drupal be so slow in between file deletes? What might cause this? Where can I look to determine what is taking so long?
I edited the cloudfiles.php API from Rackspace to uncomment the following line:

define('RACKSPACE_SERVICENET', 1);


That automatically causes the API to connect over the private network which is a lot faster than accessing cloudfiles via the public network.

This is only usable if you are hosting your site on a Rackspace server though.