From: Konstantin Osipov <kostja@tarantool.org> To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> Cc: tarantool-patches@freelists.org Subject: [tarantool-patches] Re: [PATCH 1/2] swim: pool IO tasks Date: Tue, 9 Jul 2019 00:54:32 +0300 [thread overview] Message-ID: <20190708215432.GB7873@atlas> (raw) In-Reply-To: <35c77ced-50ea-faed-7d41-571020fbbfbb@tarantool.org> * Vladislav Shpilevoy <v.shpilevoy@tarantool.org> [19/07/08 22:14]: > > What happens if I create multiple instances of swim library in > > multiple threads? These instances will try to concurrently access > > these members without mutexes. > > How is it possible? SWIM works in TX only. You just can't > create it another thread. It is literally impossible. My point is, the library should either explicitly prohibit it by panicking in swim_new/swim_cfg, or should be resilient to it. Please choose. I'd rather make it not depend on tx or any other thread in particular, it's easier to test. > Even if someday it will work in another thread, still all > the SWIMs will work in one thread. So in future we won't > allow to scatter SWIMs among multiple threads as well. > > With the same reasoning we would need to make thread-local > all global on_replace triggers like on_replace_vinyl_deferred_delete > just in case if in future Vinyl will do DML/DQL in multiple > threads. But why should we do that now? I do not understand. > > >> > >>> > >>> Why not use mempool? > >>> > >>> > >> > >> Because 1) it is an overkill, 2) I don't want to depend on > >> slab allocator, 3) it just does not fit this case, according > >> to mempool description from mempool.h: > >> > >> "Good for allocating tons of small objects of the same size.". > > > > It is also quite decent for allocating many fairly large objects. > > The key point is that the object is of the same size. You can set > > up mempool the right slab size, and in this case it will do > > exactly what you want. > > > > And again - 'many' usually won't be the case. We will have 0-2 SWIMs > in 99% of cases. One internal SWIM for box, and one external created > by a user. Barely we will have more than 10 cached tasks. > > But ok, as you wish. This place is not as critical for me as thread > locality of the pool. At least we reuse existing code. Thread locality > still looks pointless waste of memory for me. OK, wait a second. I thought you're going to have a single task instance for each member. Which means a couple of dozen instances even in a two node cluster. Am I wrong? -- Konstantin Osipov, Moscow, Russia
next prev parent reply other threads:[~2019-07-08 21:54 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-07-05 22:40 [tarantool-patches] [PATCH 0/2] SWIM micro optimizations Vladislav Shpilevoy 2019-07-05 22:40 ` [tarantool-patches] [PATCH 1/2] swim: pool IO tasks Vladislav Shpilevoy 2019-07-05 23:01 ` [tarantool-patches] " Konstantin Osipov 2019-07-06 21:00 ` Vladislav Shpilevoy 2019-07-08 8:25 ` Konstantin Osipov 2019-07-08 18:31 ` Vladislav Shpilevoy 2019-07-08 21:54 ` Konstantin Osipov [this message] 2019-07-08 22:13 ` Vladislav Shpilevoy 2019-07-08 23:08 ` Konstantin Osipov 2019-07-09 19:43 ` Vladislav Shpilevoy 2019-07-09 22:24 ` Konstantin Osipov 2019-07-05 22:40 ` [tarantool-patches] [PATCH 2/2] swim: optimize struct swim_task layout Vladislav Shpilevoy 2019-07-05 23:02 ` [tarantool-patches] " Konstantin Osipov
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=20190708215432.GB7873@atlas \ --to=kostja@tarantool.org \ --cc=tarantool-patches@freelists.org \ --cc=v.shpilevoy@tarantool.org \ --subject='[tarantool-patches] Re: [PATCH 1/2] swim: pool IO tasks' \ /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