Modified: trunk/ChangeLog (107336 => 107337)
--- trunk/ChangeLog 2012-02-10 02:13:08 UTC (rev 107336)
+++ trunk/ChangeLog 2012-02-10 02:19:55 UTC (rev 107337)
@@ -1,5 +1,29 @@
2012-02-09 Ryosuke Niwa <[email protected]>
+ Perf-o-matic shouldn't rely on memcache to store cached JSON responses
+ https://bugs.webkit.org/show_bug.cgi?id=78306
+
+ Reviewed by Adam Barth.
+
+ Added PersistentCache model that stores the generated JSON responses.
+
+ * Websites/webkit-perf.appspot.com/controller.py:
+ (set_persistent_cache):
+ (set_persistent_cache.execute):
+ (get_persistent_cache):
+ (cache_manifest):
+ (CachedManifestHandler.get):
+ (cache_dashboard):
+ (CachedDashboardHandler.get):
+ (cache_runs):
+ (CachedRunsHandler.get):
+ * Websites/webkit-perf.appspot.com/models.py:
+ (TestResult):
+ (ReportLog):
+ (PersistentCache):
+
+2012-02-09 Ryosuke Niwa <[email protected]>
+
Perf-o-matic should update memcache in taskqueue
https://bugs.webkit.org/show_bug.cgi?id=78209
Modified: trunk/Websites/webkit-perf.appspot.com/controller.py (107336 => 107337)
--- trunk/Websites/webkit-perf.appspot.com/controller.py 2012-02-10 02:13:08 UTC (rev 107336)
+++ trunk/Websites/webkit-perf.appspot.com/controller.py 2012-02-10 02:19:55 UTC (rev 107337)
@@ -30,12 +30,37 @@
import webapp2
from google.appengine.api import memcache
from google.appengine.api import taskqueue
+from google.appengine.ext import db
from models import Test
+from models import PersistentCache
+def set_persistent_cache(name, value):
+ memcache.set(name, value)
+
+ def execute():
+ cache = PersistentCache.get_by_key_name(name)
+ if cache:
+ cache.value = value
+ cache.put()
+ else:
+ PersistentCache(key_name=name, value=value).put()
+
+ db.run_in_transaction(execute)
+
+
+def get_persistent_cache(name):
+ value = memcache.get(name)
+ if value:
+ return value
+ cache = PersistentCache.get_by_key_name(name)
+ memcache.set(name, cache)
+ return cache.value
+
+
def cache_manifest(cache):
- memcache.set('manifest', cache)
+ set_persistent_cache('manifest', cache)
def schedule_manifest_update():
@@ -45,7 +70,7 @@
class CachedManifestHandler(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'application/json'
- manifest = memcache.get('manifest')
+ manifest = get_persistent_cache('manifest')
if manifest:
self.response.out.write(manifest)
else:
@@ -53,7 +78,7 @@
def cache_dashboard(cache):
- memcache.set('dashboard', cache)
+ set_persistent_cache('dashboard', cache)
def schedule_dashboard_update():
@@ -63,7 +88,7 @@
class CachedDashboardHandler(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'application/json'
- dashboard = memcache.get('dashboard')
+ dashboard = get_persistent_cache('dashboard')
if dashboard:
self.response.out.write(dashboard)
else:
@@ -71,7 +96,7 @@
def cache_runs(test_id, branch_id, platform_id, cache):
- memcache.set(Test.cache_key(test_id, branch_id, platform_id), cache)
+ set_persistent_cache(Test.cache_key(test_id, branch_id, platform_id), cache)
def schedule_runs_update(test_id, branch_id, platform_id):
@@ -92,7 +117,7 @@
branch_id = 0
platform_id = 0
- runs = memcache.get(Test.cache_key(test_id, branch_id, platform_id))
+ runs = get_persistent_cache(Test.cache_key(test_id, branch_id, platform_id))
if runs:
self.response.out.write(runs)
else:
Modified: trunk/Websites/webkit-perf.appspot.com/models.py (107336 => 107337)
--- trunk/Websites/webkit-perf.appspot.com/models.py 2012-02-10 02:13:08 UTC (rev 107336)
+++ trunk/Websites/webkit-perf.appspot.com/models.py 2012-02-10 02:19:55 UTC (rev 107337)
@@ -116,8 +116,13 @@
valueMax = db.FloatProperty()
-# Temporarily log reports sent by bots
+# Temporarily store log reports sent by bots
class ReportLog(db.Model):
timestamp = db.DateTimeProperty(required=True)
headers = db.TextProperty()
payload = db.TextProperty()
+
+
+# Used when memcache entry is evicted
+class PersistentCache(db.Model):
+ value = db.TextProperty(required=True)