应用程序与数据库常驻连接池

问题描述:

情况: 我需要在使用python连接到Oracle数据库时使用连接池.多个python应用程序将使用我开发的帮助程序连接库.

Situation: I have a requirement to use connection pooling while connecting to Oracle database in python. Multiple python applications would use the helper connection libraries I develop.

我的思考过程: 在这里,我可以想到两种连接池方式: 1)让连接池由数据库本身(由Oracle DRCP提供)来维护和管理,而调用模块只是询问来自Oracle DRCP描述的连接代理的连接.

My Thought Process: Here I can think of two ways of connection pooling: 1) Let connection pool be maintained and managed by database itself (as provided by Oracle's DRCP) and calling modules just ask connections from the connection broker described by Oracle DRCP.

2)拥有一个管理连接池的服务器进程,并且所有调用方模块都从该池中请求连接(例如dbcp?)

2) Have a server process that manages the connection pool and all caller modules ask for connections from this pool (like dbcp?)

我需要什么建议: 选项1)看起来非常简单,因为池不需要由应用程序存储. 但是我想知道除了使用选项1)的简单性之外,我还能获得什么好处? 我试图避免选择2),因为它将要求始终运行一个专用的服务器进程(考虑到连接对象无法搁置). 还有其他办法吗?

What suggestions do I need: option 1) looks very straight forward since pool does not need to be stored by application. But I wanted to know what advantages do I get other than simplicity using option 1)? I am trying to avoid option 2) since it would require a dedicated server process always running (considering shelving is not possible for connection objects). Is there any other way?

让数据库处理池. . .它比您现在要聪明,并且您将利用Oracle的所有已安装基础提供的每个错误修复/性能改进.

Let the database handle the pool. . . it's smarter than you'll be, and you'll leverage every bug fix/performance improvement Oracle's installed base comes up with.