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 88D3E6EC6F; Fri, 12 Feb 2021 14:37:53 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 88D3E6EC6F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1613129873; bh=VGpeHYRTa3vpYsLUM/hg4bPdCBj1RsRsNLot7HUgE9o=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=s+Li7TzFbqrVZQt8Lgtqo5850JhQKJH12DqidgVcuR8w0n4tv260Dp1rFaj5YUnFw MwUV+TGW/IYuR8sg3dejdr4gvWkZ5UjmLoNSKmyMPeEj2j8HEGv3bH2l6UdSztaDQU uxh0XnFl4XOPXa/d/WduRfq/VIj6VNAFNGWaR8hs= Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 9ECD16EC6F for ; Fri, 12 Feb 2021 14:37:51 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 9ECD16EC6F Received: by mail-lj1-f174.google.com with SMTP id j6so2105982ljo.5 for ; Fri, 12 Feb 2021 03:37:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=PXO4/sRbAyvnzu50DBIaAMzlxECbHeW9Ntob7nPQvjs=; b=S1p7pKeYzzjknbVdyF6XmC0Kvaa076as1Ihi0d9u1dVueJcS6FwdtPGRaFeYinvMvO FMr5AH69OspC08xXk8+NzgajMHaUrwmyexE9ZApB65UR/yraynpMjX5BhOnC0chCvgc6 wvy9TViFFJJybpwcbf11fof3yODSzpJn8QHmOOmsU96jafhu9BSOpa+x07RxvmAEqwRs IAWB0Dg/zDUpWsE0fzH6iIUAMeUTYS9xSqO3K4y0L2DGFADtBkIR80cscRNSpBOaxiQC GfQIWdRgC4XGRRvTsgnl3NjkU6UB1hsKaiuU8+N9C5/mkzyJewoCC7qGkOL2QMslQolE qGSw== X-Gm-Message-State: AOAM5313isxcxKsbgK2s8Zd1pWiHWmFdp9hEeaZCWxY25ZCHv6zPSBBf Igjqmhc0eN1bVp0ER4IdtJmai9MrkvU= X-Google-Smtp-Source: ABdhPJxt7tZUPBwc5SU2X1ejnpcqzX2EYOw5UJCP/Gyoa1jXmCkBQZxqA+Q/x2wWjGi0iBNypOZFzA== X-Received: by 2002:a2e:a0cd:: with SMTP id f13mr1532628ljm.284.1613129870457; Fri, 12 Feb 2021 03:37:50 -0800 (PST) Received: from grain.localdomain ([5.18.171.94]) by smtp.gmail.com with ESMTPSA id t19sm949042lfr.106.2021.02.12.03.37.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Feb 2021 03:37:49 -0800 (PST) Received: by grain.localdomain (Postfix, from userid 1000) id 836D8560077; Fri, 12 Feb 2021 14:37:48 +0300 (MSK) Date: Fri, 12 Feb 2021 14:37:48 +0300 To: Serge Petrenko Cc: v.shpilevoy@tarantool.org, tarantool-patches@dev.tarantool.org Message-ID: References: <20210212112541.27561-1-sergepetrenko@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210212112541.27561-1-sergepetrenko@tarantool.org> User-Agent: Mutt/2.0.5 (2021-01-21) 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: Cyrill Gorcunov via Tarantool-patches Reply-To: Cyrill Gorcunov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" On Fri, Feb 12, 2021 at 02:25:41PM +0300, Serge Petrenko wrote: > @@ -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; > packet->sync = relay->sync; > relay->last_row_time = ev_monotonic_now(loop()); > coio_write_xrow(&relay->io, packet); > fiber_gc(); > > + /* > + * It may happen that the socket is always ready for write, so yield > + * explicitly every now and then to not block the event loop. > + */ > + row_cnt++; > + if (row_cnt % WAL_ROWS_PER_YIELD == 0) { > + fiber_sleep(0); > + } Serge, if I'm not missing something obvious, this row counter is related to xstream->rows? So maybe define this type as size_t instead, to be consistent with another occurence of WAL_ROWS_PER_YIELD. Say, static size_t row_cnt = 0; ... if (++row_cnt % WAL_ROWS_PER_YIELD == 0) fiber_sleep(0); I'm fine with uint64_t as well, just out of curiosity.