From: Igor Munkin <imun@tarantool.org> To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> Cc: tarantool-patches@dev.tarantool.org Subject: Re: [Tarantool-patches] [PATCH 2/2] box: reduce box_process_lua Lua GC memory usage Date: Sun, 21 Jun 2020 00:24:49 +0300 [thread overview] Message-ID: <20200620212449.GB3503@tarantool.org> (raw) In-Reply-To: <4150e5b8-b4c0-7151-d06e-a61d81eff97b@tarantool.org> Vlad, Thanks for the review! I fixed your comments and updated the remote branch. On 20.06.20, Vladislav Shpilevoy wrote: > Hi! Thanks for the patch! > > On 19/06/2020 22:40, Igor Munkin wrote: > > <box_process_lua> function created a new GCfunc object for a handler > > having no upvalues depending on the request context on each call. > > > > The changes introduces the folliwing mapping: > > Either 'changes' -> 'change', or 'introduces' -> 'introduce'. > > 'folliwing' -> 'following'. My bad, fixed. > > > | <handler id> -> <handler GCfunc object> > > Initializing this mapping on Tarantool startup is aimed to reduce Lua GC > > memory usage. > > > > Signed-off-by: Igor Munkin <imun@tarantool.org> > > --- > > src/box/lua/call.c | 32 +++++++++++++++++++++++++++----- > > 1 file changed, 27 insertions(+), 5 deletions(-) > > > > diff --git a/src/box/lua/call.c b/src/box/lua/call.c > > index 6588ec2fa..e1b1a5e81 100644 > > --- a/src/box/lua/call.c > > +++ b/src/box/lua/call.c > > @@ -48,6 +48,15 @@ > > #include "mpstream/mpstream.h" > > #include "box/session.h" > > > > +enum handlers { > > + HANDLER_CALL, > > + HANDLER_CALL_BY_REF, > > + HANDLER_EVAL, > > + HANDLER_MAX, > > Would be nice to have a comment here explaining why so complex. > Why lua_pushcfunction() can't be used on each call. OK, here is the diff: ================================================================================ diff --git a/src/box/lua/call.c b/src/box/lua/call.c index e1b1a5e81..e52f16ca4 100644 --- a/src/box/lua/call.c +++ b/src/box/lua/call.c @@ -48,6 +48,15 @@ #include "mpstream/mpstream.h" #include "box/session.h" +/* + * Handlers identifiers to obtain lua_Cfunction reference from + * Lua registry table. These handlers are initialized on Tarantool + * startup and are used until the Lua universe is destroyed. + * Such approach reduces Lua GC usage since there is no need to + * create short-lived GCfunc objects for the corresponding C + * function on each iproto CALL/EVAL request or stored Lua + * procedure call. + */ enum handlers { HANDLER_CALL, HANDLER_CALL_BY_REF, ================================================================================ > > > +}; > > + > > +static int execute_lua_refs[HANDLER_MAX]; > > + > > /** > > * A helper to find a Lua function by name and put it > > * on top of the stack. -- Best regards, IM
next prev parent reply other threads:[~2020-06-20 21:34 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-19 20:50 [Tarantool-patches] [PATCH 0/2] Reduce Lua GC pressure in Tarantool Igor Munkin 2020-06-19 20:40 ` [Tarantool-patches] [PATCH 1/2] test: disable JIT for Lua Fun totable function Igor Munkin 2020-06-21 10:26 ` Sergey Ostanevich 2020-06-21 20:24 ` Igor Munkin 2020-06-25 9:43 ` Sergey Ostanevich 2020-06-26 11:11 ` Igor Munkin 2020-06-26 13:11 ` Igor Munkin 2020-06-23 18:04 ` Igor Munkin 2020-06-23 18:45 ` Alexander V. Tikhonov 2020-06-23 21:58 ` Igor Munkin 2020-06-19 20:40 ` [Tarantool-patches] [PATCH 2/2] box: reduce box_process_lua Lua GC memory usage Igor Munkin 2020-06-20 17:42 ` Vladislav Shpilevoy 2020-06-20 21:24 ` Igor Munkin [this message] 2020-06-21 10:27 ` Sergey Ostanevich 2020-06-21 10:40 ` Igor Munkin 2020-06-21 15:35 ` Vladislav Shpilevoy 2020-06-21 19:09 ` Igor Munkin 2020-06-22 22:54 ` [Tarantool-patches] [PATCH 0/2] Reduce Lua GC pressure in Tarantool Vladislav Shpilevoy 2020-06-23 21:06 ` Vladislav Shpilevoy 2020-06-23 21:58 ` Igor Munkin 2020-06-23 21:59 ` Igor Munkin 2020-06-27 13:22 ` Igor Munkin
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200620212449.GB3503@tarantool.org \ --to=imun@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH 2/2] box: reduce box_process_lua Lua GC memory usage' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox