Connection pool for couchdb

2019-07-28 06:50发布

问题:

I have one couchdb database and I am querying it in parallel. Now, I want to create a connection pool, because I discovered a bottleneck in my design - I was using a single instance of couchd , so parallelization was failing due to that.

I searched the web for connection pool implementations, but I was not able to find a proper java connection pool implementation for couchdb - most of the frameworks support relational databases. I will be appreciated if someone can help me for that.

回答1:

I've never used a couchdb connection pool, but you may have some luck with this:

http://commons.apache.org/pool/

It lets you pool any old object, including connections. It'll take a few lines of code to get it working for you though.

Hope this helps, Nate



回答2:

If you are searching for a simple way to load-balance multiple CouchDB instances, why not use an HTTP load balancer like Varnish? Take a look here on how you can set up a simple round-robin load balancer. You can also disable caching if it's undesirable.