Tarantool development patches archive
 help / color / mirror / Atom feed
From: Igor Munkin <imun@tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>,
	Sergey Ostanevich <sergos@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH 0/2] Reduce Lua GC pressure in Tarantool
Date: Fri, 19 Jun 2020 23:50:22 +0300	[thread overview]
Message-ID: <cover.1592597647.git.imun@tarantool.org> (raw)

This series consists of the two patches that seems unrelated. However
you can look at the CI results[1] for the first incarnation[2] and see
the reason why the test is also attached.

The first patch just makes the flaky box-tap/key_def.test.lua stable and
thereby fixes #4252[3]. The fix is quite simple: since it hits the known
LuaJIT problem[4] disabling JIT for particular Lua Fun methods is a
solution for now. When the JIT misbehave is fixed, the patch can be
reverted. Furthermore, Sasha Tu. asked to open another ticket in our
queue tracking the origin LuaJIT issue, since #4252 will be closed.

I failed to find the exact way the patch affects this test, but again,
the result is in the CI.

The second patch was born in scope of Sasha L. research[5]. I glanced on
the flamegraphs and then to the sources and saw no reason why the same
functions need to be created on each iproto CALL/EVAL or "stored"
procedure call. These GCfunc objects live only in scope of the coroutine
(i.e. fiber) serving a request, but can be reused for the others since
there are no upvalues depending on the request context. As a result of
the change GC pressure is reduced.

Vlad asked me personally to make and provide some benchmarks for the
changes. I made the one you can find here[6]. One need to start
<callee.lua> instance and run <caller.lua> several times with the same
Tarantool binary.

After 15 runs with default args I obtained the following results:
* Vanilla bleeding master (mean):
| ===== 2.5.0-147-ge7a70be4e =====
| call by ref GC: 953127 Kb
| call by ref time: 1.401803 sec
| call GC: 507813 Kb
| eval GC: 686523 Kb
* Patched bleeding master (mean):
| ===== 2.5.0-149-g71b2bbc8a =====
| call by ref GC: 921877 Kb
| call by ref time: 1.318509 sec
| call GC: 476563 Kb
| eval GC: 655273 Kb
* Relative measurements (before -> after):
| call by ref GC: -3% (-31250 Kb)
| call by ref time: -5% (-0.083294 sec)
| call GC: -6% (-31250 Kb)
| eval GC: -4% (-31250 Kb)

Even if one consider benchmarks a bit synthetic, this change improves
platform performance a priori: as a result less garbage is produced,
ergo GC machinery is triggered less often.

Branch: https://github.com/tarantool/tarantool/tree/imun/experimental-execute-lua-handlers

I guess a ChangeLog entry is irrelevant, since nothing is changed for
the user space.

Igor Munkin (2):
  test: disable JIT for Lua Fun totable function
  box: reduce box_process_lua Lua GC memory usage

 src/box/lua/call.c            | 32 +++++++++++++++++++++++++++-----
 test/box-tap/key_def.test.lua |  8 ++++++++
 2 files changed, 35 insertions(+), 5 deletions(-)

[1]: https://gitlab.com/tarantool/tarantool/-/pipelines/138781540/builds
[2]: https://github.com/tarantool/tarantool/commit/8fe7f00
[3]: https://github.com/tarantool/tarantool/issues/4252
[4]: https://github.com/LuaJIT/LuaJIT/issues/584
[5]: https://github.com/tarantool/vshard/issues/224
[6]: https://gist.github.com/igormunkin/c941074fa9fdf0f7a4f068498fb5e24c

-- 
2.25.0

             reply	other threads:[~2020-06-19 20:59 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-19 20:50 Igor Munkin [this message]
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
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
  -- strict thread matches above, loose matches on Subject: below --
2020-06-19 20:40 Igor Munkin
2020-06-19 20:55 ` 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=cover.1592597647.git.imun@tarantool.org \
    --to=imun@tarantool.org \
    --cc=sergos@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 0/2] Reduce Lua GC pressure in Tarantool' \
    /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