A newer version of this documentation is available.

View Latest

Performance tuning

Pay particular attention to how you schedule operations and interact with buckets and views. You can maximize the performance of your application by following best practices for using these resources.

Though the Python client and Couchbase Server are extremely performant, you can follow these guidelines to ensure the most effective use of your computing resources:

  • Couchbase bucket connections are relatively expensive to establish in relation to the operations performed on them. Because of this, you should open each bucket only once per application instance. Due to multiplexing performed within the client, opening multiple connections can cause issues and will not benefit performance in most cases.

  • Don’t use too many views and buckets. A large number of buckets or views can negatively affect the performance of Couchbase Server and any connected clients.

  • Performing multiple operations simultaneously increases throughput and is important to achieving the best possible operation speeds. Most of the CRUD methods have _multi variants. If using the Twisted API, you can also dispatch two discrete operations simultaneously, rather than waiting for an operation callback.

  • If your application is strictly single-threaded, you may pass the unlock_gil=False option to the Bucket constructor. This will make the client slightly faster; however this will also likely crash the application if your application (or any of its dependencies) are making use of Python threads.