#23462: Django 1.7 openning one database connection for each request
-------------------------------------+-------------------------------------
     Reporter:  upmauro              |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  1.7
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:
     Keywords:  mysql                |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by upmauro):

 Replying to [comment:1 aaugustin]:
 > This might be related to my changes to connection management in Django
 1.6.
 >
 > However, I need more information to confirm.
 >
 > 1) Does your application hit the database for every request?

 '''Yes, because in header of my system i have one function used for check
 versions, and another informations in database.'''

 >
 > 2) How many Django processes / threads do you run?

 '''I use wsgi + apache2 with default configs.'''

 >
 > 3) How many connections does your database server accept?

 '''Now, i changed my config file my.cnf for allow 1500 connections,
 because my enviroment is down. But for me, is normal about 300 maximum.'''


 Another details:

 I'm trying debug core form django, and I see something, in
 django/db/backends/__init__.py i put "print", to check about close.

 {{{
 #!div style="font-size: 80%"
 Code highlighting:
   {{{#!python
     def close(self):
         """
         Closes the connection to the database.
         """
         print('1')
         self.validate_thread_sharing()
         # Don't call validate_no_atomic_block() to avoid making it
 difficult
         # to get rid of a connection in an invalid state. The next
 connect()
         # will reset the transaction state anyway.

         if self.closed_in_transaction or self.connection is None:
             print('2')
             return
         try:
             self._close()
         finally:
             print('3')
             if self.in_atomic_block:
                 print('4')
                 self.closed_in_transaction = True
                 self.needs_rollback = True
             else:
                 print('5')
                 self.connection = None
         self.set_clean()

   }}}
 }}}

 The aplication print, 1,3,5. Is that right?

--
Ticket URL: <https://code.djangoproject.com/ticket/23462#comment:2>
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/065.a3aa1d69fe3c17ad98cd6511a76a23d3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to