Append auto-incrementing number to generate TweetID

it’s said that

to make a new TweetID, we can take the current epoch time and append an auto-incrementing number to it

but in a distributed system it’s not so easy to generate an auto-incrementing number, how do we do that and what about the complexity/performance penalty involved?

Actual Twitter ID uses time stamp + machine number + sequence and they were at one point using snowflake.

In this way every machine can generate an ID that’s unique while only maintaining its own machine number and personal sequence number.

Snowflake info:

Second link has three more acticles, one from Instagram and one from Twitter

How does this solve the traffic distribution problem? They are essentially still sharded by timestamp, so the server with the latest tweets will be handling almost all the traffic.