Looking the django.db.backends.postgresql  source code, I saw that Django connection needs only one connection for all processes, because it uses cursors to execute sql queries. So, I develop a system that run 1000+ threads using only one connection by changing the base.py [1].

But, this solution generate a problem, apache handles each request with separeted fork processes, and so it starts one connection at database that is not more closed (remember, if I reimplement the DatabaseWrapper.close, one thread close the connection of everybody when it's done) and leave the connection opened

So I have 2 ways to solve it:
1 - Rewrite the DatabaseWrapper.close to check if the app is been called from an apache instance or from shell
2 - Implement some function that when the request is created by apache, it gets the connection from a miracle mod_python/apache/somewhere variable and doesn't close it when it's done

[1] - http://pastebin.com/808647

--
SDM Underlinux
Garimpar.com
--
PEP-8
Só existem 3 tipos de pessoas no mundo, as que sabem contar, e as que não sabem.
CPFL - Compania Piratininga de FALTA de Luz (6 vezes em 5 dias!!)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to