You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Herman Chan <he...@gmail.com> on 2014/06/24 17:01:53 UTC

max_dbs_open and idle db

Hi there,

In the description of max_db_open, it says "CouchDB reference counts 
database accesses internally and will close idle databases when it 
must."  I was wondering what's consider idle in couchdb and if the idle 
time is configurable?

Herman

Re: max_dbs_open and idle db

Posted by Robert Samuel Newson <rn...@apache.org>.
Yes, it does. CouchDB will hold databases open up to the limit of max_dbs_open. If a request goes to a database not open, then the oldest db is closed to ensure that the total remains at or below the max_dbs_open setting. So, yes, CouchDB will keep 50,000 databases open at once with your setting, regardless of whether clients are making requests of them. If you want fewer databases open at once, lower max_dbs_open.

B.

On 25 Jun 2014, at 19:01, Herman Chan <he...@gmail.com> wrote:

> A follow up question.
> 
> We have around 90K+ databases on our server.  We used to set max_dbs_open to 100K, our server was reaching a pretty high memory usage (~90%) of 68GB.  So we decided to half the max_dbs_open to 50K thinking that not all database is open/access all the time.  Doing that did take our memory usage down but now that we see there is a lot of opening and closing index in our log file.  Does that happen when couch is trying to close some db?
> 
> If that's the case, it is surprising for us since when we are listening to the change feed, only ~2000 dbs is being changed at all time.  Does couch reference to a database even there is no client attached to it?
> 
> Thanks,
> Herman
> 
> On 24 Jun 2014, at 11:12, Alexander Shorin wrote:
> 
>> Database considered idle by active references to it and by related
>> active operations (like compaction):
>> https://github.com/apache/couchdb/blob/master/src/couchdb/couch_db.erl#L1115
>> CouchDB uses LRU cache to manage opened databases and frees idle by demand:
>> https://github.com/apache/couchdb/blob/master/src/couchdb/couch_server.erl#L490
>> leads to:
>> https://github.com/apache/couchdb/blob/master/src/couchdb/couch_server.erl#L261
>> 
>> There is nothing need to be configured.
>> --
>> ,,,^..^,,,
>> 
>> 
>> On Tue, Jun 24, 2014 at 7:01 PM, Herman Chan <he...@gmail.com> wrote:
>>> Hi there,
>>> 
>>> In the description of max_db_open, it says "CouchDB reference counts
>>> database accesses internally and will close idle databases when it must."  I
>>> was wondering what's consider idle in couchdb and if the idle time is
>>> configurable?
>>> 
>>> Herman


Re: max_dbs_open and idle db

Posted by Herman Chan <he...@gmail.com>.
A follow up question.

We have around 90K+ databases on our server.  We used to set 
max_dbs_open to 100K, our server was reaching a pretty high memory usage 
(~90%) of 68GB.  So we decided to half the max_dbs_open to 50K thinking 
that not all database is open/access all the time.  Doing that did take 
our memory usage down but now that we see there is a lot of opening and 
closing index in our log file.  Does that happen when couch is trying to 
close some db?

If that's the case, it is surprising for us since when we are listening 
to the change feed, only ~2000 dbs is being changed at all time.  Does 
couch reference to a database even there is no client attached to it?

Thanks,
Herman

On 24 Jun 2014, at 11:12, Alexander Shorin wrote:

> Database considered idle by active references to it and by related
> active operations (like compaction):
> https://github.com/apache/couchdb/blob/master/src/couchdb/couch_db.erl#L1115
> CouchDB uses LRU cache to manage opened databases and frees idle by 
> demand:
> https://github.com/apache/couchdb/blob/master/src/couchdb/couch_server.erl#L490
> leads to:
> https://github.com/apache/couchdb/blob/master/src/couchdb/couch_server.erl#L261
>
> There is nothing need to be configured.
> --
> ,,,^..^,,,
>
>
> On Tue, Jun 24, 2014 at 7:01 PM, Herman Chan <he...@gmail.com> 
> wrote:
>> Hi there,
>>
>> In the description of max_db_open, it says "CouchDB reference counts
>> database accesses internally and will close idle databases when it 
>> must."  I
>> was wondering what's consider idle in couchdb and if the idle time is
>> configurable?
>>
>> Herman

Re: max_dbs_open and idle db

Posted by Alexander Shorin <kx...@gmail.com>.
Database considered idle by active references to it and by related
active operations (like compaction):
https://github.com/apache/couchdb/blob/master/src/couchdb/couch_db.erl#L1115
CouchDB uses LRU cache to manage opened databases and frees idle by demand:
https://github.com/apache/couchdb/blob/master/src/couchdb/couch_server.erl#L490
leads to:
https://github.com/apache/couchdb/blob/master/src/couchdb/couch_server.erl#L261

There is nothing need to be configured.
--
,,,^..^,,,


On Tue, Jun 24, 2014 at 7:01 PM, Herman Chan <he...@gmail.com> wrote:
> Hi there,
>
> In the description of max_db_open, it says "CouchDB reference counts
> database accesses internally and will close idle databases when it must."  I
> was wondering what's consider idle in couchdb and if the idle time is
> configurable?
>
> Herman