You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Ruy Díaz Jara <di...@gmail.com> on 2008/12/18 19:51:54 UTC

Connection reset

Hi,

I've recently been working on getting my application to use a connection
pool to connect to Couch and improve performance by reusing the connections
and avoiding the socket opening/closing cost. Everything seems nice and
dandy except when I create a new database. Apparently every time I create a
DB, the socket is closed by Couch. Does anyone know if this expected
behaviour and if so what the rationale behind it is?

With all other operations this does not occur. It's not even the PUT action
(I can put documents in the DB repeatedly reusing the socket). It seems to
be only when DBs are created.

Thanks
Ruy

Re: Connection reset

Posted by Ruy Díaz Jara <di...@gmail.com>.
I'm using Ruby for my app and using Sequel gem for the DB access. For
CouchDB however, I'm just using the Sequel::ConnectionPool class to take
care of the pooling. I create an instance of ConnectionPool and then set the
connection_proc attribute to a proc that instantiates my HTTP client with
the open socket.

require 'sequel'
connection_pool = Sequel::ConnectionPool.new( :max_connections=>10 )
connection_pool = proc {
  Net::HTTP.start( host, port )
}

connection_pool.hold{ |http|
     http.send_request( 'PUT', '/foo/a', "name='bob'", { "content-type" =>
'application/json' })
}


Hope this helps.
Ruy


On Thu, Dec 18, 2008 at 11:04 AM, paul jobs <we...@gmail.com> wrote:

> can you share how to use pools or DButils pool with couchdb
> thanks
>
> On Thu, Dec 18, 2008 at 10:51 AM, Ruy Díaz Jara <di...@gmail.com> wrote:
>
> > Hi,
> >
> > I've recently been working on getting my application to use a connection
> > pool to connect to Couch and improve performance by reusing the
> connections
> > and avoiding the socket opening/closing cost. Everything seems nice and
> > dandy except when I create a new database. Apparently every time I create
> a
> > DB, the socket is closed by Couch. Does anyone know if this expected
> > behaviour and if so what the rationale behind it is?
> >
> > With all other operations this does not occur. It's not even the PUT
> action
> > (I can put documents in the DB repeatedly reusing the socket). It seems
> to
> > be only when DBs are created.
> >
> > Thanks
> > Ruy
> >
>

Re: Connection reset

Posted by paul jobs <we...@gmail.com>.
can you share how to use pools or DButils pool with couchdb
thanks

On Thu, Dec 18, 2008 at 10:51 AM, Ruy Díaz Jara <di...@gmail.com> wrote:

> Hi,
>
> I've recently been working on getting my application to use a connection
> pool to connect to Couch and improve performance by reusing the connections
> and avoiding the socket opening/closing cost. Everything seems nice and
> dandy except when I create a new database. Apparently every time I create a
> DB, the socket is closed by Couch. Does anyone know if this expected
> behaviour and if so what the rationale behind it is?
>
> With all other operations this does not occur. It's not even the PUT action
> (I can put documents in the DB repeatedly reusing the socket). It seems to
> be only when DBs are created.
>
> Thanks
> Ruy
>

Re: Connection reset

Posted by Ruy Díaz Jara <di...@gmail.com>.
Hmmm.... intresting. I tried it with two different Ruby libraries (Net::HTTP
and RFuzz) with the exact same behaviour. I'll try to see if there's
something else I'm missing.

On Fri, Dec 19, 2008 at 12:13 PM, Adam Kocoloski
<ad...@gmail.com>wrote:

> Hi Ruy, I tried to reproduce this using Python's httplib2 client library,
> but I find that I can create new databases without CouchDB closing the
> connection on me.  I just double-checked that the same ephemeral port was
> used for the whole sequence of requests.  I did this using a server running
> R12B-5 and the latest CouchDB trunk on localhost.  Best,
>
> Adam
>
>
> On Dec 19, 2008, at 1:48 PM, Ruy Díaz Jara wrote:
>
>  Hi,
>>
>> I recently posted this question on the user mailing list but I'm thinking
>> maybe that wasn't the right place to do it (as I have gotten no answer).
>> If
>> it is, I apologize for moving it here.
>>
>> Ruy
>>
>> ---------- Forwarded message ----------
>> From: Ruy Díaz Jara <di...@gmail.com>
>> Date: Thu, Dec 18, 2008 at 10:51 AM
>> Subject: Connection reset
>> To: user@couchdb.apache.org
>>
>>
>> Hi,
>>
>> I've recently been working on getting my application to use a connection
>> pool to connect to Couch and improve performance by reusing the
>> connections
>> and avoiding the socket opening/closing cost. Everything seems nice and
>> dandy except when I create a new database. Apparently every time I create
>> a
>> DB, the socket is closed by Couch. Does anyone know if this expected
>> behaviour and if so what the rationale behind it is?
>>
>> With all other operations this does not occur. It's not even the PUT
>> action
>> (I can put documents in the DB repeatedly reusing the socket). It seems to
>> be only when DBs are created.
>>
>> Thanks
>> Ruy
>>
>
>

Re: Connection reset

Posted by Adam Kocoloski <ad...@gmail.com>.
Hi Ruy, I tried to reproduce this using Python's httplib2 client  
library, but I find that I can create new databases without CouchDB  
closing the connection on me.  I just double-checked that the same  
ephemeral port was used for the whole sequence of requests.  I did  
this using a server running R12B-5 and the latest CouchDB trunk on  
localhost.  Best,

Adam

On Dec 19, 2008, at 1:48 PM, Ruy Díaz Jara wrote:

> Hi,
>
> I recently posted this question on the user mailing list but I'm  
> thinking
> maybe that wasn't the right place to do it (as I have gotten no  
> answer). If
> it is, I apologize for moving it here.
>
> Ruy
>
> ---------- Forwarded message ----------
> From: Ruy Díaz Jara <di...@gmail.com>
> Date: Thu, Dec 18, 2008 at 10:51 AM
> Subject: Connection reset
> To: user@couchdb.apache.org
>
>
> Hi,
>
> I've recently been working on getting my application to use a  
> connection
> pool to connect to Couch and improve performance by reusing the  
> connections
> and avoiding the socket opening/closing cost. Everything seems nice  
> and
> dandy except when I create a new database. Apparently every time I  
> create a
> DB, the socket is closed by Couch. Does anyone know if this expected
> behaviour and if so what the rationale behind it is?
>
> With all other operations this does not occur. It's not even the PUT  
> action
> (I can put documents in the DB repeatedly reusing the socket). It  
> seems to
> be only when DBs are created.
>
> Thanks
> Ruy


Connection reset

Posted by Ruy Díaz Jara <di...@gmail.com>.
Hi,

I recently posted this question on the user mailing list but I'm thinking
maybe that wasn't the right place to do it (as I have gotten no answer). If
it is, I apologize for moving it here.

Ruy

---------- Forwarded message ----------
From: Ruy Díaz Jara <di...@gmail.com>
Date: Thu, Dec 18, 2008 at 10:51 AM
Subject: Connection reset
To: user@couchdb.apache.org


Hi,

I've recently been working on getting my application to use a connection
pool to connect to Couch and improve performance by reusing the connections
and avoiding the socket opening/closing cost. Everything seems nice and
dandy except when I create a new database. Apparently every time I create a
DB, the socket is closed by Couch. Does anyone know if this expected
behaviour and if so what the rationale behind it is?

With all other operations this does not occur. It's not even the PUT action
(I can put documents in the DB repeatedly reusing the socket). It seems to
be only when DBs are created.

Thanks
Ruy