Version 1 (modified by mrts, 17 years ago) ( diff )

--

Part of DjangoSpecifications

Threading improvements in Django

According to tickets #5632, #6950 and discussions http://groups.google.com/group/django-users/browse_frm/thread/a7d42475b66530bd, http://groups.google.com/group/django-developers/browse_thread/thread/fbcfa88c997d1bb3, at least the following components of Django are not entirely thread-safe:

  • django.template.loader
  • django.db.models
  • django.contrib.sessions

This specification outlines the changes that need to be implemented to solve these issues.

A related task is to identify other components not mentioned here that have threading issues.

Proposal

Instead of ad-hoc solutions like the one proposed in #5632, there should be a locking module that can be reused.

Four types of locking primitives could be implemented:

  • Django-wide global locks
  • module-level locks
  • class-level locks
  • function-level locks

I don't see any use for a Django-wide lock. Module-level lock is needed for sessions. Class-level locks seem appropriate for models. Template loader could use either a function-level lock or a module-level lock.

Note: See TracWiki for help on using the wiki.
Back to Top