Is appengine Python datastore query much (>3x) slower than Java? -
i've been investigating appengine see if can use project , while trying choose between python , java, ran surprising difference in datastore query performance: medium large datastore queries more 3 times slower in python in java.
my question is: performance difference datastore queries (python 3x slower java) normal, or doing wrong in python code that's messing numbers?
my entity looks this:
person
firstname (length 8) lastname (length 8) address (20) city (10) state (2) zip (5)
i populate datastore 2000 person records, each field length noted here, filled random data , no fields indexed (just inserts go faster).
i query 1k person records python (no filters, no ordering):
q = datastore.query("person") objects = list(q.get(1000))
and 1k person records java (likewise no filters, no ordering):
datastoreservice ds = datastoreservicefactory.getdatastoreservice(); query q = new query("person"); preparedquery pq = ds.prepare(q); // force query run , return objects can sure // we've timed full query. list<entity> entitylist = new arraylist<entity>(pq.aslist(withlimit(1000)));
with code, java code returns results in ~200ms; python code takes longer, averaging >700ms. both apps on same app id (with different versions), use same datastore , should on level playing field.
all code available here, in case i've missed details:
this expected difference between python , java. aren't seeing differences in amount of time make query, amount of time takes parse result , fill receiving data structure.
you can test comparing time takes query single record. remember you'll need test several times , average total true benchmark account possible fluctuations in latency on backend.
in general, can expect compiled statically typed language java or scala faster interpreted language dynamically typed language ruby or python.
Comments
Post a Comment