The Special Edition Is Timeless

Yep, this guy's enunciation of the word "run" is so brilliant (hint. see special edition) that it went back in time and got itself published before he was even born.

In other news, this other song makes me believe I can fly:

Also new crush!

WordFinder

I started working with Google's AppEngine application platform sometime in 2012. Since then I've written a few toy apps to experiment with all the available APIs on offer. Nothing too fancy, just apps that seem to work. Now I figured an app that did work while not being something that wouldn't take several man-months to code up would be a word game. Nothing too fancy on the UI-front, not too dumb on the server end. So with this goal in mind I started working on my very first AppEngine app codenamed WordMaker.

The game is fairly simple. It's being hosted over here. You get a new sequence of 10 alphabets and 60 seconds to make as many words as you can with it. If you can make the high score board you've achieved greatness for yourself and your clan. But this won't last forever. Somebody could beat your score eventually. So play long enough and hard enough and if you're lucky you could get the right combination of letters that will allow you to stay on top.

Change History:
Version 1
  • Baseline release
  • Totally random sequence of 20 letters!
  • Scoring by word length

Version 2
  • high scores board
  • Improved look and feel (barely)
  • Random sequences shortened to 10 letters

Version 3 - current release.
  • Update to the data model - Game entity has a unique id
  • Game entity now store the words submitted
  • High scores board improved - added link that takes you to the Game entity's page to see the words submitted as part of the game.
  • Sharded counters for game, score and word stats and stats widget

Feb 12th, 2014 - earlier today the app went over quota on DataStore read ops. This is in part due to the ajax calls that were occurring for the stats and high scores table updates at every word submission. With almost 10 words per minute being submitted you would expect at least 3 ajax calls / word submission x 10 calls / minute = 30 calls / minute. That is with just no words being submitted at all. I'm not sure how 50,000 read ops was hit so quickly. Since my read access to my datastore admin is not working due to exceeding the limit, I'll have no way of knowing how many read ops per call were being used up. Maybe tomorrow I will have some answers on this front.


Updated 2nd March, 2014. Figured out the cause for this. In a nutshell: too many sharded counters eat up the quota broth. How I keep track of the stats (number of games, number of words, average score per game) in the app is through sharded counter entities in the App Engine datastore. I was using one Entity per stat to do this at first, but then I saw the potential problems from a scalability standpoint. If more people started using the app, all would be contending for access to those 3 entities. So if there are more entities available to share the workload then the access contention and locking issues will be minimized. Take a look at the list of entities for Game counter.


As you can see I've got 15 sharded counters for one entity type actually storing very small values. Now imagine this for 3 entity types: Game, Word and Score. So we have ShardedGameCounter, ShardedWordCounter and ShardedScoreCounter - storing the number of games, the number of words and the total of all the game scores respectively. Each time the average score needs to be displayed in the Stats table in the game page, the scores from all these entities are totalled - one read per entity. - and then the stats calculated and displayed. If there are 20 ShardedGameCounter entities, then there are 20 reads for the total number of games to be calculated. Across three figures that is around 60 read calls to the DataStore. Now imagine that happening once per minute per game. If there are game sessions, that's 600 calls per minute. If the game continues for 60 minutes that is 36000 calls. So in about 1 hour and 20 minutes, I'd have exhausted the 50K calls daily quota on datastore reads. Thinking back to that day, that is exactly what happened. Things stopped working after just about an hour.

So where do we go from here? I must reduce the number of sharded counters for one.  Only create a new counter entity. when your counters cross a threshold value. Have a scheduled task to consolidate the totals into fewer counters that will speed things up as app has more counters than it needs.

Let's work on this and see what will come up next.

Waste Less Time

I'm not very productive on weekends, or without a deadline. Here are a couple of things I've tried out:

Get off Facebook.


The internet's biggest time sink is probably Facebook. It lead to a whole slew of services each attempting to out do each other to be the holder of the title for Humanity's Biggest Time Sink.

Notice how the login bar looks like a championship belt
The compulsion to check on my what my fellow human beings think of me, every 5 minutes is not healthy. I believe the scientific term is narcissism. Now, it's easier to check facebook than say to myself: "I am being narsiccstistic narcicssitic narcissistic."  It just takes one keystroke.

f YOU!
As soon as I press f and the Enter key, I'm going straight back to the land of Narcisissies since I don't actually need to remember my credentials. That one large jumbo-sized hoop I need to jump through is gone and I don't have anything to stop me from scrolling through the same CLICK-HERE-TO-SEE-HOW-ALLIGATORS-DO-IT reshared posts.

So all I do is this:

Impulse Check Force Field :  check
Uncheck Keep me logged in before logging in. And ensure you log out. This and setting a password that is hard to get right the first time ensures that any impulse sociological checks are limited to a great extent to when you actually have time to key in your credentials each time you visit facebook. Or you could actually try locking yourself out when you want to control yourself, because password resets are such a pain.

Step 2: Stop impulse checks on email
More in this list as I find time to write these down. Now time for Episode 2 of Fringe.