On 2017-11-03 23:58:30 +0800, Kwanhur Huang wrote:
> hello,
>
> 若子请求body大且频繁,比如图片请求等场景,subrequest+proxy_cache的方式会比lua-resty-http更合适
>
> 根据具体应用场景选择,综合权衡较好些
根据文档 subrequest 会把 body 全部读入内存
This API function (as well as ngx.location.capture_multi) always buffers
the whole response body of the subrequest in memory. Thus, you should
use cosockets and streaming processing instead if you have to handle
large subrequest responses.
而 lua-resty-http 则可以用流处理
The body_reader iterator can be used to stream the response body in
chunk sizes of your choosing, as follows:
如果子请求body大且频繁,感觉还是用 lua-resty-http 更合适。如果需要 cache
, lua-resty-http 也可以 +proxy_cache