6 ms·
4, not 3
by jaromir_ 4y ago
4, not 3
- benreesman 4y agoHaha that’s right, good catch. You can tell it’s been awhile since I tested in prod. :)
- grishka 4y agoWhat are/were IDs 1, 2, and 3 for, then? VKontakte, the Russian Facebook, has another ID system entirely: each namespace kinda gets its own ID sequence. Pavel Durov is unsurprisingly ID 1. Group 1 is the group for app developers, but no idea what it was initially. Other objects are identified by a (type, owner ID, object ID) triplet, the object ID is unique within the type and the particular database server that's chosen based on the owner ID. Really simple to work with once you get into it. Does Facebook use a single global ID namespace for everything?
- benreesman 4y agoFacebook engineers know that VK engineers are serious as a heart attack. It’s 4 because he was prototyping the ID system. Facebook, as well as VK, have gotten quite fancy since about partitioning 64 bits.
- grishka 4y ago> Facebook engineers know that VK engineers are serious as a heart attack. Lmao. To be honest, it's surprising VK works as well as it does. Especially with all those custom, written-from-scratch databases aka "KittenDB". Oh and did you know that all strings are stored internally in the Windows-1251 encoding? And because it's an 8-bit Cyrillic encoding, characters that can't be represented in it, are stored as HTML entities. The API used to spit strings out exactly as they were stored, except converted to UTF-8, and it has caused me a lot of pain as an app developer. Their removal was a big thing: https://vk.com/wall85635407_3133 https://vk.com/wall85635407_3133 (btw here you can see the ID structure: "wall" is the type, wall post, 85635407 is the owner, 3133 is the post ID). Some ancient version of KittenDB is open source: https://github.com/vk-com/kphp-kdb https://github.com/vk-com/kphp-kdb, I managed to set it up on my server, but tbh you'll be better off using just about any other sufficiently popular database out there. This thing uses a binlog, keeps as much data as possible in-memory, and the schema is very fixed. It's basically a *-engine per every possible purpose.
- easrng 4y agoAlso you can integer overflow vk ids and they still work (ex. https://vk.com/id18446744073709551617 https://vk.com/id18446744073709551617 and https://vk.com/id1 https://vk.com/id1 go to the same place)