s/memcached_requests/remote_cache_requests/g

This commit is contained in:
Ryan Moore
2016-03-30 18:24:05 -07:00
committed by Tim Abbott
parent 16c936f638
commit 1a2117292f
3 changed files with 12 additions and 12 deletions

View File

@@ -24,7 +24,7 @@ memcached_total_requests = 0
def get_remote_cache_time():
return memcached_total_time
def get_memcached_requests():
def get_remote_cache_requests():
return memcached_total_requests
def memcached_stats_start():

View File

@@ -9,7 +9,7 @@ from zerver.models import Message, UserProfile, Stream, get_stream_cache_key, \
Huddle, huddle_hash_cache_key
from zerver.lib.cache import cache_with_key, cache_set, message_cache_key, \
user_profile_by_email_cache_key, user_profile_by_id_cache_key, \
get_remote_cache_time, get_memcached_requests, cache_set_many
get_remote_cache_time, get_remote_cache_requests, cache_set_many
from django.utils.importlib import import_module
from django.contrib.sessions.models import Session
import logging
@@ -74,7 +74,7 @@ cache_fillers = {
def fill_memcached_cache(cache):
remote_cache_time_start = get_remote_cache_time()
memcached_requests_start = get_memcached_requests()
remote_cache_requests_start = get_remote_cache_requests()
items_for_remote_cache = {}
(objects, items_filler, timeout, batch_size) = cache_fillers[cache]
count = 0
@@ -86,5 +86,5 @@ def fill_memcached_cache(cache):
items_for_remote_cache = {}
cache_set_many(items_for_remote_cache, timeout=3600*24*7)
logging.info("Succesfully populated %s cache! Consumed %s memcached queries (%s time)" % \
(cache, get_memcached_requests() - memcached_requests_start,
(cache, get_remote_cache_requests() - remote_cache_requests_start,
round(get_remote_cache_time() - remote_cache_time_start, 2)))

View File

@@ -5,7 +5,7 @@ from zerver.lib.response import json_error
from django.db import connection
from zerver.lib.utils import statsd
from zerver.lib.queue import queue_json_publish
from zerver.lib.cache import get_remote_cache_time, get_memcached_requests
from zerver.lib.cache import get_remote_cache_time, get_remote_cache_requests
from zerver.lib.bugdown import get_bugdown_time, get_bugdown_requests
from zerver.models import flush_per_request_caches
from zerver.exceptions import RateLimited
@@ -24,7 +24,7 @@ logger = logging.getLogger('zulip.requests')
def record_request_stop_data(log_data):
log_data['time_stopped'] = time.time()
log_data['remote_cache_time_stopped'] = get_remote_cache_time()
log_data['memcached_requests_stopped'] = get_memcached_requests()
log_data['remote_cache_requests_stopped'] = get_remote_cache_requests()
log_data['bugdown_time_stopped'] = get_bugdown_time()
log_data['bugdown_requests_stopped'] = get_bugdown_requests()
if settings.PROFILE_ALL_REQUESTS:
@@ -38,7 +38,7 @@ def record_request_restart_data(log_data):
log_data["prof"].enable()
log_data['time_restarted'] = time.time()
log_data['remote_cache_time_restarted'] = get_remote_cache_time()
log_data['memcached_requests_restarted'] = get_memcached_requests()
log_data['remote_cache_requests_restarted'] = get_remote_cache_requests()
log_data['bugdown_time_restarted'] = get_bugdown_time()
log_data['bugdown_requests_restarted'] = get_bugdown_requests()
@@ -56,7 +56,7 @@ def record_request_start_data(log_data):
log_data['time_started'] = time.time()
log_data['remote_cache_time_start'] = get_remote_cache_time()
log_data['memcached_requests_start'] = get_memcached_requests()
log_data['remote_cache_requests_start'] = get_remote_cache_requests()
log_data['bugdown_time_start'] = get_bugdown_time()
log_data['bugdown_requests_start'] = get_bugdown_requests()
@@ -118,13 +118,13 @@ def write_log_line(log_data, path, method, remote_ip, email, client_name,
memcached_output = ""
if 'remote_cache_time_start' in log_data:
remote_cache_time_delta = get_remote_cache_time() - log_data['remote_cache_time_start']
memcached_count_delta = get_memcached_requests() - log_data['memcached_requests_start']
if 'memcached_requests_stopped' in log_data:
memcached_count_delta = get_remote_cache_requests() - log_data['remote_cache_requests_start']
if 'remote_cache_requests_stopped' in log_data:
# (now - restarted) + (stopped - start) = (now - start) + (stopped - restarted)
remote_cache_time_delta += (log_data['remote_cache_time_stopped'] -
log_data['remote_cache_time_restarted'])
memcached_count_delta += (log_data['memcached_requests_stopped'] -
log_data['memcached_requests_restarted'])
memcached_count_delta += (log_data['remote_cache_requests_stopped'] -
log_data['remote_cache_requests_restarted'])
if (remote_cache_time_delta > 0.005):
memcached_output = " (mem: %s/%s)" % (format_timedelta(remote_cache_time_delta),