Hello!
2015-09-21 10:36 GMT+08:00 <wart...@gmail.com>:
> 用openresty实现了一个图片裁剪的模块,发现程序在从上游图片服务器下载大图片文件时(5M),效率比较低,而且不稳定。下载图片的代码使用了
> 一个以cosocket API实现的一个http client 的lua库
> 。我用wget测试下载速度的话大概稳定在3-5s左右,但是使用lua这个库的话,时间在1s到十几s之间变化,很不稳定。不知道openresty有没有什么选项可以优化下载速度的选项,谢谢。
liseen 的 lua-resty-http 库不支持流式下载。你这里的下载数据量较大,应使用流式处理(即读一块,写一块)。James
Hurst 的 lua-resty-http 库貌似支持流式下载:
https://github.com/pintsized/lua-resty-http
Regards,
-agentzh