You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Arun Tewatia <ar...@orkash.com> on 2011/04/18 08:19:17 UTC

UIMA-AS CAS consumers of different Clients using same connection to Database

Hi all,
I am using UIMA-AS 2.3.0 release. I run an aggregate with 2 Cas 
consumers written in deployment descriptor.

The cas consumers output processed data in Postgres database server. I 
close the connection created with the database at the end in the cas 
consumers.

When i send request from 1 client, it works fine. The data is written to 
database and all connections with the database are released after 
completion. But when i send request from 2 or more clients 
simultaneously, then in that case, as the processing of 1st client 
completes, the processing of other clients halts immediately giving 
error " The Connection is closed ".

When i comment out the lines closing the connection at the end of cas 
consumers, it works fine. But then the connections to database are not 
released and hence the RAM utilization keeps on increasing until all of 
the available memory is consumed. So it looks like all the cas consumers 
of different client requests are using the same connections to database.

What can be possible cause of this ? I think each client should create 
it's own new connections to database !

Thanks
Arun Tewatia !

RE: UIMA-AS CAS consumers of different Clients using same connection to Database

Posted by Ashutosh Sharma <as...@hotmail.com>.
Hi,

I agree with JC, your application is meant to put data into the database not to create connections. This is recommended that you should use same connection. Connection always sharable. Just control the creation of connection on different clients. 

Cheers...
Ashu


> Date: Mon, 18 Apr 2011 09:24:00 -0400
> Subject: Re: UIMA-AS CAS consumers of different Clients using same connection to Database
> From: uimaee@gmail.com
> To: user@uima.apache.org
> 
> It appears that your database connection is static, meaning it seems to be
> shared by the two Cas Consumer threads.
> This seems like the right thing to do. Database connections are typically
> heavy and expensive to create. If this is appropriate for your application,
> keep one connection open and reuse it. I dont understand why you need to
> create a new connection to the same database ( I am assuming this) and than
> close it when you done processing request. Just to do this again for a
> subsequent request.
> 
> JC
> 
> On Mon, Apr 18, 2011 at 2:19 AM, Arun Tewatia <ar...@orkash.com>wrote:
> 
> > Hi all,
> > I am using UIMA-AS 2.3.0 release. I run an aggregate with 2 Cas consumers
> > written in deployment descriptor.
> >
> > The cas consumers output processed data in Postgres database server. I
> > close the connection created with the database at the end in the cas
> > consumers.
> >
> > When i send request from 1 client, it works fine. The data is written to
> > database and all connections with the database are released after
> > completion. But when i send request from 2 or more clients simultaneously,
> > then in that case, as the processing of 1st client completes, the processing
> > of other clients halts immediately giving error " The Connection is closed
> > ".
> >
> > When i comment out the lines closing the connection at the end of cas
> > consumers, it works fine. But then the connections to database are not
> > released and hence the RAM utilization keeps on increasing until all of the
> > available memory is consumed. So it looks like all the cas consumers of
> > different client requests are using the same connections to database.
> >
> > What can be possible cause of this ? I think each client should create it's
> > own new connections to database !
> >
> > Thanks
> > Arun Tewatia !
> >
 		 	   		  

Re: UIMA-AS CAS consumers of different Clients using same connection to Database

Posted by Jaroslaw Cwiklik <ui...@gmail.com>.
It appears that your database connection is static, meaning it seems to be
shared by the two Cas Consumer threads.
This seems like the right thing to do. Database connections are typically
heavy and expensive to create. If this is appropriate for your application,
keep one connection open and reuse it. I dont understand why you need to
create a new connection to the same database ( I am assuming this) and than
close it when you done processing request. Just to do this again for a
subsequent request.

JC

On Mon, Apr 18, 2011 at 2:19 AM, Arun Tewatia <ar...@orkash.com>wrote:

> Hi all,
> I am using UIMA-AS 2.3.0 release. I run an aggregate with 2 Cas consumers
> written in deployment descriptor.
>
> The cas consumers output processed data in Postgres database server. I
> close the connection created with the database at the end in the cas
> consumers.
>
> When i send request from 1 client, it works fine. The data is written to
> database and all connections with the database are released after
> completion. But when i send request from 2 or more clients simultaneously,
> then in that case, as the processing of 1st client completes, the processing
> of other clients halts immediately giving error " The Connection is closed
> ".
>
> When i comment out the lines closing the connection at the end of cas
> consumers, it works fine. But then the connections to database are not
> released and hence the RAM utilization keeps on increasing until all of the
> available memory is consumed. So it looks like all the cas consumers of
> different client requests are using the same connections to database.
>
> What can be possible cause of this ? I think each client should create it's
> own new connections to database !
>
> Thanks
> Arun Tewatia !
>