3

I would like to improve the speed of my script that uploads a small 20kb file to cloudfiles, currently it takes 3 seconds but have seen it take more, up to about 7 seconds.

Basically it does the following...

  • Authenticates
  • Connects
  • Gets a container
  • Creates an object
  • Loads data into object from filename

Tried using cachegrind and webgrind to figure out which part of script is slow and it turns out it's the CURL side of things.

An interesting post here CURL with PHP - Very slow, suggests it may relate to DNS lookups but I'm not 100% sure how to monitor my traffic on Windows, any suggestions?

Do any other users have any suggestions on how to figure out why my CURL request is slow?

Community
  • 1
  • 1
Carlton
  • 5,533
  • 4
  • 54
  • 73
  • So what is slow? Rackspace or CURL? – OZ_ Sep 13 '11 at 08:54
  • I would like to figure this out...if I can see that the CURL request is struggling to get to Rackspace's servers then it's probably CURL, if a lot of time is spent at the Rackspace side of things I can assume there is a problem there. – Carlton Sep 13 '11 at 10:09
  • 2
    Just feedback on this issue just in case anyone else ran into the same issues. I moved my script onto my Rackspace server and it absolutely flies now which is great. It turns out that CURL will try and use Rackspace's internal network if an environment variable can be found when the script runs. Have a look at the comments in the constructor for the "CF_Connection" class. – Carlton Sep 13 '11 at 14:42

2 Answers2

2

I had a similar problem. If you are using Rackspace Servers with Rackspace Cloud files then you want to make sure you are using the proper SNET setting in your code. Example:

$connect_snet = true;
$this->conn = new CF_Connection($this->auth, $connect_snet);

This will route connections internal to the Rackspace network; avoiding DNS lookups, etc. Hopefully you'll see improved speed.

jjwdesign
  • 3,272
  • 8
  • 41
  • 66
0

You can also set an environment variable and the php cloud-files api will automatically use service net without you needing to change your CF_Connection() code:

define('RACKSPACE_SERVICENET', 1);
chiwangc
  • 3,566
  • 16
  • 26
  • 32
Kenny Wyland
  • 20,844
  • 26
  • 117
  • 229