Closed huacnlee closed 12 years ago
参见这个测试例子
我在盛大云的 VPS 上面跑测试出来结果:
puts Benchmark.measure {
@photo = Photo.create(:image => f)
}
0.120000 0.140000 0.590000 ( 1.979279)
1.9s - 2.1s 之间
我又尝试去掉图片处理的代码, 现在没有任何裁剪的
0.070000 0.030000 0.100000 ( 0.753590)
需要 700ms
Ping 的情况也正常
64 bytes from 60.191.100.98: icmp_seq=1 ttl=54 time=45.0 ms
64 bytes from 60.191.100.98: icmp_seq=2 ttl=54 time=114 ms
64 bytes from 60.191.100.98: icmp_seq=3 ttl=54 time=11.4 ms
64 bytes from 60.191.100.98: icmp_seq=4 ttl=54 time=18.2 ms
64 bytes from 60.191.100.98: icmp_seq=5 ttl=54 time=11.0 ms
64 bytes from 60.191.100.98: icmp_seq=6 ttl=54 time=10.9 ms
64 bytes from 60.191.100.98: icmp_seq=7 ttl=54 time=18.9 ms
64 bytes from 60.191.100.98: icmp_seq=8 ttl=54 time=15.4 ms
64 bytes from 60.191.100.98: icmp_seq=9 ttl=54 time=11.0 ms
64 bytes from 60.191.100.98: icmp_seq=10 ttl=54 time=11.1 ms
64 bytes from 60.191.100.98: icmp_seq=11 ttl=54 time=10.9 ms
64 bytes from 60.191.100.98: icmp_seq=12 ttl=54 time=13.5 ms
64 bytes from 60.191.100.98: icmp_seq=13 ttl=54 time=10.8 ms
64 bytes from 60.191.100.98: icmp_seq=14 ttl=54 time=32.7 ms
64 bytes from 60.191.100.98: icmp_seq=15 ttl=54 time=10.9 ms
64 bytes from 60.191.100.98: icmp_seq=16 ttl=54 time=10.9 ms
64 bytes from 60.191.100.98: icmp_seq=17 ttl=54 time=10.9 ms
64 bytes from 60.191.100.98: icmp_seq=18 ttl=54 time=11.0 ms
64 bytes from 60.191.100.98: icmp_seq=19 ttl=54 time=16.4 ms
64 bytes from 60.191.100.98: icmp_seq=20 ttl=54 time=11.2 ms
64 bytes from 60.191.100.98: icmp_seq=21 ttl=54 time=23.7 ms
最后我测试发现是盛大云上传带宽的问题: http://ruby-china.org/topics/5059
还是得尽量不自己缩略图。这个问题我先关闭了哈。
加上本地图片裁剪,基本上都要 3s 一个...
3张图片
大的 118K 中图 118K 小图 26K
一共耗费时间: 3139ms
盛大云的服务器过去