| Andrew Cooke | Contents | Latest | RSS | Twitter | Previous | Next


Welcome to my blog, which was once a mailing list of the same name and is still generated by mail. Please reply via the "comment" links.

Always interested in offers/projects/new ideas. Eclectic experience in fields like: numerical computing; Python web; Java enterprise; functional languages; GPGPU; SQL databases; etc. Based in Santiago, Chile; telecommute worldwide. CV; email.

Personal Projects

Lepl parser for Python.

Colorless Green.

Photography around Santiago.

SVG experiment.

Professional Portfolio

Calibration of seismometers.

Data access via web services.

Cache rewrite.

Extending OpenSSH.

C-ORM: docs, API.

Last 100 entries

Small Success With Go!; Re: Quick message - This link is broken; Adding Reverb To The Echo Chamber; Sox Audio Tools; Would This Have Been OK?; Honesty only important economically before institutions develop; Stegangraphy via PS4; OpenCL Mess; More Book Recommendations; Good Explanation of Difference Between Majority + Minority; Musical Chairs - Who's The Privileged White Guy; I can see straight men watching this conversation and laffing; When it's Actually a Source of Indignation and Disgust; Meta Thread Defending POC Causes POC To Close Account; Indigenous People Of Chile; Curry Recipe; Interesting Link On Marginality; A Nuclear Launch Ordered, 1962; More Book Recs (Better Person); It's Nuanced, And I Tried, So Back Off; Marx; The Negative Of Positive; Jenny Holzer Rocks; Huge Article on Cultural Evolution and More; "Ignoring language theory"; Negative Finger Counting; Week 12; Communication Via Telecomm Bids; Finding Suspects Via Relatives' DNA From Non-Crime Databases; Statistics and Information Theory; Ice OK in USA; On The Other Hand; (Current Understanding Of) Chilean Taxes / Contributions; M John Harrison; Playing Games on a Cloud GPU; China Gamifies Real Life; Can't Help Thinking It's Thoughtcrime; Mefi Quotes; Spray Painting Bike Frame; Weeks 10 + 11; Change: No Longer Possible To Merge Metadata; Books on Old Age; Health Tree Maps; MRA - Men's Rights Activists; Writing Good C++14; Risk Assessment - Fukushima; The Future of Advertising and Surveillance; Travelling With Betaferon; I think I know what I dislike so much about Metafilter; Weeks 8 + 9; More; Pastamore - Bad Italian in Vitacura; History Books; Iraq + The (UK) Governing Elite; Answering Some Hard Questions; Pinochet: The Dictator's Shadow; An Outsider's Guide To Julia Packages; Nobody gives a shit; Lepton Decay Irregularity; An Easier Way; Julia's BinDeps (aka How To Install Cairo); Good Example Of Good Police Work (And Anonymity Being Hard); Best Santiago Burgers; Also; Michael Emmerich (Vibrator Translator) Interview (Japanese Books); Clarice Lispector (Brazillian Writer); Books On Evolution; Looks like Ara (Modular Phone) is dead; Index - Translations From Chile; More Emotion in Chilean Wines; Week 7; Aeon Magazine (Science-ish); QM, Deutsch, Constructor Theory; Interesting Talk Transcripts; Interesting Suggestion Of Election Fraud; "Hard" Books; Articles or Papers on depolarizing the US; Textbook for "QM as complex probabilities"; SFO Get Libor Trader (14 years); Why Are There Still So Many Jobs?; Navier Stokes Incomplete; More on Benford; FBI Claimed Vandalism; Architectural Tessellation; Also: Go, Blake's 7; Delusions of Gender (book); Crypto AG DID work with NSA / GCHQ; UNUMS (Universal Number Format); MOOCs (Massive Open Online Courses); Interesting Looking Game; Euler's Theorem for Polynomials; Weeks 3-6; Reddit Comment; Differential Cryptanalysis For Dummies; Japanese Graphic Design; Books To Be Re-Read; And Today I Learned Bugs Need Clear Examples; Factoring a 67 bit prime in your head; Islamic Geometric Art; Useful Julia Backtraces from Tasks; Nothing, however, is lost with less discomfort than that which, when lost, cannot be missed

© 2006-2015 Andrew Cooke (site) / post authors (content).

Lessons Learned from AppEngine's Data Store

From: andrew cooke <andrew@...>

Date: Tue, 2 Aug 2011 19:57:31 -0400

This is a brief summary of the things I've learnt while using Google's
AppEngine Data Store - a "NoSQL" database designed for high performance.

  1 - Do this!  I was wary of AppEngine because of lock-in, etc, but you can
      easily get Django working, which avoids learning a whole new framework,
      and Django non-rel has the promise to liberate you completely, if needed
      (but see below).

      No amount of reading about "NoSQL" taught me what I learnt writing code
      - if you're a programmer, the GAE Data Store is a great intro.

  2 - Think hard about how your application works up-front.  This is a big
      shift from SQL, where you probably had a logical, normalised,
      independent, data model and then mapped between that and your
      application with SQL.  You can't do that with the Data Store.  Instead,
      you need to design the data model around the actions that occur in your

      In other words: with SQL you have the luxury of a layer of isolation
      (SQL) between your database and your data access objects.  With Data
      Store, your database maps directly to your data access objects.

  3 - Think hard about where you need transactions, and where not.  Again,
      this is reflected directly in the data model.  The one aspect of the
      Data Store that has impressed me most is how they have managed to
      combine scalability with transactions.

      For me, the necessary structure was pretty clear - I have users that
      "own" certain objects, so those "owned" objects are children of the
      users.  This lets me guarantee consistency where I need it (where users
      can see an account balance, for example).  Separate from that, and free
      of any transactions or trees, are the main data in my application.
      These are not guaranteed to be immediately consistent, but are much more
      efficiently handled.  The data model reflects all this.

  4 - Think about how caching can fail.  This isn't NoSQL-specific, but it's
      important anyway: caching gets easier the less strict you are about
      behaviour.  Choose the design so that if you cache too much, or for too
      long, it's not a problem - make it generous by default (so, for example,
      I have a resource that expires after a certain time, but I don't care
      whether caching extends that - what is important is that I never
      over-restrict a user).

      Related: use negative caching only where it is absolutely critical.
      It's so easy to get in a mess here...

  5 - Carefully choose the keys for your cache.  They should reflect the
      entire state you are caching, so that you don't need to worry about
      retrieving inconsistent data.

  6 - Clean out your database in a separate thread.  Omit non-critical
      write/delete operations from views.  Instead, delegate them to a
      background worker task.  This is particularly true when deleting - it's
      a slow, painful process to delete large amounts of data from the store.

      Inconsistency is your friend.  Much of your code has to work assuming
      inconsistent data anyway, so consider turning it to your advantage -
      assume very little and then tidy things later in a separate, batch task.

  7 - Don't rely on Django non-rel until you understand the store without it.
      The non-rel package was a great help when I was starting - my initial
      code looked like a nice, familiar Django project.  Then I began
      wondering just what "eventual consistency" might mean and realised I had
      some very nasty bugs, because non-rel doesn't currently support

      And even when transactions are added to non-rel (they are work in
      progress), I would suggest using the basic models Google provides until
      you understand the system in detail.  Despite reading much of the
      documentation I really didn't grasp how everything worked until I had
      used the API.

      So I would suggest the following: if it helps, start with non-rel to get
      your first views working; switch to Google's models until you understand
      transactions; go back to non-rel if and when you are confident it makes

      [Beware that the non-rel and related packages bundle 1.3, while 1.2 is
      the latest supported directly by AppEngine - I switched back to 1.2 when
      I switched models and it was worth it just for the reduced deploy time]

In summary:

 - Your data model must reflect the actions your code performs.
 - Your data model must reflect the transactions your code needs.
 - Simplify cache use with careful key choice and relaxed behaviour.
 - Don't try to keep everything consistent in your views - delegate 
   "clean-up" to worker tasks.


The Site in Question

From: andrew cooke <andrew@...>

Date: Tue, 9 Aug 2011 09:49:10 -0400

BTW, the site on which teh above is based is http://www.parti.cl - it provides
user-icons as a service to other sites.  So if you want attractive icons to
put next to users, you just load the images from there.

Comment on this post