Monday, September 9, 2013

Key Value Pair Service on Google App Engine

I had the need to include in-game dictionaries for an online game I was enhancing through a Google Chrome Extension.

When I decided to look for a simple key value pair service to load the dictionaries, I assumed I'd find loads of examples or some stable implementation that I could leverage. I found one service that appeared to not have much support and a few examples which were not quite there.

 As I was busy with a few other things at the time, I mentioned Google App Engine to the developer I was working with as a possible solution. I said, we might have a free solution if we manage to remain within the specified quotas. I hadn't conceptualized the flow, so I couldn't say whether or not that was possible. We needed to keep the price low (read zero) because the extension is free, and will always be. When a window opened up I decided to go for it.

First decision,

  1. Go with PHP as that is the language I've used most often
  2. Go with Python to get more experience as I had done only a few basic example before.
Easy choice, Python. Time to reduce the verbosity and get to the gold.

Step 1.

Convert dictionaries to a static file that could be read quickly. I had a few failed attempts at getting good performance with
  • JSON
  • msgpack - It claims to be like JSON but fast and small. It still didn't work so well for me.
  • marshal
I then decided to try to implement cPickle which I'd read about before the other two but for some reason, I didn't try it.



To be continued.........

No comments:

Post a Comment