Reputation: 1316
When we upload any photo to Facebook it is renamed by Facebook. The new name generally has the following pattern: 393268_10151029983750034_598680033_21778114_899520598_n.jpg
This name can be split with underscore in 6 parts.
I have the following questions regarding this naming convention:
Upvotes: 6
Views: 11101
Reputation: 200
I don't really know how exactly they handle this naming scheme, but I suspect it has to do with their storage.
Facebook uses a database named RocksDB, on top of a MySQL fork (Created specifically for this database), which is called MyRocks.
They used MySQL until 2012, but then switched to a No-SQL type of because of their 'unique needs'.
RocksDB can only store key-value pairs, and then the data structure must be adapted for this, hence, if you cant have the user's ID in a table, and the photos belonging to that user in other, they can be bound via normalization, which in this case prioritizes speed over storage size.
The advantage of such a system, would be speed, as you save the overhead of a traditional join by calculating beforehand the exact name of every piece of data you want to query.
Upvotes: 4
Reputation: 41
The very last piece _n is for the image size. You can try to change it with _s, and you'll see thumbnail instead, _b works as well, didn't try others
Upvotes: 4
Reputation: 6862
It prevents from naming conflicts and can be easier for internal management. I think there are no disadvantages. It's just a lot cleaner
Upvotes: 0