From user-return-7752-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Wed Nov 25 19:56:10 2009 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 14148 invoked from network); 25 Nov 2009 19:56:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 25 Nov 2009 19:56:10 -0000 Received: (qmail 58656 invoked by uid 500); 25 Nov 2009 19:56:09 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 58564 invoked by uid 500); 25 Nov 2009 19:56:09 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 58554 invoked by uid 99); 25 Nov 2009 19:56:09 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Nov 2009 19:56:09 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of adam.kocoloski@gmail.com designates 72.14.220.152 as permitted sender) Received: from [72.14.220.152] (HELO fg-out-1718.google.com) (72.14.220.152) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Nov 2009 19:56:00 +0000 Received: by fg-out-1718.google.com with SMTP id 22so1851772fge.5 for ; Wed, 25 Nov 2009 11:55:39 -0800 (PST) Received: by 10.87.68.28 with SMTP id v28mr7128288fgk.38.1259178939466; Wed, 25 Nov 2009 11:55:39 -0800 (PST) Received: from dhcp-18-111-28-178.dyn.mit.edu (dhcp-18-111-28-178.dyn.mit.edu [18.111.28.178]) by mx.google.com with ESMTPS id e11sm448609fga.9.2009.11.25.11.55.37 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 25 Nov 2009 11:55:38 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1077) Subject: Re: all_dbs_active - what should an app do when it gets this? From: Adam Kocoloski In-Reply-To: Date: Wed, 25 Nov 2009 14:55:35 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: <296DB3B0-24B1-487A-8DD7-3ED8FF317C04@apache.org> References: <45ae90370911231435p64486788v6248a03c0d3aac8e@mail.gmail.com> <404484DB-9778-4E45-89AB-7765B640C6A7@apache.org> <45ae90370911231726w6f3fa36ele27fe6b4bbb1b19b@mail.gmail.com> <45ae90370911251002l5d24c346ia61d69c8562c1c6c@mail.gmail.com> To: user@couchdb.apache.org X-Mailer: Apple Mail (2.1077) X-Virus-Checked: Checked by ClamAV on apache.org On Nov 25, 2009, at 2:23 PM, Paul Davis wrote: >> #!/usr/bin/perl >>=20 >> use FindBin qw($Bin); >> use lib ("$Bin/lib","$Bin/cpan-lib"); >>=20 >> use Net::CouchDB; >>=20 >> my $host=3Dshift; >> my $secs=3Dshift; >>=20 >> my $couch=3DNet::CouchDB->new($host); >>=20 >> my @docs=3Dmap{ { '_id' =3D> $_, 'lang' =3D> 'erlang' } } (1...500); >>=20 >> foreach (1...200) { >> my $dbh=3D$couch->create_db("event-$_"); >> print "Created database $_\n"; >> $dbh->insert(@docs); >> sleep($secs); >> } >=20 > 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. >=20 > 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