I have an application where the main entity is a Story
and users can vote for each story. Each vote increments a vote_count
for the story.
I am concerned about write contention on the story so I plan to use a sharded counter for each story to track the votes.
Now my question: how could I get a list of stories ordered by number of votes? For example: show the 50 most highly votes stories.
My initial thought is to have a task run periodically that reads the counter values and updates a property on the actual story. It would be OK that the results of the query by vote were slightly out of date.