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 5732521318 for ; Wed, 3 Jul 2019 19:29:50 -0400 (EDT) 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 uj13-xDitx-z for ; Wed, 3 Jul 2019 19:29:50 -0400 (EDT) Received: from smtp55.i.mail.ru (smtp55.i.mail.ru [217.69.128.35]) (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 AF4FF20E2E for ; Wed, 3 Jul 2019 19:29:49 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH v2 1/2] swim: disseminate event for log(cluster_size) steps References: <20190703190645.GB17318@atlas> From: Vladislav Shpilevoy Message-ID: <66e2eca5-882b-8479-50c1-ea6cd148afdb@tarantool.org> Date: Thu, 4 Jul 2019 01:30:51 +0200 MIME-Version: 1.0 In-Reply-To: <20190703190645.GB17318@atlas> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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: Konstantin Osipov Cc: tarantool-patches@freelists.org Hi! Thanks for the review! >> diff --git a/src/lib/swim/swim.c b/src/lib/swim/swim.c >> index bb9e9f519..9647094f5 100644 >> --- a/src/lib/swim/swim.c >> +++ b/src/lib/swim/swim.c >> @@ -616,7 +616,24 @@ swim_register_event(struct swim *swim, struct swim_member *member) >> rlist_add_tail_entry(&swim->dissemination_queue, member, >> in_dissemination_queue); >> } >> - member->status_ttd = mh_size(swim->members); >> + /* >> + * Logarithm is a perfect number of disseminations of an >> + * event. >> + * >> + * Firstly, it matches the dissemination speed. >> + * >> + * Secondly, bigger number of disseminations (for example, >> + * linear) causes events and anti-entropy starvation in >> + * big clusters, when lots of events occupy the whole UDP >> + * packet, and factually the same packet content is being >> + * sent for quite a long time. No randomness. Anti-entropy >> + * does not get a chance to disseminate something new and >> + * random. Bigger orders are redundant and harmful. >> + * >> + * Thirdly, logarithm is proved by the original >> + * SWIM paper as the best option. >> + */ >> + member->status_ttd = ceil(log2(mh_size(swim->members))); I've changed this place to member->status_ttd = ceil(log2(mh_size(swim->members))) + 1; It allows to do not break the tests in this commit, and fixes a bug, when status_ttd became negative for 'self'. Because ceil(log2(1)) = 0, and on a next round step it became -1, -2, etc. I didn't push the patch yet, if you have anything against that.