How is the URL of Segmentfault implemented?

Source: Internet
Author: User
HTTPS://SEGMENTFAULT.COM/A/11 ...
How the 1190000000490733 behind the URL is implemented, and the benefits of this approach

Reply content:

HTTPS://SEGMENTFAULT.COM/A/11 ...
How the 1190000000490733 behind the URL is implemented, and the benefits of this approach

That's the answer you want.
http://segmentfault.com/q/1010000000142374

The following answer is all speculation, if there is a similarity, purely coincidental!

There is a service similar to the global generator, which is issued by a fixed system rule

The first three bits are reserved for the system module with identifiers, such as 101 is the question and answer, 119 is the article, the note is 133, the position is 128, the activity is 116, the collection is 123, etc. maybe there are other modules

Then the next 13 bits is the equivalent of a trillion amount of data reserved, all the modules generated in the system to do a unified self-increment

The benefits are:
1. Easy to deploy database by module, sub-table, distributed, etc.
2. Convenient service architecture
3. A certain threshold for recursive acquisition of full stack data
4. Hide the actual amount of data for a module
5. Quickly know which module the data belongs to by the first three digits of the ID
6. There should be ...

A should represent article, and your URL represents viewing an article with ID 1190000000490733. This ID is a random generation of rules, the purpose is to prevent users to guess, to prevent the crawler to catch. If you 1,2,3,4,5 this whole number into the back row, people will guess.

Much like a restful interface, read the RESTful API Design Guide This article knows the benefits of the RESTful specification and uses HTTP actions more rationally to make the interface very clear.
As for the implementation, just make sure to generate a unique ID.

You can use the MySQL uuid_short function to generate the UUID. Of course, SF can also customize the rules themselves or use PHP's generated UUID function implementation.

Tested and found that this ID is not contiguous. The guess should be an ID generated by the ID build service that supports the sub-deployment.

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

The article is an estimate of the use of this ID to generate the service, so directly to a id+1, is not access to 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.