Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection Pooling in Ora driver ? #50

Closed
jmptrader opened this issue Oct 29, 2015 · 4 comments
Closed

Connection Pooling in Ora driver ? #50

jmptrader opened this issue Oct 29, 2015 · 4 comments

Comments

@jmptrader
Copy link

Please considered in your roadmap the support of Connection Pooling in Ora driver.

The "database/sql" works but in real cases for applications 7x24, I have random behavior for keep connections alive.

I refer to Oracle Connection Pooling done by OCI.

Thank's,
JM

(from Oracle Call Interface Programmer's Guide)
Connection pools

Connection pooling is the use of a group (the pool) of reusable physical connections by several sessions, in order to balance loads. The management of the pool is done by OCI, not the application. Applications that can use connection pooling include middle-tier applications for Web application servers and e-mail servers.

Session Pools

Session pooling means that the application will create and maintain a group of stateless sessions to the database. These sessions will be handed over to thin clients as requested. If no sessions are available, a new one may be created. When the client is done with the session, the client will release it to the pool. Thus, the number of sessions in the pool can increase dynamically.

@jmptrader jmptrader changed the title Connection Poolling in Ora driver ? Connection Pooling in Ora driver ? Oct 29, 2015
@rana
Copy link
Owner

rana commented Oct 30, 2015

Hi JM,

Will consider it. I did look into OCI connection pooling when initially designing the driver but considered too much effort for a first version for a feature which might not be used and already has support in database/sql. It's not clear to me how many people use database/sql only or use the direct driver only.

What sort of behavior are you seeing with Oracle connections and database/sql?

Aside from database/sql, my understanding is that Oracle will itself close connections within a connection pool after a period of inactivity.

Thank you,

Rana

@tgulacsi
Copy link
Collaborator

tgulacsi commented Nov 9, 2015

Session pooling is nice, but I couldn't make it work with our external authentication (Oracle Wallet) in cx_Oracle.

Also, expermients shows that to use n processors, you have to use n separate Srvs.

But against frequent session reopening, some pooling should be used. A general IdlePool is at github.com/tgulacsi/go/pool, and a WIP connection (Srv/Ses) pool is in the "pool" branch here.

@jmptrader
Copy link
Author

It's cool. Thank's.

tgulacsi added a commit that referenced this issue Dec 3, 2015
Alleviates #50.

commit d33219c
Author: Tamás Gulácsi <tgulacsi78@gmail.com>
Date:   Mon Nov 9 07:52:42 2015 +0100

    wip
@tgulacsi
Copy link
Collaborator

I've split the pooling into Env.NewSrvPool + Srv.NewSesPool, as I couldn't make the srv+ses pooling leak free: you can open any number of sessions on a connection, but can only close/release that connection back to its pool when all sessions are closed on it. And closed, not just released to the pool...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants