子请求主要是做一些数据的get工作,有两种方式来调子请求:
1.ngx.location.capture_multi 方式:
示例代码:
ngx.location.capture_multi {
{"/sub_req",{args="type=type1&uid="..uid}},
{"/sub_req",{args="type=type2&uid="..uid}},
...
{"/sub_req",{args="type=type5&uid="..uid}}
}
2.thread.spawn()方式
把子请求处理封装成函数function sub_req() ,然后由ngx.thread.spawn (sub_req)
sum:这两种底层实现的区别是什么呢?哪个性能比较好呢?