简体   繁体   中英

Rackspace cloudfiles API fairly slow

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?

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.

您还可以设置环境变量,php cloud-files api将自动使用服务网,而无需更改CF_Connection()代码:

define('RACKSPACE_SERVICENET', 1);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM