incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Davis <paul.joseph.da...@gmail.com>
Subject Re: all_dbs_active - what should an app do when it gets this?
Date Wed, 25 Nov 2009 20:01:31 GMT
On Wed, Nov 25, 2009 at 2:55 PM, Adam Kocoloski <kocolosk@apache.org> wrote:
> On Nov 25, 2009, at 2:23 PM, Paul Davis wrote:
>
>>> #!/usr/bin/perl
>>>
>>> use FindBin qw($Bin);
>>> use lib ("$Bin/lib","$Bin/cpan-lib");
>>>
>>> use Net::CouchDB;
>>>
>>> my $host=shift;
>>> my $secs=shift;
>>>
>>> my $couch=Net::CouchDB->new($host);
>>>
>>> my @docs=map{ { '_id' => $_, 'lang' => 'erlang' } } (1...500);
>>>
>>> foreach (1...200) {
>>>        my $dbh=$couch->create_db("event-$_");
>>>        print "Created database $_\n";
>>>        $dbh->insert(@docs);
>>>        sleep($secs);
>>> }
>>
>> IANAPM, but if $dbh is holding an open connection you could very well
>> trigger this quite easily. Can you try replacing the sleep($secs) with
>> something like $dbh->close()? Any easy way to check this is to watch
>> `netstat -tap tcp` and see if the number of sockets on either machine
>> is growing monotonically.
>>
>> HTH,
>> Paul Davis
>
> Paul, that was my first thought too, but isn't the DB only considered "active" for the
lifetime of a request?  E.g. it doesn't matter if the connections are kept open or not, once
couch_db:close(Db) is called the reference counter gets decremented and couch_server can drop
it from the LRU cache.  At least that's my reading of the code. Best,
>
> Adam
>
>

Adam,

You make a good point there. Put that way, I do believe that would be
the expected behavior. Though I don't know if we test that condition
explicitly anywhere. The JS tests are limited by browser connections,
and the ETAP tests haven't gotten into making HTTP requests to probe
that layer yet.

Paul

Mime
View raw message