how to generate unique id like facebook, google+ in NodeJS

I'm using nodeJS and cassandra

I'm currently using UUID v1 as unique id

but, I think uuid is too long

I want to generate numeric unique id like fb and G+, which is shorter

and don't have to check if the id exist in DB or not before insert

example:

https://plus.google.com/104560124403688998123/posts

facebook/100001458264256

I'm thinking of generate it base on some user detail?

any good idea?

If you are creating your colum families with UUID types, they will be stored in binary, and only require 16 bytes on disk, which is already less than the 20 bytes you want.

Look at the cql docs,

CREATE COLUMNFAMILY MonkeyTypes (
    KEY uuid PRIMARY KEY,
    species text,
    alias text,
    population varint
)

You can use a database, zookeeper or snowflake to generate unique 8 byte ids.