Tarantool development patches archive
 help / color / mirror / Atom feed
From: Konstantin Osipov <kostja@tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tarantool-patches@freelists.org
Subject: [tarantool-patches] Re: [PATCH v2 2/2] iproto: allow to configure IPROTO_MSG_MAX
Date: Fri, 4 May 2018 11:46:24 +0300	[thread overview]
Message-ID: <20180504084624.GB5623@atlas> (raw)
In-Reply-To: <f12f5ccadc42b37cc92b70a72aa103a2b89cbc2e.1525381393.git.v.shpilevoy@tarantool.org>

* Vladislav Shpilevoy <v.shpilevoy@tarantool.org> [18/05/04 00:07]:

> -struct iproto_bind_msg: public cbus_call_msg
> +struct iproto_cfg_msg: public cbus_call_msg
>  {
> +	/** New URI to bind to. */
>  	const char *uri;
> +	bool need_update_uri;
> +
> +	/** New IProto max message count in fly. */
> +	int iproto_msg_max;
> +	bool need_update_msg_max;
>  };

need_update -> update

> +void
> +fiber_pool_set_max_size(struct fiber_pool *pool, int new_max_size)
> +{
> +	if (new_max_size < FIBER_POOL_SIZE_DEFAULT)
> +		new_max_size = FIBER_POOL_SIZE_DEFAULT;
> +
> +	if (new_max_size > pool->max_size) {
> +		pool->max_size = new_max_size;
> +		cbus_process(&pool->endpoint);
> +	} else {
> +		pool->max_size = new_max_size;
> +	}

Why do you need cbus_process here? This is error-prone. Please
remove.

> +--
> +-- Test TX fiber pool size limit. It is increased together with
> +-- iproto msg max.
> +--
> +run_max = 2500
> +---
> +...
> +box.cfg{net_msg_max = 5000}

Please reduce the number of messages/workers in your tests to several or
maybe a dozen, not hundreds or thousands. By having a lot of
fibers/messages you don't test anything new, only make
the test run longer and harder to debug.

The test would win from adding more randomness and more tries to
changes in msg max: e.g. why not increase/decrease msg max a few
times under unceasing load? This would test both growing the fiber
pool and shrinking it.

> +---
> +...
> +run_workers(conn)
> +---
> +...
> +run_workers(conn2)
> +---
> +...
> +wait_active(5000)
> +---
> +...
> +wait_finished(run_max * 2)
> +---
> +...
>  conn2:close()
>  ---
>  ...
> @@ -130,6 +243,6 @@ conn:close()
>  box.schema.user.revoke('guest', 'read,write,execute', 'universe')
>  ---
>  ...
> -box.cfg{readahead = old_readahead}
> +box.cfg{readahead = old_readahead, net_msg_max = limit}
>  ---
>  ...
> diff --git a/test/box/net_msg_max.test.lua b/test/box/net_msg_max.test.lua
> index 39f8f53f7..887d73ddc 100644
> --- a/test/box/net_msg_max.test.lua
> +++ b/test/box/net_msg_max.test.lua
> @@ -9,7 +9,7 @@ conn2 = net_box.connect(box.cfg.listen)
>  active = 0
>  finished = 0
>  continue = false
> -limit = 768
> +limit = box.cfg.net_msg_max
>  run_max = (limit - 100) / 2
>  
>  old_readahead = box.cfg.readahead
> @@ -72,8 +72,63 @@ run_workers(conn)
>  wait_active(limit + 1)
>  wait_finished(run_max)
>  
> +--
> +-- gh-3320: allow to change maximal count of messages.
> +--
> +
> +--
> +-- Test minimal iproto msg count.
> +--
> +box.cfg{net_msg_max = 2}
> +conn:ping()
> +#conn.space._space:select{} > 0
> +run_max = 15
> +run_workers(conn)
> +wait_active(3)
> +active
> +wait_finished(run_max)
> +
> +--
> +-- Increate maximal message count when nothing is blocked.
> +--
> +box.cfg{net_msg_max = limit * 2}
> +run_max = limit * 2 - 100
> +run_workers(conn)
> +wait_active(run_max)
> +-- Max can be decreased back even if now the limit is violated.
> +-- But a new input is blocked in such a case.
> +box.cfg{net_msg_max = limit}
> +old_active = active
> +for i = 1, 300 do fiber.create(do_long, conn) end
> +-- Afer time active count is not changed - the input is blocked.
> +wait_active(old_active)
> +wait_finished(active + 300)
> +
> +--
> +-- Check that changing net_msg_max can resume stopped
> +-- connections.
> +--
> +run_max = limit / 2 + 100
> +run_workers(conn)
> +run_workers(conn2)
> +wait_active(limit + 1)
> +box.cfg{net_msg_max = limit * 2}
> +wait_active(run_max * 2)
> +wait_finished(active)
> +
> +--
> +-- Test TX fiber pool size limit. It is increased together with
> +-- iproto msg max.
> +--
> +run_max = 2500
> +box.cfg{net_msg_max = 5000}
> +run_workers(conn)
> +run_workers(conn2)
> +wait_active(5000)
> +wait_finished(run_max * 2)
> +

-- 
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.io - www.twitter.com/kostja_osipov

  reply	other threads:[~2018-05-04  8:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-03 21:05 [tarantool-patches] [PATCH v2 0/2] IProto fix and net_msg_max option Vladislav Shpilevoy
2018-05-03 21:05 ` [tarantool-patches] [PATCH v2 1/2] iproto: fix error with unstoppable batching Vladislav Shpilevoy
2018-05-04  8:26   ` [tarantool-patches] " Konstantin Osipov
2018-05-04 11:56     ` Vladislav Shpilevoy
2018-05-03 21:05 ` [tarantool-patches] [PATCH v2 2/2] iproto: allow to configure IPROTO_MSG_MAX Vladislav Shpilevoy
2018-05-04  8:46   ` Konstantin Osipov [this message]
2018-05-04 11:56     ` [tarantool-patches] " Vladislav Shpilevoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180504084624.GB5623@atlas \
    --to=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='[tarantool-patches] Re: [PATCH v2 2/2] iproto: allow to configure IPROTO_MSG_MAX' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox