From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 26 Feb 2019 11:18:45 +0300 From: Vladimir Davydov Subject: Re: [PATCH v2] iproto: report active connections number Message-ID: <20190226081845.jq3mhuruvoerohtt@esperanza> References: <20190225223607.21729-1-i.kosarev@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190225223607.21729-1-i.kosarev@tarantool.org> To: Ilya Kosarev Cc: tarantool-patches@freelists.org, georgy@tarantool.org, i.kosarev@corp.mail.ru, Ilya Kosarev List-ID: On Tue, Feb 26, 2019 at 01:36:07AM +0300, Ilya Kosarev wrote: > diff --git a/src/box/iproto.cc b/src/box/iproto.cc > index 863eb4f06..386bab239 100644 > --- a/src/box/iproto.cc > +++ b/src/box/iproto.cc > @@ -263,14 +263,20 @@ static struct cord net_cord; > static struct slab_cache net_slabc; > > struct rmean *rmean_net; > +struct rmean *rmean_connections; > > enum rmean_net_name { > IPROTO_SENT, > IPROTO_RECEIVED, > IPROTO_LAST, > }; > +enum rmean_connection_name { > + IPROTO_CONNECTIONS, > + IPROTO_CONNECTIONS_LAST, > +}; Why do you use rmean for this at all? You don't need to account RPS, do you? I think you don't even need to introduce a new counter - instead you can simply use mempool_count(iproto_connection_pool). > diff --git a/test/box/stat_net.result b/test/box/stat_net.result > index b3e3db11f..dad932f8c 100644 > --- a/test/box/stat_net.result > +++ b/test/box/stat_net.result > @@ -46,8 +58,35 @@ box.stat.net.RECEIVED.total > 0 > --- > - true > ... > +box.stat.net.CONNECTIONS.total == 4 > +--- > +- true > +... > -- box.stat.net.EVENTS.total > 0 > -- box.stat.net.LOCKS.total > 0 > +cn1:close() > +--- > +... > +cn2:close() > +--- > +... > +fiber.sleep(0.001) What's fiber.sleep for? If there's a delay after close() you should use test_run.wait_cond() to exclude any possibility of a race. > +--- > +... > +box.stat.net.CONNECTIONS.total == 2 > +--- > +- true > +...