From 411fb49b02008fac5e35dcb8d1c8d677092589fd Mon Sep 17 00:00:00 2001 From: Brian Simpson Date: Fri, 31 Jul 2015 23:38:44 -0400 Subject: [PATCH] Use a separate memcache pool for hardcache. Previously it was part of the main memcache pool, but hardcache uses keys that are invalid for ascii protocol so it was blocking switching the main pool to ascii. --- r2/example.ini | 2 ++ r2/r2/lib/app_globals.py | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/r2/example.ini b/r2/example.ini index cc68e4bab..6b4d283c2 100644 --- a/r2/example.ini +++ b/r2/example.ini @@ -466,6 +466,8 @@ relcaches = 127.0.0.1:11211 stalecaches = # cache for tracking rate limit thresholds ratelimitcaches = 127.0.0.1:11211 +# hosts to store hardcache data +hardcache_memcaches = 127.0.0.1:11211 ############################################ MISCELLANEOUS diff --git a/r2/r2/lib/app_globals.py b/r2/r2/lib/app_globals.py index 13e48d746..db1f69d20 100644 --- a/r2/r2/lib/app_globals.py +++ b/r2/r2/lib/app_globals.py @@ -259,6 +259,7 @@ class Globals(object): 'srmembercaches', 'relcaches', 'ratelimitcaches', + 'hardcache_memcaches', 'cassandra_seeds', 'automatic_reddits', 'hardcache_categories', @@ -740,6 +741,16 @@ class Globals(object): validators=[], ) + # hardcache memcache pool + hardcache_memcaches = CMemcache( + "hardcache", + self.hardcache_memcaches, + binary=True, + min_compress_len=1400, + num_clients=num_mc_clients, + validators=[validate_size_error], + ) + self.startup_timer.intermediate("memcache") ################# CASSANDRA @@ -863,7 +874,7 @@ class Globals(object): # hardcache is used for various things that tend to expire # TODO: replace hardcache w/ cassandra stuff self.hardcache = HardcacheChain( - (localcache_cls(), memcaches, HardCache(self)), + (localcache_cls(), hardcache_memcaches, HardCache(self)), cache_negative_results=True, ) cache_chains.update(hardcache=self.hardcache)