Skip to content

Comment on Twitter's UID associated to each tweet will very soon exceed 2,147,483,647parent

Comments

I'd also expect most of those numbers not to be used. Their db writes are probably not contending on one monotonic counter. They're probably using some numbering scheme which guarantees uniqueness across multiple writable databases, but not global serialisation based on id.

I'm not sure how they'd be doing that and still giving each tweet a number so close to all the others. I have no idea where you see a "public timeline" as people mentioned above, so I just did a search for "i"... the following tweets were about a second apart.

2088840357 2088840362 (difference of 5, and that's without a real public timeline where you could easily prove each tweet takes the next number in a sequence)

So it isn't as if they're using UUIDs or something unique... they very much seem to be relying on a single counter (currently).

For a first guess, if there were 5 writing dbs, each could write every 5th id, starting at a different index (0,1,2,3,4).

You'd end up with globally unique ids, and as long as your writes were (approx.) evenly distributed, all 5 sequences would be (approx.) close to each other.

Who knows, they might have 100 writable dbs, with only 70% up at any point in time, meaning only 70% of all integers are actually used.. anyway, I don't know, I can just imagine them doing something like this if they wanted certain things from the system.

No. Because their API exposes an explicit ordering of the IDs - there is a sinceID: parameter.

You can get the public timeline from here: http://twitter.com/public_timeline

Note that one can delete a message, which could explain some gaps.

I think the gaps are mostly people posting protected tweets, which thus don't get into the public timeline.

They do something like that with userid's. Used to be incrementing and now they have gaps.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.