0
votes

We have dedicated D-node and E-node groups in the production config. and I am trying to gather the request status of the task server across all the hosts in the D-node group. I am using xdmp:server-status(host_id,server_id) where host_id is the ID of one of our six hosts belonging to the D-node group, and the server_id is the id of the taskserver for the D-node group. The query runs just fine but I have confusions about some elements in the output (see below).

  1. What is the difference between the threads and max_threads elements? I looked up the MarkLogic API for xdmp:server-status() and looks like they have put the same description for both these elements which is obviously wrong.
  2. Does the sum of request_status elements represents the number of tasks running? That's probably intuitive but just wanted to confirm.

    <server-status xmlns="http://marklogic.com/xdmp/status/server">
      <server-id>11927597993558616659</server-id>
      <host-id>10652389071003024571</host-id>
      <server-kind>task-server</server-kind>
      <enabled>true</enabled>
      <threads>9</threads>
      <max-threads>16</max-threads>
      <max-time-limit>3600</max-time-limit>
      <default-time-limit>600</default-time-limit>
      <current-time>2015-08-26T04:06:41.622879-04:00</current-time>
      <request-statuses>
        <request-status>
        <request-id>17847109729564550394</request-id>
        <server-id>11927597993558616659</server-id>
        <host-id>10652389071003024571</host-id>
        <transaction-id>11386673421668364533</transaction-id>
        <canceled>false</canceled>
        <modules>16882056828749629778</modules>
        <database>13691199455930504749</database>
        <root>/</root>
        <request-kind>invoke</request-kind>
        <request-text>/MarkLogic/cpf/triggers/on-state-enter.xqy</request-text>
        <update>false</update>
        <start-time>2015-08-26T04:06:41.621354-04:00</start-time>
        <time-limit>600</time-limit>
        <max-time-limit>3600</max-time-limit>
        <user>15525372533614500271</user>
        <trigger-depth>0</trigger-depth>
        <expanded-tree-cache-hits>0</expanded-tree-cache-hits>
        <expanded-tree-cache-misses>0</expanded-tree-cache-misses>
        <request-state>running</request-state>
        <profiling-allowed>true</profiling-allowed>
        <profiling-enabled>false</profiling-enabled>
        <debugging-allowed>true</debugging-allowed>
        <debugging-status>detached</debugging-status>
        <retry-count>0</retry-count>
      </request-status>
      <request-status>
        <request-id>8474714682726605430</request-id>
        <server-id>11927597993558616659</server-id>
        <host-id>10652389071003024571</host-id>
        <transaction-id>8554209989266201299</transaction-id>
        <canceled>false</canceled>
        <modules>16882056828749629778</modules>
        <database>13691199455930504749</database>
        <root>/</root>
        <request-kind>invoke</request-kind>
        <request-text>/MarkLogic/cpf/triggers/on-state-enter.xqy</request-text>
        <update>true</update>
        <start-time>2015-08-26T04:06:41.483786-04:00</start-time>
        <time-limit>600</time-limit>
        <max-time-limit>3600</max-time-limit>
        <user>15525372533614500271</user>
        <trigger-depth>0</trigger-depth>
        <expanded-tree-cache-hits>20</expanded-tree-cache-hits>
        <expanded-tree-cache-misses>0</expanded-tree-cache-misses>
        <request-state>running</request-state>
        <profiling-allowed>true</profiling-allowed>
        <profiling-enabled>false</profiling-enabled>
        <debugging-allowed>true</debugging-allowed>
        <debugging-status>detached</debugging-status>
        <retry-count>0</retry-count>
      </request-status>
      <request-status>
        <request-id>6530741740134403011</request-id>
        <server-id>11927597993558616659</server-id>
        <host-id>10652389071003024571</host-id>
        <transaction-id>14792921325069589956</transaction-id>
        <canceled>false</canceled>
        <modules>16882056828749629778</modules>
        <database>13691199455930504749</database>
        <root>/</root>
        <request-kind>invoke</request-kind>
        <request-text>/MarkLogic/cpf/triggers/on-state-enter.xqy</request-text>
        <update>true</update>
        <start-time>2015-08-26T04:06:41.52227-04:00</start-time>
        <time-limit>600</time-limit>
        <max-time-limit>3600</max-time-limit>
        <user>15525372533614500271</user>
        <trigger-depth>0</trigger-depth>
        <expanded-tree-cache-hits>20</expanded-tree-cache-hits>
        <expanded-tree-cache-misses>0</expanded-tree-cache-misses>
        <request-state>running</request-state>
        <profiling-allowed>true</profiling-allowed>
        <profiling-enabled>false</profiling-enabled>
        <debugging-allowed>true</debugging-allowed>
        <debugging-status>detached</debugging-status>
        <retry-count>0</retry-count>
      </request-status>
      <request-status>
        <request-id>9441948619847315123</request-id>
        <server-id>11927597993558616659</server-id>
        <host-id>10652389071003024571</host-id>
        <transaction-id>13501074757179797206</transaction-id>
        <canceled>false</canceled>
        <modules>16882056828749629778</modules>
        <database>13691199455930504749</database>
        <root>/</root>
        <request-kind>invoke</request-kind>
        <request-text>/MarkLogic/cpf/triggers/on-status-enter.xqy</request-text>
        <update>false</update>
        <start-time>2015-08-26T04:06:41.594876-04:00</start-time>
        <time-limit>600</time-limit>
        <max-time-limit>3600</max-time-limit>
        <user>15525372533614500271</user>
        <trigger-depth>0</trigger-depth>
        <expanded-tree-cache-hits>0</expanded-tree-cache-hits>
        <expanded-tree-cache-misses>0</expanded-tree-cache-misses>
        <request-state>running</request-state>
        <profiling-allowed>true</profiling-allowed>
        <profiling-enabled>false</profiling-enabled>
        <debugging-allowed>true</debugging-allowed>
        <debugging-status>detached</debugging-status>
        <retry-count>0</retry-count>
      </request-status>
      <request-status>
        <request-id>3267724788720707644</request-id>
        <server-id>11927597993558616659</server-id>
        <host-id>10652389071003024571</host-id>
        <transaction-id>16009199203479096620</transaction-id>
        <canceled>false</canceled>
        <modules>16882056828749629778</modules>
        <database>13691199455930504749</database>
        <root>/</root>
        <request-kind>invoke</request-kind>
        <request-text>/MarkLogic/cpf/triggers/on-state-enter.xqy</request-text>
        <update>true</update>
        <start-time>2015-08-26T04:06:41.483616-04:00</start-time>
        <time-limit>600</time-limit>
        <max-time-limit>3600</max-time-limit>
        <user>13094335114653925163</user>
        <trigger-depth>0</trigger-depth>
        <expanded-tree-cache-hits>20</expanded-tree-cache-hits>
        <expanded-tree-cache-misses>0</expanded-tree-cache-misses>
        <request-state>running</request-state>
        <profiling-allowed>true</profiling-allowed>
        <profiling-enabled>false</profiling-enabled>
        <debugging-allowed>true</debugging-allowed>
        <debugging-status>detached</debugging-status>
        <retry-count>0</retry-count>
      </request-status>
    </request-statuses>
    <request-rate>16.11519</request-rate>
    <queue-size>0</queue-size>
    <queue-limit>100000</queue-limit>
    <expanded-tree-cache-hits>241396964</expanded-tree-cache-hits>
    <expanded-tree-cache-misses>65339949</expanded-tree-cache-misses>
    <expanded-tree-cache-hit-rate>161.5713</expanded-tree-cache-hit-rate>
    <expanded-tree-cache-miss-rate>8.095861</expanded-tree-cache-miss-rate>
    <fs-program-cache-hits>26819890</fs-program-cache-hits>
    <fs-program-cache-misses>26819890</fs-program-cache-misses>
    <db-program-cache-hits>3632389</db-program-cache-hits>
    <db-program-cache-misses>3632389</db-program-cache-misses>
    <fs-main-module-seq-cache-hits>4694</fs-main-module-seq-cache-hits>
    <fs-main-module-seq-cache-misses>4694</fs-main-module-seq-cache-misses>
    <db-main-module-seq-cache-hits>15144</db-main-module-seq-cache-hits>
    <db-main-module-seq-cache-misses>15144</db-main-module-seq-cache-misses>
    <fs-lib-module-cache-hits>1102986</fs-lib-module-cache-hits>
    <fs-lib-module-cache-misses>1102986</fs-lib-module-cache-misses>
    <db-lib-module-cache-hits>14221</db-lib-module-cache-hits>
    <db-lib-module-cache-misses>14221</db-lib-module-cache-misses>
    
1

1 Answers

1
votes

Yes the docs are wrong, I will file a bug on that, they mean what you probably think. max-threads is the max number of threads that can run, threads is the current number of 'running' threads. The sum of request-status should (generally) match threads. Since threads are in a 'pool' there are periods where the sums dont match exactly.

You can try this out for a simple test.

for $i in 1 to 1000 return 
xdmp:spawn-function( function () { xdmp:sleep(10000) } )

It should return immediately filling the queue with 1000 tasks.

Then run this occasionally

xdmp:server-status(xdmp:host(),xdmp:server("TaskServer")) ! (./*:threads,count(./*:request-statuses/*:request-status))