From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tarantool-patches@freelists.org
Subject: Re: [tarantool-patches] Re: [PATCH 6/8] netbox: introduce fiber-async API
Date: Tue, 24 Apr 2018 16:05:51 +0300 [thread overview]
Message-ID: <20180424123902.vjw3wmz4xa3lu264@esperanza> (raw)
In-Reply-To: <feb6d53e-9c5b-efc3-032a-d20a126d44e2@tarantool.org>
On Mon, Apr 23, 2018 at 09:59:29PM +0300, Vladislav Shpilevoy wrote:
> Hello. Thanks for review!
>
> On 23/04/2018 19:44, Vladimir Davydov wrote:
> > On Mon, Apr 16, 2018 at 09:39:16PM +0300, Vladislav Shpilevoy wrote:
> > > Now any netbox call blocks a caller-fiber until a result is read
> > > from a socket, or time is out. To use it asynchronously it is
> > > necessary to create a fiber per request. Sometimes it is
> > > unwanted - for example if RPS is very high (for example, about
> > > 100k), and latency is about 1 second. Or when it is neccessary
> > > to send multiple requests in paralles and then collect responses
> > > (map-reduce).
> > >
> > > The patch introduces a new option for all netbox requests:
> > > is_async. With this option any called netbox method returns
> > > immediately (but still yields for a moment) a 'future' object.
> > >
> > > By a future object a user can check if the request is finalized,
> > > get a result or error, wait for a timeout, discard a response.
> > >
> > > Example of is_async usage:
> > > future = conn:call(func, {params}, {..., is_async = true})
> > > -- Do some work ...
> > > if not future.is_ready() then
> > > result, err = future:wait_result(timeout)
> > > end
> > > -- Or:
> > > result, error = future:result()
> > >
> > > A future:result() and :wait_result() returns either an error or
> > > a response in the same format, as the sync versions of the called
> > > methods.
> > >
> > > Part of #3107
> > > + -- It is possible that multiple fibers are waiting for
> > > + -- a result. In such a case a first, who got it, must
> > > + -- wakeup the previous waiting client. This one wakes
> > > + -- up another. Another wakes up third one, etc.
> > > + wakeup_client(old_client)
> >
> > This is rather difficult for understanding IMO. Can we use a fiber.cond
> > instead?
>
> Sure, we can. Done on the branch.
Thanks. The patch looks good to me now.
next prev parent reply other threads:[~2018-04-24 13:05 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-16 18:39 [PATCH 0/8] " Vladislav Shpilevoy
2018-04-16 18:39 ` [PATCH 1/8] lua: fix box.error.raise Vladislav Shpilevoy
2018-04-23 16:19 ` Vladimir Davydov
2018-05-08 15:36 ` [tarantool-patches] " Konstantin Osipov
2018-05-08 17:24 ` [tarantool-patches] " Vladislav Shpilevoy
2018-04-16 18:39 ` [PATCH 2/8] lua: allow to create and error object with no throw Vladislav Shpilevoy
2018-04-23 16:20 ` Vladimir Davydov
2018-05-08 15:37 ` [tarantool-patches] " Konstantin Osipov
2018-04-16 18:39 ` [PATCH 3/8] console: fix a bug in interactive readline usage Vladislav Shpilevoy
2018-04-23 16:20 ` Vladimir Davydov
2018-05-08 15:37 ` [tarantool-patches] " Konstantin Osipov
2018-04-16 18:39 ` [PATCH 4/8] netbox: extend codec with 'decode' methods Vladislav Shpilevoy
2018-04-23 16:42 ` Vladimir Davydov
2018-04-23 18:59 ` [tarantool-patches] " Vladislav Shpilevoy
2018-04-24 13:16 ` Vladimir Davydov
2018-05-08 15:49 ` [tarantool-patches] " Konstantin Osipov
2018-05-08 17:24 ` [tarantool-patches] " Vladislav Shpilevoy
2018-04-16 18:39 ` [PATCH 5/8] test: fix unstable test Vladislav Shpilevoy
2018-04-22 5:32 ` [tarantool-patches] " Kirill Yukhin
2018-05-08 15:50 ` Konstantin Osipov
2018-04-16 18:39 ` [PATCH 6/8] netbox: introduce fiber-async API Vladislav Shpilevoy
2018-04-23 12:31 ` [tarantool-patches] " Alexander Turenko
2018-04-23 18:59 ` Vladislav Shpilevoy
2018-04-23 16:44 ` Vladimir Davydov
2018-04-23 18:59 ` [tarantool-patches] " Vladislav Shpilevoy
2018-04-24 13:05 ` Vladimir Davydov [this message]
2018-04-16 18:39 ` [PATCH 7/8] netbox: remove schema_version from requests Vladislav Shpilevoy
2018-05-08 16:06 ` [tarantool-patches] " Konstantin Osipov
2018-05-08 17:24 ` [tarantool-patches] " Vladislav Shpilevoy
2018-04-16 18:39 ` [PATCH 8/8] netbox: implement perform_request via async version Vladislav Shpilevoy
2018-04-23 16:47 ` Vladimir Davydov
2018-04-23 19:00 ` [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=20180424123902.vjw3wmz4xa3lu264@esperanza \
--to=vdavydov.dev@gmail.com \
--cc=tarantool-patches@freelists.org \
--cc=v.shpilevoy@tarantool.org \
--subject='Re: [tarantool-patches] Re: [PATCH 6/8] netbox: introduce fiber-async API' \
/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