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 AA75C6EC5A; Mon, 15 Feb 2021 11:45:29 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org AA75C6EC5A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1613378729; bh=Ne6nFw53unejvZycPyR7zvZbpbr5XpXvQNxj5UHgf1c=; 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=LPTog56sEykqpMSsgAJ9WQF0KodCOY2meI3vP922mAcnUqxw9GNxk365ZMGLNAR5I obWxFB+I5JrEnQeLMqNd7vvMe5JvBGCe0H86SkRAN2E8sVoLwo7OcKzGyAqdlJAb6m kOI4c7ui4OstSxjIa2+yirddG2yVBOkaSk4es0K8= Received: from smtp54.i.mail.ru (smtp54.i.mail.ru [217.69.128.34]) (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 A165D6EC5A for ; Mon, 15 Feb 2021 11:45:28 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A165D6EC5A Received: by smtp54.i.mail.ru with esmtpa (envelope-from ) id 1lBZVW-0005AS-6P; Mon, 15 Feb 2021 11:45:26 +0300 To: Cyrill Gorcunov , Vladislav Shpilevoy Cc: tarantool-patches@dev.tarantool.org References: <20210212112541.27561-1-sergepetrenko@tarantool.org> Message-ID: <1694431a-9e87-f84e-cf37-fdb4a57e1dd1@tarantool.org> Date: Mon, 15 Feb 2021 11:45:25 +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: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD981647AC6901E234B76E96810B840B3DA78548B6B9C68F4E9182A05F538085040C7423FF83837754A0EF3BB1084E0471AA4F464C43C1B8D832D0C36C62834EF28 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7A40BF27E8345D582EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006372E000E903B06FBD58638F802B75D45FF5571747095F342E8C7A0BC55FA0FE5FC09AC22986A7926B836468A717D55504D44AB089A168F8BD0389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C091DAD9F922AA71188941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B6A70DDFFB3186CBC5CC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C2249F0B3E03343D255BA76E601842F6C81A12EF20D2F80756B5F7E9C4E3C761E06A776E601842F6C81A127C277FBC8AE2E8B9A05D43074D074F03AA81AA40904B5D9DBF02ECDB25306B2B25CBF701D1BE8734AD6D5ED66289B5278DA827A17800CE765B758295022C16667F23339F89546C5A8DF7F3B2552694A6FED454B719173D6725E5C173C3A84C37795E77BD711CB3535872C767BF85DA2F004C906525384306FED454B719173D6462275124DF8B9C9DE2850DD75B2526BE5BFE6E7EFDEDCD789D4C264860C145E X-C1DE0DAB: 0D63561A33F958A5034AEE27298AA3456F9042740258888C62905FBF513C1008D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75448CF9D3A7B2C848410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34951738D4D62E58A44DA8D23138B1D08A98B7BE8180162FA3821AF2AF3112AEE304CBA069365F593D1D7E09C32AA3244C317B8963AA46A52EA72C7045416B0A3A51E887DA02A9F7BFFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojcZK6cmu79qQ1i0lS8Jo/iw== X-Mailru-Sender: 583F1D7ACE8F49BDF0EA4664CAF0825DEB81E40E1B627C7128144EC68E11C97E546D61F697210871823C4E0A9438D55D74690CA6451351EDEC462FDC9CAD1E11B969B486931C0B990F27244EEAA5B9A5AE208404248635DF 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" 13.02.2021 01:25, Cyrill Gorcunov пишет: > On Fri, Feb 12, 2021 at 10:48:49PM +0100, Vladislav Shpilevoy wrote: >>> diff --git a/src/box/relay.cc b/src/box/relay.cc >>> index df04f8198..afc57dfbc 100644 >>> --- a/src/box/relay.cc >>> +++ b/src/box/relay.cc >>> @@ -836,11 +836,20 @@ relay_send(struct relay *relay, struct xrow_header *packet) >>> { >>> ERROR_INJECT_YIELD(ERRINJ_RELAY_SEND_DELAY); >>> >>> + static uint64_t row_cnt = 0; >> Relays are in threads. So this variable either should be thread-local, >> or be in struct relay. Otherwise you get non-atomic updates which may >> lead to some increments disappearing. > That's the good catch! Without lock/tls this gonna be completely > arbritrary updates. True. My bad I failed to notice this. > >> Given that thread-local variable access is not free, I would go for >> having it in struct relay, but up to you. > Actually tls access should be as cheap as regular memory access > except using different base register (iirc %fs on linux). But > maybe things are changed novadays. I found some random article regarding tls access cost: https://software.intel.com/content/www/us/en/develop/blogs/the-hidden-performance-cost-of-accessing-thread-local-variables.html So it might be not that cheap. However I didn't dive too deep into the article. I decided to implement the counter as relay member for now. -- Serge Petrenko