zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Dunning <ted.dunn...@gmail.com>
Subject Re: counter with zookeeper
Date Thu, 02 Dec 2010 15:47:12 GMT
I would recommend that you increment the counter by 100 or 1000 and then
increment a local counter over the implied range.  This will drive the
amortized ZK overhead down to tens of microseconds which should be good for
almost any application. Your final ids will still be almost entirely
contiguous.  You could implement a fancier counter in ZK that remembers
returned chunks for re-use to get perfect contiguity if you really wanted
that.  Most dictionary applications can handle some gaps, though.

On Thu, Dec 2, 2010 at 7:40 AM, Claudio Martella <claudio.martella@tis.bz.it
> wrote:

> Hi Sam,
>
> Thank you very much for the reference, I'll implement my code based on
> your ZkClock.
>
> On 12/2/10 4:25 PM, Sam Tunnicliffe wrote:
> > Hi Claudio,
> >
> > we have a very similar use case, and developed
> http://github.com/talis/h1 to
> > meet it. Initially, we coded up the simplest thing we thought could work
> and
> > deployed it, figuring that we'd have plenty of scope for improvement once
> we
> > saw it running with real load. However, to date its been ticking over so
> > well we've not really had cause to spend any further effort on it. HTTP
> > obviously adds an overhead, but to be honest, latency has not been a
> problem
> > for us and we typically see response times of a few ms. Contention over
> keys
> > is not particularly high in our application, so we've not had problems
> there
> > either.
> >
> > Cheers,
> >
> > Sam
> >
> > Sam Tunnicliffe
> > Head of Development, Platform Division
> > Talis Systems Ltd
> > http://www.talis.com
> >
> > On 2 December 2010 14:29, Claudio Martella <claudio.martella@tis.bz.it
> >wrote:
> >
> >> Hi,
> >>
> >> I'm trying to implement a String->Long dictionary, as I'm doing text
> >> processing in M/R and would like to speed up my things.
> >> In order to implement the mapping, I need to access a high speed atomic
> >> counter that allows me to pick the latest used Long, increment it and
> >> use it for the latest-discovered new word to put in the dictionary.
> >>
> >> At first i thought about using a regular sequential znode and use the
> >> sequence number as the counter value, but I realize the sequence number
> >> is an int, while i'd like a long. Is that correct? I'm refering to
> >> Stat.getVersion() in the API.
> >>
> >> In case this strategy is unfeasible, the second possibility is to use a
> >> WriteLock to "/counter" to control access the payload of the znode,
> >> where i'd put the counter value, or access to a special row in
> >> cassandra, where i'd put the counter value. The Cassandra option is
> >> probably the best possibility, as i'm storing my dictionary there
> >> anyway, but I'd like to hear from you about latency and performance for
> >> this options in ZK.
> >>
> >>
> >> Thanks
> >>
> >> Claudio
> >>
> >> --
> >> Claudio Martella
> >> Digital Technologies
> >> Unit Research & Development - Analyst
> >>
> >> TIS innovation park
> >> Via Siemens 19 | Siemensstr. 19
> >> 39100 Bolzano | 39100 Bozen
> >> Tel. +39 0471 068 123
> >> Fax  +39 0471 068 129
> >> claudio.martella@tis.bz.it http://www.tis.bz.it
> >>
> >> Short information regarding use of personal data. According to Section
> 13
> >> of Italian Legislative Decree no. 196 of 30 June 2003, we inform you
> that we
> >> process your personal data in order to fulfil contractual and fiscal
> >> obligations and also to send you information regarding our services and
> >> events. Your personal data are processed with and without electronic
> means
> >> and by respecting data subjects' rights, fundamental freedoms and
> dignity,
> >> particularly with regard to confidentiality, personal identity and the
> right
> >> to personal data protection. At any time and without formalities you can
> >> write an e-mail to privacy@tis.bz.it in order to object the processing
> of
> >> your personal data for the purpose of sending advertising materials and
> also
> >> to exercise the right to access personal data and other rights referred
> to
> >> in Section 7 of Decree 196/2003. The data controller is TIS Techno
> >> Innovation Alto Adige, Siemens Street n. 19, Bolzano. You can find the
> >> complete information on the web site www.tis.bz.it.
> >>
> >>
> >>
>
>
> --
> Claudio Martella
> Digital Technologies
> Unit Research & Development - Analyst
>
> TIS innovation park
> Via Siemens 19 | Siemensstr. 19
> 39100 Bolzano | 39100 Bozen
> Tel. +39 0471 068 123
> Fax  +39 0471 068 129
> claudio.martella@tis.bz.it http://www.tis.bz.it
>
> Short information regarding use of personal data. According to Section 13
> of Italian Legislative Decree no. 196 of 30 June 2003, we inform you that we
> process your personal data in order to fulfil contractual and fiscal
> obligations and also to send you information regarding our services and
> events. Your personal data are processed with and without electronic means
> and by respecting data subjects' rights, fundamental freedoms and dignity,
> particularly with regard to confidentiality, personal identity and the right
> to personal data protection. At any time and without formalities you can
> write an e-mail to privacy@tis.bz.it in order to object the processing of
> your personal data for the purpose of sending advertising materials and also
> to exercise the right to access personal data and other rights referred to
> in Section 7 of Decree 196/2003. The data controller is TIS Techno
> Innovation Alto Adige, Siemens Street n. 19, Bolzano. You can find the
> complete information on the web site www.tis.bz.it.
>
>
>

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