diff options
author | Joan Touzet <joant@atypical.net> | 2017-05-09 16:09:04 -0400 |
---|---|---|
committer | Joan Touzet <joant@atypical.net> | 2017-05-09 16:09:04 -0400 |
commit | f073391aece76bbd0f90d7f74bb548753897a465 (patch) | |
tree | 7517af7bd9a378bc21dbb63deb528074c1a2deed | |
parent | 41304b83946f029f9712714cc89e9f630442d668 (diff) | |
download | couchdb-1.6.x.tar.gz |
Hibernate couch_stream after each writearchive/1.6.x1.6.x
In COUCHDB-1946 Adam Kocoloski investigated a memory explosion resulting
from replication of databases with large attachments (npm fullfat). He
was able to stabilize memory usage to a much lower level by hibernating
couch_stream after each write. While this increases CPU utilization when
writing attachments, it should help reduce memory utilization.
This patch is the single change that affected a ~70% reduction in
memory.
No alteration to the spawn of couch_stream to change the fullsweep_after
setting has been made, in part because this can be adjusted at the erl
command line if desired (-erl ERL_FULLSWEEP_AFTER 0).
+1 for 2.0.0 and 1.6.x from @davisp, see #510 for details.
-rw-r--r-- | src/couchdb/couch_stream.erl | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/couchdb/couch_stream.erl b/src/couchdb/couch_stream.erl index 959feef7c..4067ff7b4 100644 --- a/src/couchdb/couch_stream.erl +++ b/src/couchdb/couch_stream.erl @@ -255,7 +255,7 @@ handle_call({write, Bin}, _From, Stream) -> buffer_len=0, md5=Md5_2, identity_md5=IdenMd5_2, - identity_len=IdenLen + BinSize}}; + identity_len=IdenLen + BinSize}, hibernate}; true -> {reply, ok, Stream#stream{ buffer_list=[Bin|Buffer], |