You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Alexander Uherek <au...@mackoy.de> on 2017/01/26 16:05:39 UTC

Using multiple Db connections to single Database

Hello,

I am using Cayenne 3.0.2 together with the play Framework (1.2.7).
I configured the framework to use a pool of 10 DB-connections, which according to pg_stats are opened and idle.
Unfortunatly only one connection is used for my Cayenne Queries.
Do you have any hints?


Alexander Uherek
IT-Services

mackoyCONSULTING
Schloss Seefeld | Hochschloss
82229 Seefeld
Tel.    +49 8152/92989-82
Fax    +49 8152/92989-89

auherek@mackoy.de
www.mackoy.de <http://www.mackoy.de/>

Re: Using multiple Db connections to single Database

Posted by John Huss <jo...@gmail.com>.
Are you creating a new ObjectContext for each request?  You should be.

On Thu, Jan 26, 2017 at 12:11 PM Alexander Uherek <au...@mackoy.de> wrote:

> Hello,
>
> I am using Cayenne 3.0.2 together with the play Framework (1.2.7).
> I configured the framework to use a pool of 10 DB-connections, which
> according to pg_stats are opened and idle.
> Unfortunatly only one connection is used for my Cayenne Queries.
> Do you have any hints?
>
>
> Alexander Uherek
> IT-Services
>
> mackoyCONSULTING
> Schloss Seefeld | Hochschloss
> 82229 Seefeld
> Tel.    +49 8152/92989-82 <+49%208152%209298982>
> Fax    +49 8152/92989-89 <+49%208152%209298989>
>
> auherek@mackoy.de
> www.mackoy.de <http://www.mackoy.de/>
>

Re: Using multiple Db connections to single Database

Posted by Michael Gentry <mg...@masslight.net>.
Hi Alexander,

I'm not sure which connection feature (DataSource Factory) you are using to
connect to the DB (Driver, JNDI, or DBCP), but all three of those use a
connection pooling mechanism.  When you ask an Object/Data Context to
perform a query or commit changes, it borrows a connection from the
connection pool, does some SQL, then returns the connection back to the
pool where it can be re-used later. If you don't have multiple simultaneous
query/commit changes occurring across multiple Object/Data Contexts, it
makes perfect sense to see one connection get used a lot (really depends on
the connection pooling mechanism, though) and the others to be idle.  This
is working as-designed.  If you starting doing more things in parallel,
you'll see more connections get used.

mrg



On Thu, Jan 26, 2017 at 11:05 AM, Alexander Uherek <au...@mackoy.de>
wrote:

> Hello,
>
> I am using Cayenne 3.0.2 together with the play Framework (1.2.7).
> I configured the framework to use a pool of 10 DB-connections, which
> according to pg_stats are opened and idle.
> Unfortunatly only one connection is used for my Cayenne Queries.
> Do you have any hints?
>
>
> Alexander Uherek
> IT-Services
>
> mackoyCONSULTING
> Schloss Seefeld | Hochschloss
> 82229 Seefeld
> Tel.    +49 8152/92989-82
> Fax    +49 8152/92989-89
>
> auherek@mackoy.de
> www.mackoy.de <http://www.mackoy.de/>
>