[Tarantool-patches] [PATCH] net.box: allow to store user-defined fields in future object
vdavydov at tarantool.org
Fri Aug 13 12:57:00 MSK 2021
On Thu, Aug 12, 2021 at 09:13:56PM +0300, Igor Munkin wrote:
> Thanks for the patch! I am curious why Lua tables are not chosen for
> storing users data? It looks more natural (kinda netbox request storage
> that would be similar to the fiber's one), and easier to implement. Of
> course the only thing bothering me about Lua tables usage is Lua GC
> pressure. However:
> * Whether there are *too* much entries, TABOV might occur for REGISTRY
> table and keeping many tables (especially short living ones) at once
> is also not such good option.
> * In case there are *just* much entries, I perhaps that REGISTRY
> performance is better that spawning lots of tables. Anyway, I haven't
> look on the mhash implementation, so I have no estimations about its
> perfomance. I see they are created and destroyed manually, but Lua
> tables are within the GC reign, so some time is spent on their
> traversal. At the same time, REGISTRY traversal is atomic, so
> inflating it also affects the time spent on a particular incremental
> GC step. Too much theory, BTW. Benchmarks are required for this case.
> * If this is more an exceptional option (that's I doubt considering
> Yaroslav complains regarding this functionality breakage), then any of
> the option is fine IMHO, so the most convenient is preferable.
> It would be great to see the comparison for your current implementation
> and the one using Lua tables. The most interesting workload is a bunch
> of short-term requests, I guess.
According to my measurements, Lua tables perform slightly better (+1%)
than mhash. The code looks simpler as well so I'll go with Lua tables.
Will send v3 in reply to this email. Thanks!
More information about the Tarantool-patches