openresty / luajit2

OpenResty's Branch of LuaJIT 2
https://luajit.org/luajit.html
Other
1.2k stars 193 forks source link

upgrading the luajit the CPU increased by 20% ,performance drop #175

Open fairyqb opened 2 years ago

fairyqb commented 2 years ago

client: ab -n10000000 -c40 -k http://www.hello.com/

server: openresty-1.13.6.2 LuaJIT-2.1-20180420 some lua scripts

upgrading the luajit version to luajit2-2.1-20220411 , the CPU increased by 20%, QPS and response time did not change(compared to the old luajit version)

fairyqb commented 2 years ago

FlameGraph c-on-cpu.cbt c-on-cpu c-on-cpu.bt.txt c-on-cpu.svg.txt

Remove file suffixes .txt

@agentzh @siddhesh @zhuizhuhaomeng @doujiang24

thanks

fairyqb commented 2 years ago

image

From the graph above, I suspected that the lj_BC_TGETS was the underlying cause of problem ,however ,there is little information except lj_BC_TGETS ,moreover, we don't know much about lj_BC_TGETS behind the screen, any ideas?

lj_bc.h lj_BC_TGETS is a field or method access in the interpreter, i.e. obj.field or obj:method

/ Table ops. / \ _(TNEW, dst, , lit, gc) \ (TDUP, dst, _, tab, gc) \ (GGET, dst, , str, index) \ _(GSET, var, __, str, newindex) \ (TGETV, dst, var, var, index) \ (TGETS, dst, var, str, index) \ (TGETB, dst, var, lit, index) \ (TGETR, dst, var, var, index) \ (TSETV, var, var, var, newindex) \ (TSETS, var, var, str, newindex) \ (TSETB, var, var, lit, newindex) \ (TSETM, base, , num, newindex) \ _(TSETR, var, var, var, newindex) \ \

zhuizhuhaomeng commented 2 years ago

which luajit version did you upgrade from? @fairyqb

fairyqb commented 2 years ago

upgrade LuaJIT-2.1-20180420 to luajit2-2.1-20220411 @zhuizhuhaomeng

zhuizhuhaomeng commented 2 years ago

@fairyqb would you please use the lj-lua-on-cpu in OpenResty XRay to profile your process?

fairyqb commented 2 years ago

@fairyqb would you please use the lj-lua-on-cpu in OpenResty XRay to profile your process?

results are similar to stapxx

testn commented 1 year ago

@fairyqb is it possible for you to bisect luajit2 to find the changes that caused the problem?

fairyqb commented 1 year ago

@fairyqb is it possible for you to bisect luajit2 to find the changes that caused the problem?

bisect ??

alerque commented 1 year ago

man git bisect