Previously I was using the class found here to convert userID to some random string.
From his blog:
Running:
alphaID(9007199254740989);
will return 'PpQXn7COf' and:
alphaID('PpQXn7COf', true);
will return '9007199254740989'
So the idea was that users could do www.mysite.com/user/PpQXn7COf and i convert that to a normal integer so i could do in mysql
"Select * from Users where userID=".alphaID('PpQXn7COf', true)
Now i'm just started working with Cassandra an i'm looking for some replacement.
- I want url like www.mysite.com/user/PpQXn7COf not like www.mysite.com/user/username1
- The "PpQXn7COf" uuid must be as short as possible.
In the Twissandra example explained here: http://www.rackspace.com/cloud/blog/2010/05/12/cassandra-by-example/
They create some long uuid (i guess it is so long because then its almost 100 percent sure its random).
In mysql i just had a userID column with auto increasement so when i used the alphaID() function i always got a very short random string.
Anyone an idea how to solve this as clean as possible?
Edit:
It is used for a social media site so it must be persistent. Thats also why i don't want to use usernames/realnames in urls, user cant remain google undetected if they need.
I just got a simple idea, however i don't know how scalable it is
<?php
//createUUID() makes +- 14 char string with A-Z a-z 1-0 based on micro/milli/nanoseconds
while(get_count(createUUID()) > 0){//uuid is unique
//insert username pass, uuid etc into cassandra
if($result == "1"){
header('Location: http://www.mysite.com/usercenter');
}else{
echo "error";
}
}
?>
When this gets the size of lets say twitter/facebook:
- Will it execute in acceptable time?
- Will it still generate unique uuid fast enough so if 10000 users/second are registering it isnt cluttering up?