How to improve performance of Couchbase community server ?

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/

Common Issues

Some of the related problems you may run into are listed below

https://forums.couchbase.com/t/n1ql-does-not-use-index-for-order-by/10597
https://forums.couchbase.com/t/index-not-hit-on-very-simple-order-by-n1ql-query/14100/2
https://forums.couchbase.com/t/n1ql-does-not-use-index-for-order-by/10597/29
https://forums.couchbase.com/t/index-for-query-with-order-by/15387

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

Facebook
Twitter
LinkedIn

Related Posts

From Flutter to React Native: The Top Cross-Platform Frameworks to Choose in 2024

From Flutter to React Native: The Top Cross-Platform Frameworks to Choose in 2024

Cross-platform app development has become indispensable in the fast-paced world of mobile applications. In 2024,

Open Banking Revolution Leveraging APIs for a Frictionless Financial Future Open

Open Banking Revolution: Leveraging APIs for a Frictionless Financial Future

In the dynamic landscape of modern finance, the Open Banking Revolution stands as a beacon

The rise of wearables: How technology is transforming personal health tracking

In the era of digital transformation, wearables have emerged as pivotal tools, reshaping the landscape