luajit2 icon indicating copy to clipboard operation
luajit2 copied to clipboard

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

Open fairyqb opened this issue 3 years ago • 9 comments
trafficstars

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 avatar Jun 09 '22 07:06 fairyqb

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 avatar Jun 09 '22 08:06 fairyqb

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)
\

fairyqb avatar Jun 09 '22 09:06 fairyqb

which luajit version did you upgrade from? @fairyqb

zhuizhuhaomeng avatar Jun 14 '22 09:06 zhuizhuhaomeng

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

fairyqb avatar Jun 27 '22 12:06 fairyqb

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

zhuizhuhaomeng avatar Jul 02 '22 02:07 zhuizhuhaomeng

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

results are similar to stapxx

fairyqb avatar Jul 08 '22 10:07 fairyqb

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

testn avatar Jan 03 '23 04:01 testn

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

bisect ??

fairyqb avatar Jan 12 '23 11:01 fairyqb

man git bisect

alerque avatar Jan 12 '23 11:01 alerque