Database / CouchDB Interview Questions
How do you monitor CouchDB performance using the _stats and _active_tasks endpoints?
CouchDB exposes two key monitoring endpoints out of the box — /_stats and /_active_tasks — which together give a real-time snapshot of server health and ongoing operations.
GET /_stats returns a JSON object of cumulative performance counters organized by category. Key metrics to watch:
httpd.requests.value— total HTTP requests processed.httpd_request_methods.{GET,PUT,POST,DELETE}.value— breakdown by HTTP verb.httpd_status_codes.{200,201,400,404,409,500}.value— response code breakdown; rising 409s may indicate conflict storms; rising 500s indicate bugs.couchdb.open_databases.value— number of databases currently open (compare tomax_dbs_open).couchdb.request_time.value— mean, min, max request latency.
curl http://admin:pass@localhost:5984/_stats | python3 -m json.tool | head -60
# On a cluster, query per node:
curl http://admin:pass@localhost:5984/_node/couchdb@node1/_stats
GET /_active_tasks returns a live array of currently running background tasks. Each task has a type field:
database_compaction— compaction progress as a percentage.view_compaction— view index compaction progress.indexer— a view index being built or incrementally updated.replication— active replication job with checkpoint seq and docs per second.
curl http://admin:pass@localhost:5984/_active_tasks
# [{"type":"indexer","node":"couchdb@node1","design_document":"_design/orders",
# "view":"by_status","started_on":1700000000,"updated_on":1700000010,
# "progress":45}]
For production monitoring, both endpoints integrate with Prometheus via the community couchdb-exporter, allowing dashboards in Grafana alongside alerting on queue depth, error rates, and compaction lag.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
