• 许童童
    2019-08-21
    老师这个案例还是挺不错的,手把手带你用火焰图做性能优化。
    过早的优化是万恶这源,还要注意优化和代码可读性间的平衡。

    作者回复: 是的,OpenResty 代码的优化做到极致就容易影响可读性。实际的项目,一般会在上面多做一层封装,把优化的细节隐藏下。

    
     3
  • 北冥Master
    2019-12-04
    ./samples/lj-lua-stacks.sxx --arg time=5 --skip-badvars -x 2871915 > ~/perf.bt
    Found exact match for libluajit: /usr/local/openresty/luajit/lib/libluajit-5.1.so.2.1.0
    In file included from /usr/share/systemtap/runtime/linux/runtime.h:201:0,
                     from /usr/share/systemtap/runtime/runtime.h:24,
                     from /tmp/stapdiQN45/stap_b7d4c96a12d824bc289ba86f5d42b8c9_43901_src.c:26:
    /usr/share/systemtap/runtime/linux/access_process_vm.h: In function ‘__access_process_vm_’:
    /usr/share/systemtap/runtime/linux/access_process_vm.h:24:8: error: implicit declaration of function ‘get_task_mm’ [-Werror=implicit-function-declaration]
       mm = get_task_mm (tsk);
            ^~~~~~~~~~~
    /usr/share/systemtap/runtime/linux/access_process_vm.h:24:6: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
       mm = get_task_mm (tsk);
          ^
    /usr/share/systemtap/runtime/linux/access_process_vm.h:35:29: error: passing argument 1 of ‘get_user_pages’ makes integer from pointer without a cast [-Werror=int-conversion]
           ret = get_user_pages (tsk, mm, addr, 1, write, 1, &page, &vma);
                                 ^~~
    In file included from ./include/linux/pid_namespace.h:7:0,
                     from ./include/linux/ptrace.h:10,
                     from ./include/linux/ftrace.h:14,
                     from ./include/linux/kprobes.h:42,
                     from /usr/share/systemtap/runtime/linux/runtime.h:21,
    展开
    
    
  • 北冥Master
    2019-12-04
    我的环境执行lj-lua-stackxx 报错,debian9环境,systemtap应该装什么版本?我装的2.6
    
    
  • witt
    2019-09-15
    老师,我哪里操作有问题吗?

    报错信息:

    Found exact match for libluajit: /usr/local/openresty/luajit/lib/libluajit-5.1.so.2.1.0
    WARNING: cannot find module /usr/local/openresty/nginx/sbin/nginx debuginfo: No DWARF information found [man warning::debuginfo]
    WARNING: cannot find module /usr/local/openresty/luajit/lib/libluajit-5.1.so.2.1.0 debuginfo: No DWARF information found [man warning::debuginfo]
    semantic error: while processing function luajit_G

    semantic error: type definition 'lua_State' not found in '/usr/local/openresty/luajit/lib/libluajit-5.1.so.2.1.0': operator '@cast' at stapxx-0fF6qb3V/luajit.stp:162:12
            source: return @cast(L, "lua_State", "/usr/local/openresty/luajit/lib/libluajit-5.1.so.2.1.0")->glref->ptr32
                               ^

    Pass 2: analysis failed. [man error::pass2]
    Number of similar warning messages suppressed: 634.
    Rerun with -v to see them.
    Tip: /usr/share/doc/systemtap/README.Debian should help you get started.
    ERROR: No stack counts found

    环境:
    Ubuntu 16.04.6
    openresty/1.15.8.2
    展开

    作者回复: OpenResty 的 1.15.8 中开启了 LuaJIT64 模式,火焰图的工具一直没有跟着升级,所以存在不兼容的问题。有两个方法可以解决:
    1. 使用 OpenResty 1.13 的版本;
    2. 自己编译 OpenResty 1.15.8,把LuaJIT 64 模式关闭。

    
    
  • wusiration
    2019-08-22
    老师的这个案例,基本上把整个性能分析的流程给讲清楚了,周末搭一下环境尝试性能分析一下

    作者回复: 多动手:)

    
    
我们在线,来聊聊吧