In this chapter, we will take a look at some performance tips that you can apply when tuning your database. While not directly related to scalability, increasing performance can increase the overall capacity of your system. There are many options available when tuning CouchDB to meet your needs.
We will also discuss considerations around the design of your documents. CouchDB is a schema-less database, giving you much flexibility in designing the document boundaries for your data. However, the decisions you make around designing your documents can have an impact on the performance and scalability of your database.
The best way to increase the capacity of your database is to not send requests to it in the first place. Sometimes you can’t forego a database request altogether, but you can limit the amount of work you ask the database to do. Here are a some tips to limit the amount of work you ask of CouchDB and to increase performance (the applicability of these tips to your application may vary):
Cache documents and query results using memcached or another caching system. For systems under heavy load, even caches that expire after only a few seconds can save many extra requests to your database. This caching can be done in your application or by using a reverse proxy server that supports caching. Optionally, ...