Rackspace cloudfiles API 相当慢
我想提高将 20kb 小文件上传到 cloudfiles 的脚本的速度,目前需要 3 秒,但我发现它需要更多时间,最多大约 7 秒。
基本上它执行以下操作...
- 验证
- 连接
- 获取容器
- 创建一个对象
- 从文件名将数据加载到对象中
尝试使用cachegrind和webgrind来找出脚本的哪一部分速度慢,结果证明这是事情的CURL方面。
这里有一篇有趣的文章 CURL with PHP - Very Slow,表明它可能与 DNS 查找有关但我不是 100% 确定如何在 Windows 上监控我的流量,有什么建议吗?
对于如何找出我的 CURL 请求缓慢的原因,是否有其他用户有任何建议?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我有类似的问题。如果您将 Rackspace 服务器与 Rackspace 云文件一起使用,那么您需要确保在代码中使用正确的 SNET 设置。示例:
这将路由 Rackspace 网络内部的连接;避免 DNS 查找等。希望您会看到速度的提高。
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:
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()
代码: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: