⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 107337 in webkit


Ignore:
Timestamp:
Feb 9, 2012, 6:19:55 PM (15 years ago)
Author:
rniwa@webkit.org
Message:

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):

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r107274 r107337  
     12012-02-09  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Perf-o-matic shouldn't rely on memcache to store cached JSON responses
     4        https://bugs.webkit.org/show_bug.cgi?id=78306
     5
     6        Reviewed by Adam Barth.
     7
     8        Added PersistentCache model that stores the generated JSON responses.
     9
     10        * Websites/webkit-perf.appspot.com/controller.py:
     11        (set_persistent_cache):
     12        (set_persistent_cache.execute):
     13        (get_persistent_cache):
     14        (cache_manifest):
     15        (CachedManifestHandler.get):
     16        (cache_dashboard):
     17        (CachedDashboardHandler.get):
     18        (cache_runs):
     19        (CachedRunsHandler.get):
     20        * Websites/webkit-perf.appspot.com/models.py:
     21        (TestResult):
     22        (ReportLog):
     23        (PersistentCache):
     24
    1252012-02-09  Ryosuke Niwa  <rniwa@webkit.org>
    226
  • trunk/Websites/webkit-perf.appspot.com/controller.py

    r107274 r107337  
    3131from google.appengine.api import memcache
    3232from google.appengine.api import taskqueue
     33from google.appengine.ext import db
    3334
    3435from models import Test
     36from models import PersistentCache
     37
     38
     39def set_persistent_cache(name, value):
     40    memcache.set(name, value)
     41
     42    def execute():
     43        cache = PersistentCache.get_by_key_name(name)
     44        if cache:
     45            cache.value = value
     46            cache.put()
     47        else:
     48            PersistentCache(key_name=name, value=value).put()
     49
     50    db.run_in_transaction(execute)
     51
     52
     53def get_persistent_cache(name):
     54    value = memcache.get(name)
     55    if value:
     56        return value
     57    cache = PersistentCache.get_by_key_name(name)
     58    memcache.set(name, cache)
     59    return cache.value
    3560
    3661
    3762def cache_manifest(cache):
    38     memcache.set('manifest', cache)
     63    set_persistent_cache('manifest', cache)
    3964
    4065
     
    4671    def get(self):
    4772        self.response.headers['Content-Type'] = 'application/json'
    48         manifest = memcache.get('manifest')
     73        manifest = get_persistent_cache('manifest')
    4974        if manifest:
    5075            self.response.out.write(manifest)
     
    5479
    5580def cache_dashboard(cache):
    56     memcache.set('dashboard', cache)
     81    set_persistent_cache('dashboard', cache)
    5782
    5883
     
    6489    def get(self):
    6590        self.response.headers['Content-Type'] = 'application/json'
    66         dashboard = memcache.get('dashboard')
     91        dashboard = get_persistent_cache('dashboard')
    6792        if dashboard:
    6893            self.response.out.write(dashboard)
     
    7297
    7398def cache_runs(test_id, branch_id, platform_id, cache):
    74     memcache.set(Test.cache_key(test_id, branch_id, platform_id), cache)
     99    set_persistent_cache(Test.cache_key(test_id, branch_id, platform_id), cache)
    75100
    76101
     
    93118            platform_id = 0
    94119
    95         runs = memcache.get(Test.cache_key(test_id, branch_id, platform_id))
     120        runs = get_persistent_cache(Test.cache_key(test_id, branch_id, platform_id))
    96121        if runs:
    97122            self.response.out.write(runs)
  • trunk/Websites/webkit-perf.appspot.com/models.py

    r106687 r107337  
    117117
    118118
    119 # Temporarily log reports sent by bots
     119# Temporarily store log reports sent by bots
    120120class ReportLog(db.Model):
    121121    timestamp = db.DateTimeProperty(required=True)
    122122    headers = db.TextProperty()
    123123    payload = db.TextProperty()
     124
     125
     126# Used when memcache entry is evicted
     127class PersistentCache(db.Model):
     128    value = db.TextProperty(required=True)
Note: See TracChangeset for help on using the changeset viewer.