Blogs How to improve performance of Couchbase community server ?

How to improve performance of Couchbase community server ?

line

May 10, 2020

I have been using couchbase community edition server for building some high performance REST APIs on Spring Boot. I would like to highlight some useful links to get started on Spring boot with the Couchbase community server. Also, provide an overview of how to achieve high performance gains & response times in milliseconds.

Why should a developer use Couchbase ?

couchbase

Image from couchbase.com

Apart from the overall capability mentioned above, I prefer couchbase specifically for the following reasons (which was the core need of the application I was building)

1. Memory first

2. Elastic scalability

3. Replication

As a developer, I was able to get the performance of the order of milliseconds at a reasonable load (a couple of million records). Anyone willing to start on SpringBoot + Couchbase can start in GitHub of spring with couchbase. This GitHub section has a very good introduction and all the classes that will be needed for spring integration with couchbase

Checklist to go live

Once all the feature development is complete, you will want to go live with your application/product in one of the cloud environments like Google or AWS. If you are building applications that generate and consumes millions of records per week, then read further on my recommendations

1. Load testing on the application using standard tools. I used Newman with open trace

2. Use the advisor service of couchbase to find any bottlenecks https://blog.couchbase.com/n1ql-index-advisor-improve-query-performance-and-productivity/

TIP: Use an enterprise edition locally and find all bottlenecks using the advisor. Then apply suitable indexes or memory or storage based on recommendation

3.Understand parallelism, memory parameters and sort parameters https://docs.couchbase.com/server/current/analytics/appendix_2_parameters.html

4. Make sure enough memory is allocated for data, index and search. Verify here as shown below (actual numbers will vary — just an indication to verify)

couchbase-settings

TIP: Most common problem with couchbase community edition is that the indexes are present / created by developer are not applied in runtime

5. To ensure that the right indexes are present & applied, we need to use the USE INDEX command in our N1QL queries that are written in the application. This will ensure guaranteed high performance. To choose the right index, read this blog and get a detailed understanding.

6. Set proper Swappiness. This will ensure that any allocated RAM is utilized fully. Couchbase recommends that you use 100% of the RAM by setting swappiness to 0. I have been using a swampiness value of 10–20 and found it quite effective in proper utilization of RAM https://developer.couchbase.com/documentation/server/3.x/admin/Concepts/swap-space.html

Common Issues

Conclusion

Verdict : Over all, couchbase is my preferred choice of NoSQL DB. By following some of the best practices, we can ensure highly scalable and highly available application with performance metrics in milliseconds for all DB operation

venkat-pic

WRITTEN BY

Venkatachalam Dekshinamurthy

More Blogs

line