incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Kocoloski <kocol...@apache.org>
Subject Re: all_dbs_active - what should an app do when it gets this?
Date Wed, 25 Nov 2009 19:55:35 GMT
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


Mime
View raw message