cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Morton <aa...@thelastpickle.com>
Subject Re: Using a synchronized counter that keeps track of no of users on the application & using it to allot UserIds/ keys to the new users after sign up
Date Mon, 28 Feb 2011 19:56:31 GMT
This is mostly from memory. But the last 12 ? (4096 decimal) bits are a counter for the number
of id's generated in a particular millisecond for that server. You could use the high 4 bits
in that range for your data type flags and the low 8 for the counter. 

Aaron

On 1/03/2011, at 4:41 AM, Ertio Lew <ertiop93@gmail.com> wrote:

> Hi Ryan,
> 
> I am considering snowflake as an option for my usage with Cassandra
> for a distributed application.
> As I came to know snowflake uses 64 bits IDs. I am looking for a
> solution that could help me generate 64 bits Ids
> but in those 64 bits I would like at least 4 free bits so that I could
> manipulate with those free bits to distinguish the two rows for a same
> entity(split by kind of data) in same column family.
> 
> If I could keep the snowflake's Id size to around 60 bits, that would
> be great for my use case. Is it possible to manipulate the bits safely
> to around 60 bits? Perhaps the microsecond precision is not required
> to that much depth for my use case.
> 
> Any kind of suggestions would be appreciated.
> 
> Best Regards
> Ertio Lew
> 
> 
> 
> 
> 
> 
> 
> On Fri, Feb 4, 2011 at 1:09 AM, Ryan King <ryan@twitter.com> wrote:
>> You could also consider snowflake:
>> 
>> http://github.com/twitter/snowflake
>> 
>> which gives you ids that roughly sort by time (but aren't sequential).
>> 
>> -ryan
>> 
>> On Thu, Feb 3, 2011 at 11:13 AM, Matthew E. Kennedy
>> <matt.kennedy@spadac.com> wrote:
>>> Unless you need your user identifiers to be sequential for some reason, I would
save yourself the headache of this kind of complexity and just use UUIDs if you have to generate
an identifier.
>>> 
>>> On Feb 3, 2011, at 2:03 PM, Aklin_81 wrote:
>>> 
>>>> Hi all,
>>>> To generate new keys/ UserIds for new users on my application, I am
>>>> thinking of using a simple synchronized counter that can keep track of
>>>> the no. of users registered on my application and when a new user
>>>> signs up, he can be allotted the next available id.
>>>> 
>>>> Since Cassandra is eventually consistent, Is this advisable to
>>>> implement with Cassandra, but then I could also use stronger
>>>> consistency level like quorum or all for this purpose.
>>>> 
>>>> 
>>>> Please let me know your thoughts and suggesttions..
>>>> 
>>>> Regards
>>>> Asil
>>> 
>>> 
>> 
>> 
>> 
>> --
>> @rk
>> 

Mime
View raw message