Env: 

CouchDB, NodeJS, Nano on Debian 8
~30 DBs with identical design docs, ranging from 5 docs to 3000

I’ve been working with CouchDB for a while in development, and now I’m scaling 
up for production I’m hitting issues.

Specifically, my shards and file descriptors seem to be spiralling out of 
control.

No doubt it’s something in my code rather than an issue with CouchDB per se, 
but I don’t see a way of finding out what’s going on. It’s not relative to the 
number of docs, but using prometheus I can see a couple of the DBs are hitting 
several thousand allocated file descriptors. I then hit ‘emfile’ errors (for 
which I’ve increased the available as per documentation, but I guess this is a 
temporary fix at best, as things grow). Additionally, shards grow to crazy 
sizes, and compaction does little to fix the problem. The only solution is to 
replicate the DB to a temp DB, then destroy and replicate back.

How can I debug this? And, is there any way of writing middleware for Nano 
during the ExpressJS request so I can see what’s going on?

Reply via email to