incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Damien Katz <dam...@apache.org>
Subject Re: all_dbs_active - what should an app do when it gets this?
Date Wed, 25 Nov 2009 20:08:51 GMT
I think I know what's happening. With delayed commits each database  
waits ~1 sec before fully committing to disk. So each database is  
considered "open" until that commit happens. So this looks like normal  
behavior to me.

We could try to tell a database to fully commit when that happens,  
then close it, but it can take a long time to complete a fsync and a  
client could reopen the database in that time, etc. There are no  
perfect solutions here.

-Damien

On Nov 25, 2009, at 2:55 PM, Adam Kocoloski 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
>


Mime
View raw message