Comment (by skyl):
I have what may be a more simple approach to the problem. I branched off
of the current django master on github. I can easily remove the extraneous
flake8 changes and squash into one commit for a pull request:
https://github.com/skyl/django/compare/7732-oracle-sessionpool
It appears that the tests will pass against Oracle (takes forever).
However, I'm not that familiar with the ins and outs of how database
backends work. If someone could look at my patch and let me know if there
is something obvious I've missed, I would appreciate it. On a simple test
webapp, I'm experiencing a significant speedup with the patch.
--
Ticket URL: <https://code.djangoproject.com/ticket/7732#comment:13>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by akaariai):
It seems that allowing the use of the cx_Oracle inbuilt pooler is a good
idea.
As for the implementation: is the use of class level pool variable really
safe? It seems the pool instance is connection settings dependent, so
having just one pool per project seems suspicious.
Also, the close() implementation should probably do a rollback before
releasing the connection back to the pool.
--
Ticket URL: <https://code.djangoproject.com/ticket/7732#comment:14>
Comment (by skyl):
I changed to 1 pool per alias; 1 pool per project was definitely wrong. I
also changed to doing a `self.connection.rollback()` in `close` before
releasing the connection.
--
Ticket URL: <https://code.djangoproject.com/ticket/7732#comment:15>
Comment (by erny):
I had the following problems in the past: The Oracle pools is a "per
process" pool. Each Python Process gets its own pool. Supposing X
processes (apache prefork, wsgi, etc.) with each Y min connections we get
X * Y connections. So keep your min connections count low. With Oracle 11,
there seems to be a server side session pool which should be much more
convenient, but I didn't test it.
--
Ticket URL: <https://code.djangoproject.com/ticket/7732#comment:16>
Comment (by skyl):
Unfortunately, I think there needs to be some error-checking on the
connection after it is acquired from the pool. After some hours (I didn't
configure the instance I'm running against so I'm not sure how long), I
get `ORA-02399: exceeded maximum connect time, you are being logged off`;
then, the pool continues to try to get the same connection, failing every
time with, `ORA-01012: not logged on`. I think there are 2 options then.
1) put a `CONN_MAX_AGE` parameter in the `SESSION_POOL` settings dict
and drop the connection if it is close enough to that age
2) ping the connection after it is acquired and drop it if it is not
usable
(1) Age is not an attribute of the connection that I can see; so, it would
be ugly to do our own book-keeping on the age of the connections in the
pools we are holding. This does not cover other possible error scenarios.
(2) This would be a hit to performance every time a connection is
acquired.
I think (2) would be easy enough to add. Other suggestions?
--
Ticket URL: <https://code.djangoproject.com/ticket/7732#comment:17>
Comment (by thedrow):
Since I believe that adding pooled backends was rejected from Django
shouldn't this issue be closed?
--
Ticket URL: <https://code.djangoproject.com/ticket/7732#comment:18>
* status: assigned => new
* owner: Matt Boersma => (none)
--
Ticket URL: <https://code.djangoproject.com/ticket/7732#comment:19>
* cc: Dan Davis (added)
Comment:
I'm interested in this. I'm not quite on the point of assigning it, but
one of my developers asked me see to return to what is needed to use
Oracle DRCP. I tested it using django-oraclepool many years ago to
determine whether there was any performance difference, from the client-
side, between CONN_MAX_AGE and this feature. django-oraclepool is so
old, that it seems I'd either need to fork it or return to this issue.
--
Ticket URL: <https://code.djangoproject.com/ticket/7732#comment:20>
* cc: Christopher Jones, Suraj Shaw (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/7732#comment:21>
* owner: (none) => Suraj Shaw
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/7732#comment:22>
* Attachment "Session Pool Backend in Django For Oracle (1).docx" added.
Design specification
--
Ticket URL: <https://code.djangoproject.com/ticket/7732>
Comment (by Suraj Shaw):
[https://github.com/django/django/pull/17743 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/7732#comment:23>
* needs_docs: 1 => 0
* has_patch: 1 => 0
* needs_tests: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/7732#comment:24>
* needs_better_patch: 1 => 0
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/7732#comment:25>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/7732#comment:26>