With more than 25 photos & 90 likes every second, we store a lot of data here at Instagram. To make sure all of our important data fits into memory and is available quickly for our users, we’ve begun to shard our data—in other words, place the data in many smaller buckets, each holding a part of the data.
Insightful blogpost explaining how exactly Instagram is generating unique IDs.
Related: be sure to read Jurriaan Persyn’s blogpost on Sharding at Netlog too. Highly recommended reading material.