An FB app was around during the Dev Day 2015 season, which generates a picture merging dev day logo along with user’s current profile picture and posts that in his/her facebook timeline. The user who generarted more pictures announced as the winner.
Anuradha presenting the FREE ticket to the Winner.
There were 478 unique users generated 1023 images. These numbers aren’t that stagerring but let’s see how this app was modeled.
App used Azure Blob storage and Table storage. Blob storage was used to store the merged images of the users.
In the Azure Blob storage there were two containers one is public and the other one is private. The app specific images were stored in the private container including the dev day logo. The generated images were kept in the public container so easy to post them to Facebook using the public URL.
Table storage was used to store the information of participants, and initial rule was share the picture and one user will be selected in random as a winner, so the design was like this.
There was only single partition and no much worry on that. But Facebook User Id had been used as the RowKey making that even if a user generates the image more than one time, there will be single entry in the table. As a lazy programmer i just used a single Upsert opertaion to write data to this table.
But soon after launching the app I noticed the usage pattern is significanly different and same users had been generating more than one image, I tracked this using the Table Storage TimeStamp column and also I had another columnd to track the last updated time.
To make the competition fair and increase the traffice, I redesigned it by announcing the new rule, saying the person who generates more images will be the winner. Changed the RowKey to a GUID and adding another Id column to track users.
At the end of the competition a simple group by Id query with the count revealed the winner.
Speacail thanks to @Madhawee for helping in the UI of the app.
Click to enlarge.