Hello!
On Thu, Feb 4, 2016 at 9:33 AM, Igor Clark wrote:
> Re "up and down", I might be getting the wrong end of the stick. What I
> meant was that as far as I'd understood, ngx.location.capture("/local/url")
> fetches the results of /local/url via an internal nginx subrequest, without
> making an actual HTTP call out via the network or even via localhost,
> meaning less work overall - whereas if I call resty.http's
> request_uri("https://127.0.0.1/local/url"), it has to construct and execute
> a complete HTTP request, including SSL negotation in this case, which seems
> like it could be a fair bit more work for the program to do. So I was
> wondering whether, if that's right, it still makes sense to use resty.http
> in the case of fetching small responses as part of a larger script, or stick
> to ngx.location.capture for this?
Are you using subrequests to fetch local files on the local file
system? That's not really more efficient (actually often much less
efficient) than calling into the file syscalls directly from within
Lua (the only exception might be the use of AIO in the subrequest but
ngx.location.capture* do not support AIO mode yet).
If you are using proxy_pass or something similar in the subrequest,
then you still do network I/O in the subrequest anyway.
Eventually, I'd like to expose the NGINX file API via Lua, with AIO
support (both native AIO or OS thread pooling). I also welcome
patches.
Regards,
-agentzh