I need to make a simple Post/Comments example shardable. The problem I have is user avatar. It is stored in the User document and in the current single-server implementation it is added to a Post/Comment in a Transformer with LoadDocument (i. e. LoadDocument(post.UserId).Avatar). That transformer obviously will not be an option for me in a sharded environment (I'm not gonna duplicate users for each shard). So how can I overcome this problem?
I have two ideas:
- Duplicate user avatar storage by storing it in every post and comment. Then when a user updates his avatar, that value should be updated in all posts and comments he created. Don't like this solution, user avatar doesn't seem like a perfect candidate for duplication
- Request posts/comments from appropriate shards, process them on the client so that we know the users whose avatars we need, make a separate request for users avatars, merge the results. That's the solution I'm leaning to at the moment.
Am I missing something?