You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ch...@apache.org on 2020/09/22 21:59:22 UTC

[couchdb] branch 3160-main-fix-run-queue-metric created (now 2f47ff0)

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

chewbranca pushed a change to branch 3160-main-fix-run-queue-metric
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


      at 2f47ff0  Workaround dirty schedulers in run_queue stats

This branch includes the following new commits:

     new 2f47ff0  Workaround dirty schedulers in run_queue stats

The 1 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.



[couchdb] 01/01: Workaround dirty schedulers in run_queue stats

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

chewbranca pushed a commit to branch 3160-main-fix-run-queue-metric
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 2f47ff0c6487fb3af4731bb782d76b9bcf2fe194
Author: Russell Branca <ch...@apache.org>
AuthorDate: Thu Sep 17 16:14:18 2020 -0700

    Workaround dirty schedulers in run_queue stats
---
 src/chttpd/src/chttpd_node.erl | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/chttpd/src/chttpd_node.erl b/src/chttpd/src/chttpd_node.erl
index 1ca4bbd..0159672 100644
--- a/src/chttpd/src/chttpd_node.erl
+++ b/src/chttpd/src/chttpd_node.erl
@@ -15,7 +15,8 @@
 
 -export([
     handle_node_req/1,
-    get_stats/0
+    get_stats/0,
+    run_queues/0
 ]).
 
 -include_lib("couch/include/couch_db.hrl").
@@ -212,10 +213,12 @@ get_stats() ->
     {CF, CDU} = db_pid_stats(),
     MessageQueues0 = [{couch_file, {CF}}, {couch_db_updater, {CDU}}],
     MessageQueues = MessageQueues0 ++ message_queues(registered()),
+    {SQ, DCQ} = run_queues(),
     [
         {uptime, couch_app:uptime() div 1000},
         {memory, {Memory}},
-        {run_queue, statistics(run_queue)},
+        {run_queue, SQ},
+        {run_queue_dirty_cpu, DCQ},
         {ets_table_count, length(ets:all())},
         {context_switches, element(1, statistics(context_switches))},
         {reductions, element(1, statistics(reductions))},
@@ -287,3 +290,13 @@ message_queues(Registered) ->
         {Type, Length} = process_info(whereis(Name), Type),
         {Name, Length}
     end, Registered).
+
+%% Workaround for https://bugs.erlang.org/browse/ERL-1355
+run_queues() ->
+    case erlang:system_info(dirty_cpu_schedulers) > 0 of
+        false ->
+            {statistics(run_queue), 0};
+        true ->
+            [DCQ | SQs] = lists:reverse(statistics(run_queue_lengths)),
+            {lists:sum(SQs), DCQ}
+    end.