I'm just getting started with OpenResty, and I'm trying to figure out which parts I should actually use.
I feel like there is a lot of overlapping functionality in some of the modules and a lot of choices that can be made.
For example, to MD5 a string I could:
Use ngx.md5: https://github.com/openresty/lua-nginx-module#ngxmd5
Use set_misc: https://github.com/openresty/set-misc-nginx-module
Use OpenResty's Lua module: https://github.com/openresty/lua-resty-string
Use a regular Lua module: http://openresty.org/#UsingLuaRocks
Same for caching, subrequests, routing, and a whole lot of other things. Normally I'd stick to the most expressive option, Lua, but for my purposes I really care about performance.
My question is: will a Lua module using LuaJIT and the cosocket API typically have the same performance as a full nginx module? Basically, does it not make a big difference what I decide to use?
Or, for performance, should I always be using pure nginx directives, and only resorting to Lua for functionality that I can't get from native nginx? One example of sticking to nginx directives would be using nginx's `map` instead of lots of Lua `if` statements, or using `location` instead of Lua routing, and also using existing nginx modules instead of Lua ones.
Additionally, if a Lua module is not bundled with OpenResty, how will I know if it's async-compatible and will take advantage of LuaJIT?
I know that it's better to profile first and ask questions later, but I'd just like to get a general idea for how I should start writing my code and my configuration to optimize for maximum performance.
Thanks.