You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2018/03/06 08:20:28 UTC

[couchdb] branch master updated (2c43e62 -> 42aba99)

This is an automated email from the ASF dual-hosted git repository.

jan pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


    from 2c43e62  This fixes couch_bt_engine:fold_local_docs/4
     new 5ef942a  feat: introduce snooze_period to reduce compaction_daemon load.
     new 0761b6a  fix: simplify config integer get
     new 58fef34  feat: bump the compaction daemon check_interval to one hour
     new e5bf9d4  doc: add snooze_period doc to default.ini
     new 42aba99  feat: demote view index opening/closing to log level debug

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 rel/overlay/etc/default.ini                        |  8 +++++++-
 src/couch/src/couch_compaction_daemon.erl          | 11 +++++++----
 src/couch/test/couchdb_compaction_daemon_tests.erl |  1 +
 src/couch_index/src/couch_index.erl                |  6 +++---
 4 files changed, 18 insertions(+), 8 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
jan@apache.org.

[couchdb] 04/05: doc: add snooze_period doc to default.ini

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit e5bf9d48aa8574447fb272345ca521d4b0529e39
Author: Jan Lehnardt <ja...@apache.org>
AuthorDate: Mon Mar 5 16:12:14 2018 +0100

    doc: add snooze_period doc to default.ini
---
 rel/overlay/etc/default.ini | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/rel/overlay/etc/default.ini b/rel/overlay/etc/default.ini
index 10c75a0..9762536 100644
--- a/rel/overlay/etc/default.ini
+++ b/rel/overlay/etc/default.ini
@@ -453,6 +453,12 @@ check_interval = 3600
 ; compaction will not happen. Very small files always have a very high
 ; fragmentation therefore it's not worth to compact them.
 min_file_size = 131072
+; With lots of databases and/or with lots of design docs in one or more
+; databases, the compaction_daemon can create significant CPU load when
+; checking whether databases and view indexes need compacting. The
+; snooze_period setting ensures a smoother CPU load. Defaults to
+; 3 seconds wait.
+; snooze_period = 3
 
 [compactions]
 ; List of compaction rules for the compaction daemon.

-- 
To stop receiving notification emails like this one, please contact
jan@apache.org.

[couchdb] 02/05: fix: simplify config integer get

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 0761b6adaedbad3b3dd287e3d45de50df013d30e
Author: Jan Lehnardt <ja...@apache.org>
AuthorDate: Mon Mar 5 16:09:00 2018 +0100

    fix: simplify config integer get
---
 src/couch/src/couch_compaction_daemon.erl | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/couch/src/couch_compaction_daemon.erl b/src/couch/src/couch_compaction_daemon.erl
index 59555f1..200c3fd 100644
--- a/src/couch/src/couch_compaction_daemon.erl
+++ b/src/couch/src/couch_compaction_daemon.erl
@@ -152,8 +152,7 @@ compact_loop(Parent) ->
     true ->
         receive {Parent, have_config} -> ok end;
     false ->
-        PausePeriod = list_to_integer(
-            config:get("compaction_daemon", "check_interval", "300")),
+        PausePeriod = config:get_integer("compaction_daemon", "check_interval", 3600),
         ok = timer:sleep(PausePeriod * 1000)
     end,
     compact_loop(Parent).

-- 
To stop receiving notification emails like this one, please contact
jan@apache.org.

[couchdb] 03/05: feat: bump the compaction daemon check_interval to one hour

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 58fef3452572cfd016ac3fdfe8f4fe363e3ac7b8
Author: Jan Lehnardt <ja...@apache.org>
AuthorDate: Mon Mar 5 18:08:16 2018 +0100

    feat: bump the compaction daemon check_interval to one hour
---
 rel/overlay/etc/default.ini | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rel/overlay/etc/default.ini b/rel/overlay/etc/default.ini
index 03f4d14..10c75a0 100644
--- a/rel/overlay/etc/default.ini
+++ b/rel/overlay/etc/default.ini
@@ -448,7 +448,7 @@ ssl_certificate_max_depth = 3
 [compaction_daemon]
 ; The delay, in seconds, between each check for which database and view indexes
 ; need to be compacted.
-check_interval = 300
+check_interval = 3600
 ; If a database or view index file is smaller then this value (in bytes),
 ; compaction will not happen. Very small files always have a very high
 ; fragmentation therefore it's not worth to compact them.

-- 
To stop receiving notification emails like this one, please contact
jan@apache.org.

[couchdb] 05/05: feat: demote view index opening/closing to log level debug

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 42aba99bba3b026ff82a87213cef685f113fbada
Author: Jan Lehnardt <ja...@apache.org>
AuthorDate: Mon Mar 5 16:15:51 2018 +0100

    feat: demote view index opening/closing to log level debug
---
 src/couch_index/src/couch_index.erl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/couch_index/src/couch_index.erl b/src/couch_index/src/couch_index.erl
index b3a800f..8fba0a2 100644
--- a/src/couch_index/src/couch_index.erl
+++ b/src/couch_index/src/couch_index.erl
@@ -104,7 +104,7 @@ init({Mod, IdxState}) ->
                 Mod:get(idx_name, IdxState),
                 couch_index_util:hexsig(Mod:get(signature, IdxState))
             ],
-            couch_log:info("Opening index for db: ~s idx: ~s sig: ~p", Args),
+            couch_log:debug("Opening index for db: ~s idx: ~s sig: ~p", Args),
             proc_lib:init_ack({ok, self()}),
             gen_server:enter_loop(?MODULE, [], State);
         Other ->
@@ -131,7 +131,7 @@ terminate(Reason0, State) ->
         couch_index_util:hexsig(Mod:get(signature, IdxState)),
         Reason
     ],
-    couch_log:info("Closing index for db: ~s idx: ~s sig: ~p because ~r", Args),
+    couch_log:debug("Closing index for db: ~s idx: ~s sig: ~p because ~r", Args),
     ok.
 
 
@@ -366,7 +366,7 @@ handle_info(maybe_close, State) ->
     end;
 handle_info({'DOWN', _, _, _Pid, _}, #st{mod=Mod, idx_state=IdxState}=State) ->
     Args = [Mod:get(db_name, IdxState), Mod:get(idx_name, IdxState)],
-    couch_log:info("Index shutdown by monitor notice for db: ~s idx: ~s", Args),
+    couch_log:debug("Index shutdown by monitor notice for db: ~s idx: ~s", Args),
     catch send_all(State#st.waiters, shutdown),
     {stop, normal, State#st{waiters=[]}}.
 

-- 
To stop receiving notification emails like this one, please contact
jan@apache.org.

[couchdb] 01/05: feat: introduce snooze_period to reduce compaction_daemon load.

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 5ef942afdc79f1b012f2a2d48f722ea50afca899
Author: Jan Lehnardt <ja...@apache.org>
AuthorDate: Mon Mar 5 16:06:21 2018 +0100

    feat: introduce snooze_period to reduce compaction_daemon load.
    
    This commit introduces a snooze period for the compaction daemon
    to apply inbetween moving on from one database compaction to
    another, and from one view group to another.
    
    The result is that on db-per-user setups, the compaction daemon
    doesn’t cause a CPU spike every check_interval seconds.
---
 src/couch/src/couch_compaction_daemon.erl          | 8 ++++++--
 src/couch/test/couchdb_compaction_daemon_tests.erl | 1 +
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/couch/src/couch_compaction_daemon.erl b/src/couch/src/couch_compaction_daemon.erl
index 9371119..59555f1 100644
--- a/src/couch/src/couch_compaction_daemon.erl
+++ b/src/couch/src/couch_compaction_daemon.erl
@@ -126,6 +126,7 @@ handle_config_terminate(_Server, _Reason, _State) ->
     erlang:send_after(?RELISTEN_DELAY, whereis(?MODULE), restart_config_listener).
 
 compact_loop(Parent) ->
+    SnoozePeriod = config:get_integer("compaction_daemon", "snooze_period", 3),
     {ok, _} = couch_server:all_databases(
         fun(DbName, Acc) ->
             case ets:info(?CONFIG_ETS, size) =:= 0 of
@@ -138,7 +139,8 @@ compact_loop(Parent) ->
                 {ok, Config} ->
                     case check_period(Config) of
                     true ->
-                        maybe_compact_db(Parent, DbName, Config);
+                        maybe_compact_db(Parent, DbName, Config),
+                        ok = timer:sleep(SnoozePeriod * 1000);
                     false ->
                         ok
                     end
@@ -229,7 +231,9 @@ maybe_compact_views(DbName, [DDocName | Rest], Config) ->
             maybe_compact_views(DbName, Rest, Config);
         timeout ->
             ok
-        end;
+        end,
+        SnoozePeriod = config:get_integer("compaction_daemon", "snooze_period", 3),
+        ok = timer:sleep(SnoozePeriod * 1000);
     false ->
         ok
     end.
diff --git a/src/couch/test/couchdb_compaction_daemon_tests.erl b/src/couch/test/couchdb_compaction_daemon_tests.erl
index 47f35a0..c10ddee 100644
--- a/src/couch/test/couchdb_compaction_daemon_tests.erl
+++ b/src/couch/test/couchdb_compaction_daemon_tests.erl
@@ -24,6 +24,7 @@
 start() ->
     Ctx = test_util:start_couch(),
     ok = config:set("compaction_daemon", "check_interval", "3", false),
+    ok = config:set("compaction_daemon", "snooze_period", "0", false),
     ok = config:set("compaction_daemon", "min_file_size", "100000", false),
     ok = config:delete("compactions", "_default", false),
     ok = meck:new(?MODS_TO_MOCK, [passthrough]),

-- 
To stop receiving notification emails like this one, please contact
jan@apache.org.