Skip to content

Django cacheops

Agate requested to merge django-cacheops into master

Added a caching package to help with expensive COUNT queries (cf #865 (closed)).

This is disabled by default, unless CACHEOPS_DURATION is set to a positive integer.

cc @funkwhale/reviewers-python

Performance impact

This use the same load test as in !939 (merged), but with cacheops enabled/disabled.

As you can see, enabling cacheops increase the number of handled requests, and reduce the median response time.

Cacheops disabled

 Name                                # reqs      # fails     Avg     Min     Max  |  Median   req/s
----------------------------------------------------------------------------------------------------
 GET /api/v1/albums?playable=True       125     0(0.00%)    4970     933   11216  |    4900    0.90
 GET /api/v1/artists?playable=True      132     0(0.00%)    3222     354    8002  |    3000    1.40
 GET /api/v1/tracks?playable=True       122     0(0.00%)    4374     655   11378  |    4100    1.50
----------------------------------------------------------------------------------------------------
 Total                                  379     0(0.00%)                                       3.80

Cacheops enabled

 Name                                # reqs      # fails     Avg     Min     Max  |  Median   req/s
----------------------------------------------------------------------------------------------------
 GET /api/v1/albums?playable=True       173     0(0.00%)    3080     664    6935  |    2900    1.70
 GET /api/v1/artists?playable=True      187     0(0.00%)    1503     283    4199  |    1400    1.30
 GET /api/v1/tracks?playable=True       195     0(0.00%)    2149     481    4929  |    2100    1.20
----------------------------------------------------------------------------------------------------
 Total                                  555     0(0.00%)                                       4.20
Edited by Agate

Merge request reports