For example, Sina Weibo Weibo ID, the user uid of registered users, Baidu posted the post number of TID and so I have observed are in accordance with the release time to show increasing relations, but
I'm curious. This high concurrency Web site is generally distributed database, the database must have a cache, Message Queuing and other middleware, then how to ensure that the final insertion of multiple databases between their primary key self-increment when the case does not appear duplicated?
And now there are a lot of random ID generation algorithms with lower collision probabilities why aren't they used by these high-concurrency sites? Is it an efficiency reason?
Reply content:
such as Sina Weibo Weibo ID, registered users UID, Baidu Post number of posts, TID and so I have observed in accordance with the release time to show incremental relationship, but I am curious about this high concurrency site is generally distributed database, the database must have cache, Message Queuing and other middleware, So how do you ensure that when you end up inserting multiple databases, there is no duplication between their primary key self-increment?
And now there are a lot of random ID generation algorithms with lower collision probabilities why aren't they used by these high-concurrency sites? Is it an efficiency reason?
Recommend to you a popular science ID generator or a knowledge article called Global generator
http://weibo.com/p/1001603800404851831206
And then recommend a PHP implementation of the internal Twitter named Snowflake ID Generator
https://github.com/sschiau/Particle.php
I'm going to start talking nonsense ....
System is from scratch, from small to large majority.
Start with less money, more time tight, natural what the official support, what is simple and good maintenance of what. The late conversion cost is high, the risk is big, the income is low, who will go to the whole these have no.
Second, high concurrency, most of which are not concurrent writes.
Finally, even if you say the situation, then the number of the generator, from the increment ID is also possible. Okay, now the question is, how to start a distributed generator ...