Django

Code

Ticket #7732 (assigned)

Opened 2 years ago

Last modified 2 weeks ago

Oracle Backend with SessionPool

Reported by: halturin Assigned to: mboersma (accepted)
Milestone: 1.2 Component: Database layer (models, ORM)
Version: SVN Keywords: yandex-sprint oracle session pool
Cc: halturin@gmail.com, nleschev@gmail.com, ikelly, mboersma, dbergstr@juniper.net, erny@yaco.es Triage Stage: Accepted
Has patch: 1 Needs documentation: 1
Needs tests: 1 Patch needs improvement: 1

Description

This new backend uses Oracle session pool to improve database performance in threaded environment. Overall speedup for large amounts of small queries is 2-3 times.

Attachments

oracle_pool.tar.gz (10.4 kB) - added by halturin on 07/12/08 09:31:51.
Tarball with oracle_pool db backend
oracle_pool.diff (4.3 kB) - added by jbronn on 07/16/08 10:50:01.
Oracle pooling patch derived from tarball.
oracle_pool.2.diff (4.1 kB) - added by ikelly on 07/21/08 11:58:48.
Modified patch with print statements removed
oracle_pool.3.diff (4.7 kB) - added by nleschev on 07/24/08 06:48:24.
oracle_pool.4.diff (7.3 kB) - added by dbergstr@juniper.net on 04/16/09 17:45:17.
Patch against revision 10578 (1.1beta). Use settings.DATABASE_OPTIONS, general code cleanup.
oracle_pool.5.diff (7.4 kB) - added by mboersma on 05/20/09 12:26:28.
Modified patch against trunk [10832] that passes the Django test suite
oracle_pool.6.diff (3.9 kB) - added by erny on 06/04/09 05:52:01.
Oracle Pool for 1.0.X branch

Change History

07/12/08 09:31:51 changed by halturin

  • attachment oracle_pool.tar.gz added.

Tarball with oracle_pool db backend

07/13/08 05:43:18 changed by serialx

  • needs_better_patch set to 1.
  • needs_docs set to 1.
  • stage changed from Unreviewed to Design decision needed.
  • needs_tests changed.
  • milestone set to post-1.0.

Can you modify the files to conform with Django Patch Style?

And I think adding a new backend needs design decision. By patching the existing oracle backend and making pooling an option seems to be better. Making milestone post-1.0 since modifying or adding feature to the current backend is currently out of scope of 1.0 release.

07/16/08 10:50:01 changed by jbronn

  • attachment oracle_pool.diff added.

Oracle pooling patch derived from tarball.

07/21/08 11:58:48 changed by ikelly

  • attachment oracle_pool.2.diff added.

Modified patch with print statements removed

07/21/08 12:08:25 changed by ikelly

I'm trying to run this through the test suite, and I'm seeing lots of non-deterministic test failures. When I try to run the full test suite, I get an early error where it's setting up the test database and apparently trying to reset a sequence that doesn't exist. When I try to run just the basic test, the test runs, but lots of queries return dramatically incorrect results. It's not obvious where this is coming from, but it needs to be addressed before this can be committed.

07/24/08 06:48:05 changed by nleschev

  • cc set to halturin@gmail.com, nleschev@gmail.com.

We have included all changes in this patch(oracle_pool.3.diff). Also has been added 4 settings.
DATABASE_SESSION_POOL=[True/False]
DATABASE_SESSION_POOL_MIN=1
DATABASE_SESSION_POOL_MAX=3
DATABASE_SESSION_POOL_INCREMENT=1

07/24/08 06:48:24 changed by nleschev

  • attachment oracle_pool.3.diff added.

09/02/08 15:16:06 changed by ikelly

  • cc changed from halturin@gmail.com, nleschev@gmail.com to halturin@gmail.com, nleschev@gmail.com, ikelly.

01/18/09 11:47:31 changed by mboersma

  • cc changed from halturin@gmail.com, nleschev@gmail.com, ikelly to halturin@gmail.com, nleschev@gmail.com, ikelly, mboersma.

01/18/09 11:56:42 changed by mboersma

  • keywords changed from yandex-sprint to yandex-sprint oracle session pool.

02/25/09 13:51:44 changed by

  • milestone deleted.

Milestone post-1.0 deleted

04/16/09 17:45:17 changed by dbergstr@juniper.net

  • attachment oracle_pool.4.diff added.

Patch against revision 10578 (1.1beta). Use settings.DATABASE_OPTIONS, general code cleanup.

04/16/09 17:48:18 changed by anonymous

  • cc changed from halturin@gmail.com, nleschev@gmail.com, ikelly, mboersma to halturin@gmail.com, nleschev@gmail.com, ikelly, mboersma, dbergstr@juniper.net.

05/12/09 10:44:02 changed by mboersma

  • owner changed from nobody to mboersma.
  • status changed from new to assigned.
  • stage changed from Design decision needed to Accepted.
  • needs_tests set to 1.
  • milestone set to 1.2.

I'm still not able to get cx_Oracle's SessionPool? to behave correctly for the entire Django test suite. I've tried the 4/16/09 patch here as well as my own implementations, but we quickly get test case failures that I've had a very hard time tracking down.

I have not given up--I think this should offer obvious speed improvements. I'm marking this as

05/12/09 10:44:56 changed by mboersma

...(continued) I'm marking this as needed for the next big release.

05/14/09 13:16:41 changed by dbergstr@juniper.net

I've never looked at the test suite, nor do I have a clue how cx_oracle manages connections and transactions, but perhaps problems arise because some of the tests don't do a commit? The connection would then go back into the pool with an open transaction, and when it was next pulled out of the pool, the state in that connection would be different from what is expected. In general, using any pooled resource can expose sloppy practices in the calling code (failure to properly initialize shared memory, db connection leaks, etc.).

05/20/09 12:26:28 changed by mboersma

  • attachment oracle_pool.5.diff added.

Modified patch against trunk [10832] that passes the Django test suite

05/27/09 17:12:18 changed by erny

  • cc changed from halturin@gmail.com, nleschev@gmail.com, ikelly, mboersma, dbergstr@juniper.net to halturin@gmail.com, nleschev@gmail.com, ikelly, mboersma, dbergstr@juniper.net, erny@yaco.es.

05/27/09 17:17:22 changed by erny

Can we have a bit of feedback about if the patch is supposed to work correctly now and it's effectivity?

05/27/09 17:35:42 changed by ikelly

The patch works as far as we've seen. The issues that were arising in the test suite had to do with the test setup attempting to disconnect, change the connection parameters, and reconnect, which failed because of the pool. For the same reason, I suspect it will take some work to make this compatible with the multidb branch, but otherwise it's usable.

06/04/09 05:50:05 changed by erny

The patch didn't work for me for 1.0.X branch rev10865. I attach al alternative patch for this version.

06/04/09 05:52:01 changed by erny

  • attachment oracle_pool.6.diff added.

Oracle Pool for 1.0.X branch

06/04/09 06:34:29 changed by erny

I found that the used SessionPools? getmode parameter may no match everybody's requirements. This should be a parameter. Would be great if this really was a parameter of p.acquire()

06/18/09 06:12:36 changed by erny

Bad news: I get DatabaseError: ORA-03135: connection lost contact with cx_Oracle 4.4.1 which does not drop/release/reconnect the connections. After the all connections are acquired, I get: ORA-24418: Cannot open further sessions. As it's author in the cx_Oracle mailing list suggest, a pool.drop(connection) is not enough, as it raises another exception. The complete pool may be replaced.

01/28/10 10:00:44 changed by edcrewe

I have packaged up a version of this pooling backend, and made it available on pypi

see http://pypi.python.org/pypi/django-oraclepool

This includes some tests, and other extra little bits. It has also been tested against 1.1 and 1.2

- Ed Crewe


Add/Change #7732 (Oracle Backend with SessionPool)




Change Properties
Action