Subrequests and output filters

Yichun Zhang (agentzh) agentzh at
Wed Aug 5 15:19:39 UTC 2015


On Wed, Aug 5, 2015 at 7:21 PM, Maxime Henrion wrote:
> I am currently developing an nginx module in order to implement a software component in our platform.
> This module's responsibility is to receive upstream requests, forward them to multiple hosts (one host per pool, with N pools; we call a pool a shard), receive all the responses and aggregate them using custom application logic, and finally return an answer.

Seems like it's exactly what the ngx.location.capture_multi Lua API
function provided by ngx_lua does:

Your requirement can be done in just a few lines of Lua and the
performance is assured since almost all of the heavy-lifting is done
in pure C.

If you insist in rolling out your own custom nginx C modules, then I
suggest you dive into ngx_lua's internals to clone what is already
done and proven there. Having said that, I'm still strongly against
the idea of writing your own C modules after writing tens of nginx C
modules in the last 6 years myself. There won't be much gain at all as
compared to the ngx_lua approach. Not to mention all the development,
debugging, testing, and maintenance price paid on the developer side.

Well, just my 2 cents.


More information about the nginx-devel mailing list