[Tarantool-patches] [PATCH 1/2] box: make box.cfg idempotent function
Alexander Turenko
alexander.turenko at tarantool.org
Wed May 6 14:17:06 MSK 2020
> > However you might suggest another fix for the issue? There are several
> > other ways to indicate whether box is configured, e.g. introduce the
> > specific value to the box table. What do you think?
>
> Why not set a lua variable *from* C instead of calling from Lua
> *into* C each time?
This way it will be slower when called from C. Since we unable to
'unconfigure' box I would just cache C's value in Lua.
C's box_is_configured() is used only in box.session.su() and its
performance is not so critical as box.execute(). However I don't see a
reason to slowdown C's box_is_configured()() if we can avoid it: it may
be important if it will be called from some other code.
I don't sure, but storing database settings and state in Lua looks a bit
lopsided approach for me: even now we have three languages: C, Lua and
SQL. Some caching, hovewer, is okay.
> I mean, this is an obvious optimization, but it is only worth it
> if there is a measurable slowdown (which I suspect there is, at
> least a couple of %, but even a couple of % IMHO justify it).
I failed to obtain stable results and maybe there is a difference, but I
don't see it now.
https://gist.github.com/Totktonada/407855389ed4da93bf0175cf8a11c7b9
I made those measurements on fixed CPU frequency and 10 times run each
implementation 10 times: 300 runs at whole. I see that results becomes
worse for all implementations from run to run. Looks strange.
WBR, Alexander Turenko.
More information about the Tarantool-patches
mailing list