Esempio n. 1
0
def cache_stats(request):
    import resource
    from sefaria.utils.util import get_size
    from sefaria.model.user_profile import public_user_data_cache
    from sefaria.sheets import last_updated
    resp = {
        'ref_cache_size': model.Ref.cache_size(),
        # 'ref_cache_bytes': model.Ref.cache_size_bytes(), # This pretty expensive, not sure if it should run on prod.
        'public_user_data_size': len(public_user_data_cache),
        'public_user_data_bytes': get_size(public_user_data_cache),
        'sheets_last_updated_size': len(last_updated),
        'sheets_last_updated_bytes': get_size(last_updated),
        'memory usage': resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
    }
    return jsonResponse(resp)
Esempio n. 2
0
def cache_stats(request):
    import resource
    from sefaria.utils.util import get_size
    from sefaria.model.user_profile import public_user_data_cache
    from sefaria.sheets import last_updated
    resp = {
        'ref_cache_size': model.Ref.cache_size(),
        # 'ref_cache_bytes': model.Ref.cache_size_bytes(), # This pretty expensive, not sure if it should run on prod.
        'public_user_data_size': len(public_user_data_cache),
        'public_user_data_bytes': get_size(public_user_data_cache),
        'sheets_last_updated_size': len(last_updated),
        'sheets_last_updated_bytes': get_size(last_updated),
        'memory usage': resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
    }
    return jsonResponse(resp)