You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2021/02/15 13:25:45 UTC
[couchdb] 01/01: Add "couch_server" aggregate to _system output
This is an automated email from the ASF dual-hosted git repository.
rnewson pushed a commit to branch couch_server_system_aggregate
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 6ba642d14b2a22127e28dfb5c7e0882a4241fa13
Author: Robert Newson <rn...@apache.org>
AuthorDate: Mon Feb 15 13:24:13 2021 +0000
Add "couch_server" aggregate to _system output
This helps ease transition from singleton couch_server to
multiple. The "couch_server" message queue is simply the sum of the
couch_server_X message queues.
---
src/chttpd/src/chttpd_node.erl | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/chttpd/src/chttpd_node.erl b/src/chttpd/src/chttpd_node.erl
index 6407df1..b4bdf0b 100644
--- a/src/chttpd/src/chttpd_node.erl
+++ b/src/chttpd/src/chttpd_node.erl
@@ -209,7 +209,8 @@ get_stats() ->
{NumberOfGCs, WordsReclaimed, _} = statistics(garbage_collection),
{{input, Input}, {output, Output}} = statistics(io),
{CF, CDU} = db_pid_stats(),
- MessageQueues0 = [{couch_file, {CF}}, {couch_db_updater, {CDU}}],
+ MessageQueues0 = [{couch_file, {CF}}, {couch_db_updater, {CDU}},
+ {couch_server, couch_server_message_queue_len()}],
MessageQueues = MessageQueues0 ++ message_queues(registered()),
{SQ, DCQ} = run_queues(),
[
@@ -289,6 +290,14 @@ message_queues(Registered) ->
{Name, Length}
end, Registered).
+
+couch_server_message_queue_len() ->
+ N = couch_server:num_servers(),
+ Names = [couch_server:couch_server(I) || I <- lists:seq(1, N)],
+ MQs = message_queues(Names),
+ lists:sum([X || {_, X} <- MQs]).
+
+
%% Workaround for https://bugs.erlang.org/browse/ERL-1355
run_queues() ->
case erlang:system_info(dirty_cpu_schedulers) > 0 of