I'm tasked with scaling a system for which I need to do a high volume of inserts into the Couchbase server. I'm using Couchbase Server 2.5 by the way, and Couchbase Java Client 1.4.4
I expect to receive around 100K messages from a message queue, and I'm pulling them off and then persisting these messages into Couchbase as fast as possible. I intend to introduce concurrency by leveraging a concurrency framework like Akka. I intend to spawn up new actors for every message and persisting, so at any given point in time it's theoretically possible I'll have > 100K actors live in the system all concurrently trying to persist the message via the Couchbase client.
A few questions:
- How should I think about resource contention here? Assuming a 4 core machine, theoretically only 4 writes can happen in a truly parallel way.
- Let's assume that my Couchbase cluster is running on excellent hardware and should be able to scale to >100K requests very quickly. My theory is that I may run into bottlenecks on the client side, and if I do ...
- How should I scale my client to be able to do that many (or more writes), without timing out? Is there any way to tune my thread pools on the client side?
- Lastly, should I introduce some way of throttling my writes in such a way to offload "pressure" on the couchcbase client?
- What else am I missing when thinking about how to scale this properly, and gracefully, free from unexpected errors/resource leaks?
Thank you!