In the Partitioning based on PhotoID section, if we can generate unique PhotoIDs first and then find a shard number through “PhotoID % 10”, the above problems will have been solved.
First, this system is read heavy. By sharding based on PhotoID % 10, the photos are distributed to different shards. This means, to display the photos to the user who wants to view his\her photos or to the followers, there should be an intermediary operation to do scatter\gather approach before updating in cache. Isn’t storing the photos by partitioning UserID is better approach? This way the ready is much faster. For users with more photos they will not be part of this sharding scheme.