#27641: Default CACHES uses Locmem which isn't suitable for production
-------------------------------------+-------------------------------------
     Reporter:  Adam Chainz          |                    Owner:  Adam
         Type:                       |  Chainz
  Cleanup/optimization               |                   Status:  assigned
    Component:  Core (Cache system)  |                  Version:  1.10
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Aymeric Augustin):

 > The way Django uses caching is to assume there's a single cache for the
 whole application

 This is correct, hovewer, considering the contract of Django cache
 backends -- keys can be evicted arbitrarily -- I believe that in (most)
 (reasonable) cases the effect of separate workers using separate caches is
 lower performance (cache hits / N for N workers) and increased resource
 usage (memory * N for N workers). This is annoying but not always worth
 the effort of setting up or paying for a separate cache server. I have
 used the locmem cache successfully in production for modest optimizations
 such as template caching.

 I'd rather handle this in the documentation.

 One surprising and little know characteristic of the locmem cache backend
 is that it's bounded to 300 keys by default. Even for caching medium-size
 objects (let's say 8kB), that's quite low (limited to 2,4MB). I'm not sure
 the docs mention it sufficiently clearly. If we explain the downsides of
 using the locmem cache in production, it would be a good place to mention
 that this setting likely needs tuning.

--
Ticket URL: <https://code.djangoproject.com/ticket/27641#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.1bf57dac156a75902c3fdb1b624589e4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to