From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 2F3E96EC58; Thu, 18 Feb 2021 23:24:45 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2F3E96EC58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1613679885; bh=gxMs5MMvzkYvdB/Rk+SWmuUrUr9gA3D0ll5G4uQU70I=; h=To:Cc:References:Date:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=ZVu/W83zf9ZkQjIyq9sVe80cnspivVHot+Eu2v2VegPbkQ4LrRFpGCpEv2/KjHV4n LMaxKYcx8VNSmsSCKRLm83KdKVTrlxvqH2881tRsEvQvfhmTqH6DwWX6c6KEHMoE38 7yEQMqO44q9G9mLSNDnMxNEiCjwvOlqN3hYvyiSI= Received: from smtp63.i.mail.ru (smtp63.i.mail.ru [217.69.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 548C86EC58 for ; Thu, 18 Feb 2021 23:24:44 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 548C86EC58 Received: by smtp63.i.mail.ru with esmtpa (envelope-from ) id 1lCpqt-0000vm-PQ; Thu, 18 Feb 2021 23:24:44 +0300 To: Vladislav Shpilevoy , gorcunov@gmail.com Cc: tarantool-patches@dev.tarantool.org References: <20210212112541.27561-1-sergepetrenko@tarantool.org> <57b04874-1bb7-3d62-856d-b60df700514a@tarantool.org> Message-ID: <774363df-6be5-a7b4-ea7f-d72903f3c409@tarantool.org> Date: Thu, 18 Feb 2021 23:24:43 +0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD975C3EC174F5669221340953D8FEAAFCA26BB79E5C093AA91182A05F538085040FAD28AAD89D08021AAC666AF79FA6D885FAAB466B845DACC9F62F9EF7B5C37B1 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7CB5C87C4C9A74E8BEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637AA32F0A5ADCF96E68638F802B75D45FF5571747095F342E8C7A0BC55FA0FE5FC12ACF8D6BDD292351FF87A8D50FBF945C5523402BF2E070A389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C084ED00A64A654CBE8941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B669875440691429F6CC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C224949BD6D9C51793B4D3AA81AA40904B5D9CF19DD082D7633A078D18283394535A93AA81AA40904B5D98AA50765F7900637603A514122A12673EC76A7562686271EEC990983EF5C032935872C767BF85DA29E625A9149C048EE0A3850AC1BE2E735D028CC0B556B22BC4AD6D5ED66289B524E70A05D1297E1BB35872C767BF85DA227C277FBC8AE2E8BD98D54E4746A01E775ECD9A6C639B01B4E70A05D1297E1BBC6867C52282FAC85D9B7C4F32B44FF57285124B2A10EEC6C00306258E7E6ABB4E4A6367B16DE6309 X-B7AD71C0: 502860A5C27E5D50661228F9A2C48A933DA88A7D86D98B915C0AF1600DCBC20B7391ECBED50DD98397C8C6B4DD9BE2D3 X-C1DE0DAB: 0D63561A33F958A5BC75375D27EBAB1FB11A50C09A59B2A6D10CA246F793836CD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75448CF9D3A7B2C848410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D346BEB6F73FB9D1E4A38514BE03F92801DA60E0518BE29A17975C8231F71112162C8E2832A6389E3DB1D7E09C32AA3244C3ED46BC9BC58A1E5A12A9612A71136B33FD9C8CA1B0515E0FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojspgX6BLqznP20uAZsxeFXA== X-Mailru-Sender: 583F1D7ACE8F49BDF0EA4664CAF0825D5FBE27A0B1A966D6FD924EE3882AAC06ECEBB2762DC917A4823C4E0A9438D55D74690CA6451351EDEC462FDC9CAD1E11B969B486931C0B990F27244EEAA5B9A5AE208404248635DF X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH] relay: yield explicitly every N sent rows X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Serge Petrenko via Tarantool-patches Reply-To: Serge Petrenko Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 18.02.2021 00:11, Vladislav Shpilevoy пишет: > Hi! Thanks for the fixes! Thanks for the review! > >> diff --git a/src/box/relay.cc b/src/box/relay.cc >> index 1d8edf116..6d9269e1d 100644 >> --- a/src/box/relay.cc >> +++ b/src/box/relay.cc >> @@ -117,6 +117,11 @@ struct relay { >>          * is passed by the replica on subscribe. >>          */ >>         uint32_t id_filter; >> +       /** >> +        * How many rows has this relay sent to the replica. Used to yield once >> +        * in a while when reading a WAL to unblock the event loop. >> +        */ >> +       size_t row_cnt; > 1. But it is not a size of anything, right? Maybe make it > int64_t then? uint64_t, probably? I'm fine with it. Fixed on the branch. > >> @@ -846,7 +851,7 @@ relay_send(struct relay *relay, struct xrow_header *packet) >>          * It may happen that the socket is always ready for write, so yield >>          * explicitly every now and then to not block the event loop. >>          */ >> -       if (++row_cnt % WAL_ROWS_PER_YIELD == 0) >> +       if (++relay->row_cnt % WAL_ROWS_PER_YIELD == 0) > 2. I just found WAL_ROWS_PER_YIELD is not a power of 2. This means > '%' may be expensive. If WAL_ROWS_PER_YIELD would be a power of 2, > '%' would be turned by the compiler into '&' to cut the remainder off. > > Maybe worth changing in a separate non-related to this bug commit? Good idea, thanks! Pushed on top of the original commit. -- Serge Petrenko