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

2011-02-03 Thread Aklin_81
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 co

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

2011-02-03 Thread Matthew E. Kennedy
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

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

2011-02-03 Thread Ryan King
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 wrote: > Unless you need your user identifiers to be sequential for some reason, I > would sa

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

2011-02-03 Thread Aklin_81
Thanks Matthew & Ryan, The main inspiration behind me trying to generate Ids in sequential manner is to reduce the size of the userId, since I am using it for heavy denormalization. UUIDs are 16 bytes long, but I can also have a unique Id in just 4 bytes, and since this is just a one time process

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

2011-02-04 Thread Ryan King
On Thu, Feb 3, 2011 at 9:12 PM, Aklin_81 wrote: > Thanks Matthew & Ryan, > > The main inspiration behind me trying to generate Ids in sequential > manner is to reduce the size of the userId, since I am using it for > heavy denormalization. UUIDs are 16 bytes long, but I can also have a > unique Id

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

2011-02-04 Thread Aklin_81
Thanks so much Ryan for the links; I'll definitely take them into consideration. Just another thought which came to my mind:- perhaps it may be beneficial to store(or duplicate) some of the data like the Login credentials & particularly userId to User's Name mapping, etc (which is very heavily rea

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

2011-02-06 Thread Aaron Morton
If you mix mysql and Cassandra you risk creating a single point of failure around the mysql system. If you have use data that changes infrequently, a row cache in cassandra will give you fast reads. Aaron On 5/02/2011, at 8:13 AM, Aklin_81 wrote: > Thanks so much Ryan for the links; I'll def

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

2011-02-07 Thread David Boxenhorn
Why not synchronize on the client side? Make sure that the process that allocates user ids runs on only a single machine, in a synchronized method, and uses QUORUM for its reads and writes to Cassandra? On Sun, Feb 6, 2011 at 11:02 PM, Aaron Morton wrote: > If you mix mysql and Cassandra you risk

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

2011-02-28 Thread Ertio Lew
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 manip

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

2011-02-28 Thread Aaron Morton
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, Ert

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

2011-02-28 Thread Ertio Lew
On Tue, Mar 1, 2011 at 1:26 AM, Aaron Morton wrote: > 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