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

 {{{
 CACHES = {
     'default': {
         'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
     }
 }
 }}}

 Django also enforces that you have a cache called 'default' defined:
 https://docs.djangoproject.com/en/1.10/ref/checks/#caches

 `LocMemCache` only works within a single process and thus is not suitable
 for even the smallest application deployments these days, which nearly
 always use multiple web worker processes under uWSGI/gunicorn. (For
 example, [https://github.com/unbit/uwsgi-
 docs/blob/master/tutorials/heroku_python.rst this uWSGI Heroku tutorial]
 has config for 4 processes).

 The way Django uses caching is to assume there's a single cache for the
 whole application which could lead code to break in unexpected ways in
 production.

 I'd like to suggest either:

 1. A deployment check that the cache used in production is not locmemcache
 2. The default cache backend used in `global_settings` be changed to
 `DummyCache`

 Since (2) is probably highly backwards incompatible, I think (1) is
 preferable.

--
Ticket URL: <https://code.djangoproject.com/ticket/27641>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/053.428c608e612073e1f8183751c0611d77%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to