hello agentzh,
最近使用nginx-lua进行开发,其性能是很不错的,但是后来在youtube上面看到你关于Nginx的演讲,里面有提到stapxx和nginx-systemtap-toolkit,按照官方的文档重新编译了luajit和nginx,开始使用flame graph进行分析,但是遇到了一些问题:
1. flame graph(使用lj-lua-stacks.sxx)的调用栈有时候会出现问题,比如在lj_alloc_free上方会出现content_by_lua的flame,这样一来调用关系就有点乱。
2. 使用lj-vm-states时,其结果是
C Code (by interpreted Lua): 74% (5026 samples)
Interpreted: 11% (803 samples)
Compiled: 9% (612 samples)
Garbage Collector (not compiled): 3% (205 samples)
Garbage Collector (compiled): 0% (58 samples)
Trace exiting: 0% (23 samples)
根据文档的说法是,compiled的比例过低是存在优化的空间,但是问题是如何确定那部分代码是需要优化的。有时候ffi调用,属于compiled,有时候则是C Code(测试了一个hash算法,ffi调用的),因此如何让c code变成compiled而不是C Code?
谢谢!