I'm using the RackSpace PHP SDK to upload some HTML to a container.
This script without using the SDK, finishes in roughly ~0.1 seconds. Using the SDK, it's between 1.5 - 2.5 seconds. All I'm doing with the SDK is.
- Connect using the username and API key.
- Get an instance of objectStoreService.
- Set a container.
- Upload data to a file.
The largest of the files uploaded at the moment, is 212kb.
Does that seem about right, that doing those 4 operations is taking around 1.4 - 2.4 seconds?
I have found uploading to cloud files is usually slower than one expects, so you're probably looking at realistic times.
The bottle necks in the cloud files library are:
When you login with the username and api key, it returns a token that lasts 24 hours. If you can you should see if you can keep that token, to save an extra API call: http://docs.php-opencloud.com/en/latest/services/identity/tokens.html
When you upload a file, it doesn't report 202 OK until it has properly stored the file. The storage backend uses openstack swift, which breaks files into blocks, then each block must be saved on a majority of servers; with Rackspace, I heard each block is saved on 3 servers, so the 'upload' won't return until every block of the file is on at least 2 servers. The way to get around the uploading delay, is to do it asynchronously, or with extra processes uploading multiple files at a time. I don't know how to do it in php without having a secondary and other processes save the files for you.
Always use SNET (service net) when you're uploading from inside the same datacenter as the cloud files service