Attachment: offcpu.svg Description: image/svg
Attachment: oncpu.svg Description: image/svg
针对服务做打量测试,cpu负载超过80%,但qps却很低,on-cpu火焰图来看,大部分CPU都耗在ngx_http_lua_socket_tcp_receive上,请问这可能是什么问题? --
可以针对 lua 运行一次火焰图:https://github.com/openresty/nginx-systemtap-toolkit#ngx-sample-lua-bt看看这些时间和业务预期是否能对上。2016-09-20 21:48 GMT+08:00 牧童 <ssd...@gmail.com>:针对服务做打量测试,cpu负载超过80%,但qps却很低,on-cpu火焰图来看,大部分CPU都耗在ngx_http_lua_socket_tcp_receive上,请问这可能是什么问题? -- -- YuanSheng Wang---------------------------------------My Github: https://github.com/membphisOpenResty lover ^_^ --
lua 级别的火焰图应该使用这个:https://github.com/openresty/stapxx#lj-lua-stacks。@牧童,看你的火焰图,有两个问题:1、有些调试符号没有安装;2、大量的 lj_BC_*,也就是你的 lua 代码大部分是被 LuaJIT 解释执行的,没有被 JIT 编译。第一个问题需要你看下自己的环境;第二个问题,需要你用 jit.v 来看看具体哪些代码没有被 JIT。可以参考:https://github.com/iresty/Mio/blob/develop/profiling.md2016-09-22 23:09 GMT+08:00 YuanSheng Wang <yuan...@openresty.org>:可以针对 lua 运行一次火焰图:https://github.com/openresty/nginx-systemtap-toolkit#ngx-sample-lua-bt看看这些时间和业务预期是否能对上。2016-09-20 21:48 GMT+08:00 牧童 <ssd...@gmail.com>:针对服务做打量测试,cpu负载超过80%,但qps却很低,on-cpu火焰图来看,大部分CPU都耗在ngx_http_lua_socket_tcp_receive上,请问这可能是什么问题? -- -- YuanSheng Wang---------------------------------------My Github: https://github.com/membphisOpenResty lover ^_^ --
require "resty.core"
local v = require "jit.v" v.on("/tmp/jit.log")
多谢yuanshang,wenming回复!lua级别的火焰图也是主要消耗在ngx_http_lua_socket_tcp_receive。从火焰图上看,lj_BC_*上层栈也主要是ngx_http_lua_socket_tcp_receive调用,这是否说明sock:receive本身无法被jit编译?至于火焰图丢失的一些调试符号,应该是gcc编译导致的吧,我的gcc版本比较低4.4.7。在 2016年9月23日星期五 UTC+8上午9:19:59,WenMing写道:lua 级别的火焰图应该使用这个:https://github.com/openresty/stapxx#lj-lua-stacks。@牧童,看你的火焰图,有两个问题:1、有些调试符号没有安装;2、大量的 lj_BC_*,也就是你的 lua 代码大部分是被 LuaJIT 解释执行的,没有被 JIT 编译。第一个问题需要你看下自己的环境;第二个问题,需要你用 jit.v 来看看具体哪些代码没有被 JIT。可以参考:https://github.com/iresty/Mio/blob/develop/profiling.md2016-09-22 23:09 GMT+08:00 YuanSheng Wang <yuan...@openresty.org>:可以针对 lua 运行一次火焰图:https://github.com/openresty/nginx-systemtap-toolkit#ngx-sample-lua-bt看看这些时间和业务预期是否能对上。2016-09-20 21:48 GMT+08:00 牧童 <ssd...@gmail.com>:针对服务做打量测试,cpu负载超过80%,但qps却很低,on-cpu火焰图来看,大部分CPU都耗在ngx_http_lua_socket_tcp_receive上,请问这可能是什么问题? -- -- YuanSheng Wang---------------------------------------My Github: https://github.com/membphisOpenResty lover ^_^ -- --