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 C33126EC58; Thu, 18 Feb 2021 00:11:08 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C33126EC58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1613596268; bh=Z8Yv88aMh0tiLDEE2yjEfXdWRrZqxuagtOjlNQYKSaA=; 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=iZo/MeFvCdK7FYr+lo6h9lIYxGMspTfemgnEwjSoZTxL84JpJyet/+uBogk9qODg6 LOUQzzFiWH8O/PzEjcTTfdQpOq7f8CurjS24yKqaf9/79ivxiXbr6bE+ekIfxGjmjE 7frmc/K19nl3/kR9hws+6sko9cLp1xX5M7Lk4O/g= Received: from smtp29.i.mail.ru (smtp29.i.mail.ru [94.100.177.89]) (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 B37C76EC58 for ; Thu, 18 Feb 2021 00:11:07 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org B37C76EC58 Received: by smtp29.i.mail.ru with esmtpa (envelope-from ) id 1lCU6D-0007tT-9M; Thu, 18 Feb 2021 00:11:05 +0300 To: Serge Petrenko , 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: Date: Wed, 17 Feb 2021 22:11:04 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <57b04874-1bb7-3d62-856d-b60df700514a@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD975C3EC174F56692254B0AABE1FB071B2BA6557555153D6A0182A05F538085040B1871AE3376CA88B264E9261452262061C81E17F3E8877950729DD895B92FB27 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7518FA0CDCCF25698EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006375104F503C4FA42DF8638F802B75D45FF5571747095F342E8C7A0BC55FA0FE5FC018EC8C0DA057E005E61E65210B9222A04CF29D902B10070389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C0565C7A4E90E531F78941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B60417BEADF48D1460CC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C2249EBAA48D4B337DEE676E601842F6C81A12EF20D2F80756B5F7E9C4E3C761E06A776E601842F6C81A127C277FBC8AE2E8BB75AE3CC788C792D3AA81AA40904B5D9DBF02ECDB25306B2B25CBF701D1BE8734AD6D5ED66289B5278DA827A17800CE7D151390FFDBF639967F23339F89546C5A8DF7F3B2552694A6FED454B719173D6725E5C173C3A84C3E2C51E5CF308F7B035872C767BF85DA2F004C906525384306FED454B719173D6462275124DF8B9C934F12F0C005D1A85E5BFE6E7EFDEDCD789D4C264860C145E X-B7AD71C0: 14C14B24D00AF5AC321EF223B8115265C69B993890792DF82CDD5689AFBDA7A24A6D60772A99906F8E1CD14B953EB46D3E418B64DACE8027355D89D7DBCDD132 X-C1DE0DAB: 0D63561A33F958A5CDA7B9A84584D32CBCD75233AEFDE8C6EC2193E536234785D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75448CF9D3A7B2C848410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D347215713CF3EEE9D1DE42FCC0832E913285AC5137BC7F47C617FF8FC308E87A450ACBF891A747721E1D7E09C32AA3244CDECA958B95DB45E067D8C5AB7A662D1A853296C06374E602FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojJkVkVdRHm/8hXjcY3pPGLQ== X-Mailru-Sender: 504CC1E875BF3E7D9BC0E5172ADA3110B019FF337BEDAD06AD491B15D3D204A96115718EBCD968C607784C02288277CA03E0582D3806FB6A5317862B1921BA260ED6CFD6382C13A6112434F685709FCF0DA7A0AF5A3A8387 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: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi! Thanks for the fixes! > 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? > @@ -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?