diff options
-rw-r--r-- | rel/overlay/etc/default.ini | 7 | ||||
-rw-r--r-- | src/couch/src/couch_server.erl | 1 | ||||
-rw-r--r-- | src/couch/src/couch_util.erl | 11 |
3 files changed, 18 insertions, 1 deletions
diff --git a/rel/overlay/etc/default.ini b/rel/overlay/etc/default.ini index 7bfbbe941..4f49cb6d2 100644 --- a/rel/overlay/etc/default.ini +++ b/rel/overlay/etc/default.ini @@ -90,6 +90,11 @@ users_db_security_editable = false ; having to ask every configured engine. couch = couch_bt_engine +[process_priority] +; Selectively disable altering process priorities +; for modules that request it. +; couch_server = true + [cluster] q=2 n=3 @@ -522,4 +527,4 @@ min_priority = 2.0 ; value will be rejected. If this config setting is not defined, ; CouchDB will use the value of `max_limit` instead. If neither is ; defined, the default is 2000 as stated here. -; max_limit_partitions = 2000
\ No newline at end of file +; max_limit_partitions = 2000 diff --git a/src/couch/src/couch_server.erl b/src/couch/src/couch_server.erl index 2919ed524..d70fd0b92 100644 --- a/src/couch/src/couch_server.erl +++ b/src/couch/src/couch_server.erl @@ -229,6 +229,7 @@ close_db_if_idle(DbName) -> init([]) -> couch_util:set_mqd_off_heap(?MODULE), + couch_util:set_process_priority(?MODULE, high), % Mark pluggable storage engines as a supported feature config:enable_feature('pluggable-storage-engines'), diff --git a/src/couch/src/couch_util.erl b/src/couch/src/couch_util.erl index e2885a15e..b5c93ce51 100644 --- a/src/couch/src/couch_util.erl +++ b/src/couch/src/couch_util.erl @@ -39,6 +39,7 @@ -export([check_config_blacklist/1]). -export([check_md5/2]). -export([set_mqd_off_heap/1]). +-export([set_process_priority/2]). -include_lib("couch/include/couch_db.hrl"). @@ -690,6 +691,16 @@ set_mqd_off_heap(Module) -> end. +set_process_priority(Module, Level) -> + case config:get_boolean("process_priority", atom_to_list(Module), true) of + true -> + process_flag(priority, Level), + ok; + false -> + ok + end. + + ensure_loaded(Module) when is_atom(Module) -> case code:ensure_loaded(Module) of {module, Module} -> |