#35853: Disable garbage collection during transaction.atomic.
-------------------------------------+-------------------------------------
     Reporter:  Matej Spiller Muys   |                     Type:  New
                                     |  feature
       Status:  new                  |                Component:
                                     |  Uncategorized
      Version:  5.1                  |                 Severity:  Normal
     Keywords:  gc, atomic,          |             Triage Stage:
  transaction                        |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
 We noticed that occasionally atomic blocks are keeping transaction open
 for longer than expected.
 This was traced to GC being run during atomic operation affecting the DB
 performance since locks are released too late.

 We added tracing to GC and transactional.atomic() and we noticed that GC
 is keeping DB transaction longer from 0.5 to 1 second.

 To avoid that we extended atomic object to call gc.disable before creating
 new transaction and gc.enable after commit or rollback.
 This positively impacted database load. Because we use mod_wsgi with a lot
 of workers and horizontally scaling the app it happens quite often that GC
 is run inside a DB transaction making whole system slower.

 It would be nice to have this buildin in Django (opt-out, opt-in) for
 better DB performance.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35853>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070192af8bc559-fcfd32f5-d2e6-4b0a-857f-4952ae24f1cf-000000%40eu-central-1.amazonses.com.

Reply via email to