r and w are no longer configurable from the config file by design. The default 
is n/2+1 (so 3 in your case) unless you specify r or w as request parameters.

setting n = 4 for a 4 node cluster is very unusual, do you really need 4 full 
copies of your data?

couchdb will also automatically lower both r and w if nodes are offline.

The default of n=3, r=w=2 is appropriate in almost all cases as the right 
balance between data safety and availability. Nothing you've said so far 
suggests it would be good to deviate from those settings.

-- 
  Robert Samuel Newson
  [email protected]

On Mon, 11 Mar 2019, at 14:52, Vladimir Ralev wrote:
> Hi all,
> 
> I am looking into running a 4-node couchdb 2.3 with this config in
> default.ini and I made sure no other config file override them:
> [cluster]
> q = 8
> n = 4
> r = 1
> w = 1
> 
> But when i create a test DB and check the settings I get:
> curl -s couch01:5984/mytest1234 |jq . .... .... "cluster": { "q": 8, "n": 4,
> "w": 3, "r": 3 },
> 
> r and w settings are not respected and seem stuck to be the defaults.
> 
> When I kill 3 of the machine and test reads and writes, they still work
> fine so it doesn't seem like the r and w are actually 3 either. I checked
> if the debug logs printed out the r and w anywhere to confirm what is being
> configured or executed but there is nothing.
> 
> It is unclear if r and w are active in this version of couch. I can see 
> the
> they have been partially removed from the documentation
> https://docs.couchdb.org/en/master/cluster/theory.html as opposed to
> couchdb 2.0.0 original doc
> https://web.archive.org/web/20160109122310/https://docs.couchdb.org/en/stable/cluster/theory.html
> 
> Additionally curl -s couch01:5984/mytest1234/doc?r=3
> still works even if 3 out of the 4 nodes are dead which is unexpected per
> the quorum documentation here
> https://docs.couchdb.org/en/master/cluster/sharding.html#quorum
> 
> My specific concern with r and w is that if r is 3 this means 3 times more
> network and disk IO since it will have to read 3 times from remote
> machines. My use case really doesn't need this and performance will suffer.
> This is a little hard to test so I was hopinh someone can shed some light
> on the current situation with r and w in couch 2.3.
> 
> Thanks
>

Reply via email to