version appengine java sdk 1.6.4.1
datanucleus jpa2.0.0
datanucleus cache 3.0.1
hi all
i am using the DN cache level 2 plugin.
<property name="datanucleus.cache.level2.type" value="javax.cache"/>
<property name="datanucleus.cache.level2.cacheName" value="xxxxx"/>
i noticed a performance issue with a straight forward query.
Query query = em.createQuery("Select m.key from MessageUser m "
+ "where " + " m.userKeyList = :userKey "
+ "AND m.date > :date ORDER BY m.date DESC");
with the cache ON it execute in 1159 ms, cache OFF 86 ms.
something is clearly wrong. from the appstats trace the cache version is
retrieving each entity in a serial manner from memcache.
cache OFF
(1) 2012-04-12 06:19:38.737 "GET
/timeline/status?id=49001&sincedate=1333485300" 200 real=86ms api=0ms
overhead=0ms (6 RPCs)
@11ms datastore_v3.RunQuery real=10ms api=241ms
@31ms datastore_v3.Get real=7ms api=208ms
@4ms datastore_v3.BeginTransaction real=4ms api=0ms
@52ms datastore_v3.Get real=7ms api=8ms
@65ms datastore_v3.Get real=4ms api=0ms
@78ms datastore_v3.Commit real=4ms api=0ms
cache ON
9) 2012-04-12 05:54:24.385 "GET /timeline/status?id=49001&sincedate=1333485300"
200 real=1159ms api=0ms overhead=0ms (109 RPCs)
@13ms datastore_v3.RunQuery real=12ms api=241ms
@28ms memcache.Get real=2ms api=0ms
@33ms memcache.Get real=2ms api=0ms
@37ms memcache.Get real=3ms api=0ms
@42ms memcache.Get real=2ms api=0ms
@47ms memcache.Get real=2ms api=0ms
@50ms memcache.Get real=2ms api=0ms
@54ms memcache.Get real=2ms api=0ms
@57ms memcache.Get real=2ms api=0ms
<repeat this for another 50 or60 times
@3ms datastore_v3.BeginTransaction real=4ms api=0ms
@1126ms datastore_v3.Get real=5ms api=8ms
@1134ms memcache.Get real=3ms api=0ms
@1139ms memcache.Get real=2ms api=0ms
@1143ms datastore_v3.Get real=4ms api=0ms
@1153ms datastore_v3.Commit real=3ms api=0ms
the code that iterates the entity list
List<Message> list = messageDAO.findSinceDate(userKey, sinceDate);
JSONArray jsonList = new JSONArray();
for (Message message : list) {
item.put("id", message.getKey().getId());
item.put("name", message.getName());
}
the performance using the DN level 2 cache is an order of magnitude worse than
not using cache.
Original issue reported on code.google.com by lu...@asteriski.com on 15 Apr 2012 at 2:30
Original issue reported on code.google.com by
lu...@asteriski.com
on 15 Apr 2012 at 2:30