From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id B24F626087 for ; Tue, 5 Feb 2019 12:40:01 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zbwlgdlp5LcS for ; Tue, 5 Feb 2019 12:40:01 -0500 (EST) Received: from smtp16.mail.ru (smtp16.mail.ru [94.100.176.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id ECD0222E19 for ; Tue, 5 Feb 2019 12:40:00 -0500 (EST) Received: by smtp16.mail.ru with esmtpa (envelope-from ) id 1gr4hS-0007rN-Td for tarantool-patches@freelists.org; Tue, 05 Feb 2019 20:39:59 +0300 Date: Tue, 5 Feb 2019 20:39:58 +0300 From: Konstantin Osipov Subject: [tarantool-patches] Re: [PATCH 7/9] vinyl: randomize range compaction to avoid IO load spikes Message-ID: <20190205173958.GG6811@chai> References: <44f34fbaf09af5d1054f2e4843a77e095afe1e71.1548017258.git.vdavydov.dev@gmail.com> <20190122125458.cutoz5rtfd2sb6el@esperanza> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190122125458.cutoz5rtfd2sb6el@esperanza> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org * Vladimir Davydov [19/01/22 15:56]: > I ran some tests and, surprisingly, it turned out that randomization > didn't help at all: the compaction queue size jumped up to 30% and even > 40% from time to time although there was plenty of compaction power - > compaction threads were busy only half of the time. When I looked > closer, I saw that the queue size behavior looked weird - it jumped > after a dump for a very short period of time, until the next dump, which > pushed it back to 10%. This made me wonder how it could happen at all - > normally, compaction queue should only grow after a dump, not diminish. > I think I've finally found the root cause of the problem. The code > computing compaction priority (see vy_range_update_compaction_priority) > is unstable meaning the size of the first level equals the size of the > smallest run so if memory dumps produce runs of varying sizes, which is > what happens in practice in contrast to simulation, the shape of the > tree will vary as well, resulting in different compaction priority and > unstable queue behavior. > > We must fix this somehow. One way to do it is compute the first level > size basing on the size of the last level run, which is constant most of > the time, and indeed, when I did it and reran the tests, I found that > the queue stayed below 10% all the time. Turning off randomization, made > the queue jump up to 30%, which was expected. The diff is below. I'll > spruce it up a little, wrap it nicely, and submit it separately later. Why not use a simple weighted average? -- Konstantin Osipov, Moscow, Russia, +7 903 626 22 32 http://tarantool.io - www.twitter.com/kostja_osipov