zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ariel Weisberg <aweisb...@voltdb.com>
Subject Re: use cases for asynchronous API
Date Thu, 09 Feb 2012 22:02:16 GMT

I use both. I use the async API when I want to reuse a single thread to
multiplex multiple processes using a single thread or send a batch of
requests to avoid waiting on round trip time. You can create an async
callback that is a future makes batching requests easy.

I try to use the synchronous API where possible to make the code read
sequentialy without nesting. That usually means a dedicated thread that
manages the process wide view of state coordinated in ZK for a given
subsystem or process.

If doing the work synchronously is an option that is my preference because
it involves less code, less indentation, and serializes interactions with
ZK (especially if you have a single actor).


On Thu, Feb 9, 2012 at 1:12 PM, Pierre Louis Aublin <
pierre-louis.aublin@inria.fr> wrote:

> Hello
> On 02/09/2012 11:22 AM, César Álvarez Núñez wrote:
>> Almost all my zk agents use asynchronous api; mainly because all services
>> are intrinsically asynchronous.
> Can you give me more details about these services? Can I found details
> about them on the web?
>  In fact I've wrapped the Zookeeper client to hide synchronous methods; so
>> anyone who want to develop new agents should think asynchronously.
>> It could be hard at first but one you are used to it, the resulting code
>> is
>> cleaner than with sync api, and more easy to understand and maintain by
>> other developers.
> I also imagine that in some scenarios event-based applications (i.e. that
> rely on the async api) provide better performance than applications that
> use the sync api.
> Thanks
> Pierre Louis
>  On Thu, Feb 9, 2012 at 10:32 AM, Pierre Louis Aublin<
>> pierre-louis.aublin@inria.fr>  wrote:
>>  Thank you for your replies.
>>> On 02/09/2012 12:46 AM, Benjamin Reed wrote:
>>>  the yahoo services mention use asynchronous operations a lot. during
>>>> startup and reconfig they would have to modify a bunch of znodes. by
>>>> shooting off the modifications asynchronously, they were able to
>>>> drastically reduce the startup and reconfig time.
>>>> ben
>>>>  On 02/09/2012 12:48 AM, Jordan Zimmerman wrote:
>>>  Some of the Curator recipes use async. For instance, adding a entry into
>>>> the DistributedQueue is done in the background as there's no reason for
>>>> the foreground process to wait for this.
>>>> -JZ
>>>> On 2/8/12 2:09 PM, "Pierre Louis Aublin"<pierre-louis.aublin@****
>>>> inria.fr <http://inria.fr><pierre-louis.aublin@**inria.fr<pierre-louis.aublin@inria.fr>
>>>> >
>>>> wrote:
>>>>   On Wed, Feb 8, 2012 at 2:09 PM, Pierre Louis Aublin
>>>> <pierre-louis.aublin@inria.fr>   wrote:
>>>>  Hello everybody
>>>>> I would like to know if the asynchronous operations of the client API
>>>>> are
>>>>> often used in applications that use Zookeeper.
>>>>> In [1] I found 3 applications built on Zookeeper (the Yahoo! Fetching
>>>>> Service, Katta and the Yahoo! Message Broker). However, I do not find
>>>>> if
>>>>> they use the synchronous or asynchronous operations.
>>>>> The big question I am trying to answer is : is it relevant to consider
>>>>> a
>>>>> closed-loop model in order to benchmark replicated services (Zookeeper
>>>>> being
>>>>> a good candidate to build replicated services)? Can you give me any
>>>>> clue
>>>>> on
>>>>> that?
>>>>> Thanks in advance
>>>>> Pierre Louis Aublin
>>>>> [1] ZooKeeper: Wait-free Coordination for Internet-scale Systems,
>>>>> Patrick
>>>>> Hunt and Mahadev Konar, /Yahoo! Grid;/ Flavio P. Junqueira and Benjamin
>>>>> Reed, /Yahoo! Research/

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message