Hello!
On Wed, Dec 11, 2013 at 9:02 PM, David Birdsong wrote:
> I'm using lua-resty-mysql in path to a latency-sensitive request. The call
> is necessary, but instrumenting timings will be extremely valuable.
>
You're recommended to use dynamic tracing tools (based on systemtap,
dtrace, or ktap) to trace the latency by sampling requests at real
time.
In particular, you can try out the ngx-lua-recv-time tool in my stap++ project:
https://github.com/agentzh/stapxx#ngx-lua-tcp-recv-time
This tool traces the latency in ngx_lua's cosocket read operations at
real time in any running nginx worker process specified. We've been
using this tool to trace our ngx_lua-based apps in production.
This ngx-lua-tcp-recv-time trace all the cosockets in the specified
nginx worker. So if you have multiple TCP or stream unix domain
cosockets in your Lua code, then you can modify the tool to filter
cosocket operations based on destination port number, for example.
>
> Can I do better without impacting performance?
By sampling requests, you don't have to pollute your app's code base
by (messy) timing, aggregating, and logging code. Also, you have
exactly zero overhead when you are not sampling. Furthermore, the
overhead is very small even during the sampling window.
Best regards,
-agentzh