How is the segmentfault url implemented?

Source: Internet
Author: User
Tags database sharding
Segmentfault. coma11... how the 1190000000490733 behind the url is implemented, and the benefits of this approach https://segmentfault.com/a/11...
How is 1190000000490733 implemented after a url, and the advantages of this method

Reply content:

Https://segmentfault.com/a/11...
How is 1190000000490733 implemented after a url, and the advantages of this method

This is the answer you need.
Http://segmentfault.com/q/1010000000142374

The answer below is speculation. if there are similarities, it is a coincidence!

There is a service similar to the global sender, which is issued according to fixed system rules.

The first three are reserved identifiers for the system module. for example, 101 is a Q & A, 119 is an article, 133 is a note, 128 is a job, 116 is an activity, and 123 is a Favorites. other modules may exist.

Then, the last 13 digits are equivalent to a trillion data records reserved, and all the data in all modules generated in the system is automatically increased.

Benefits:
1. facilitate Database Sharding by module, table sharding, and distributed deployment
2. convenient service architecture
3. threshold for recursive full-stack data collection
4. hide the actual data volume of a module
5. use the first three digits of the ID to quickly find out which module the data belongs.
6. There should be...

A should represent article. you can view the article with ID 1190000000490733 on this website. This type of ID has some random generation rules to prevent users from guessing and crawling. If the integers 1, 2, 3, 4, and 5 are connected to the backend, someone else can guess.

Like RESTful APIs, read The RESTful API Design Guide. This article will learn about the benefits of the RESTful specification. it makes the http action more reasonable and clear the interface.
As for the implementation method, you only need to ensure that a unique id is generated.

You can use the uuid_short function of mysql to generate a uuid. Of course, sf can also customize its own rules or use php to generate uuid functions.

After testing, we found that this id is not consecutive. A prediction is a service generated id that supports sub-deployment.

https://segmentfault.com/a/1190000000490733https://segmentfault.com/q/1010000006600460

Article; question; comments are estimated to use this id to generate the service. therefore, directly adding an id + 1 will not be able to access data.

The reason for using this distributed id generator is:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.