Skip to content
This repository was archived by the owner on Sep 21, 2021. It is now read-only.

Commit 14bee10

Browse files
committed
Edited 500_Cluster_Admin/40_other_stats.asciidoc with Atlas code editor
1 parent 2bfb446 commit 14bee10

File tree

1 file changed

+73
-73
lines changed

1 file changed

+73
-73
lines changed

500_Cluster_Admin/40_other_stats.asciidoc

+73-73
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11

22
=== Cluster Stats
33

4-
The _Cluster Stats_ API provides very similar output to the Node Stats.((("clusters", "administration", "Cluster Stats API"))) There
5-
is one crucial difference: Node Stats shows you statistics per-node, while
6-
Cluster Stats will show you the sum total of all nodes in a single metric.
7-
8-
This provides some useful stats to glance at. You can see that your entire cluster
9-
is using 50% available heap, filter cache is not evicting heavily, etc. It's
10-
main use is to provide a quick summary which is more extensive than
11-
the Cluster Health, but less detailed than Node Stats. It is also useful for
12-
clusters which are very large, which makes Node Stats output difficult
4+
The `cluster-stats` API provides similar output to the `node-stats`.((("clusters", "administration", "Cluster Stats API"))) There
5+
is one crucial difference: Node Stats shows you statistics per node, while
6+
`cluster-stats` shows you the sum total of all nodes in a single metric.
7+
8+
This provides some useful stats to glance at. You can see for example, that your entire cluster
9+
is using 50% of the available heap or that filter cache is not evicting heavily. Its
10+
main use is to provide a quick summary that is more extensive than
11+
the `cluster-health`, but less detailed than `node-stats`. It is also useful for
12+
clusters that are very large, which makes `node-stats` output difficult
1313
to read.
1414

15-
The API may be invoked with:
15+
The API may be invoked as follows:
1616

1717
[source,js]
1818
----
@@ -21,16 +21,16 @@ GET _cluster/stats
2121

2222
=== Index Stats
2323

24-
So far, we have been looking at _node-centric_ statistics.((("indexes", "index statistics")))((("clusters", "administration", "index stats"))) How much memory does
24+
So far, we have been looking at _node-centric_ statistics:((("indexes", "index statistics")))((("clusters", "administration", "index stats"))) How much memory does
2525
this node have? How much CPU is being used? How many searches is this node
26-
servicing? Etc. etc.
26+
servicing?
2727

28-
Sometimes it is useful to look at statistics from an _index-centric_ perspective.
28+
Sometimes it is useful to look at statistics from an _index-centric_ perspective:
2929
How many search requests is _this index_ receiving? How much time is spent fetching
30-
docs in _that index_, etc.
30+
docs in _that index_?
3131

3232
To do this, select the index (or indices) that you are interested in and
33-
execute an Index Stats API:
33+
execute an Index `stats` API:
3434

3535
[source,js]
3636
----
@@ -40,21 +40,21 @@ GET my_index,another_index/_stats <2>
4040
4141
GET _all/_stats <3>
4242
----
43-
<1> Stats for `my_index`
44-
<2> Stats for multiple indices can be requested by comma separating their names
45-
<3> Stats indices can be requested using the special `_all` index name
43+
<1> Stats for `my_index`.
44+
<2> Stats for multiple indices can be requested by separating their names with a comma.
45+
<3> Stats indices can be requested using the special `_all` index name.
4646

47-
The stats returned will be familar to the Node Stats output: search, fetch, get,
48-
index, bulk, segment counts, etc
47+
The stats returned will be familar to the `node-stats` output: `search` `fetch` `get`
48+
`index` `bulk` `segment counts` and so forth
4949

50-
Index-centric stats can be useful for identifying or verifying "hot" indices
51-
inside your cluster, or trying to determine while some indices are faster/slower
50+
Index-centric stats can be useful for identifying or verifying _hot_ indices
51+
inside your cluster, or trying to determine why some indices are faster/slower
5252
than others.
5353

5454
In practice, however, node-centric statistics tend to be more useful. Entire
5555
nodes tend to bottleneck, not individual indices. And because indices
5656
are usually spread across multiple nodes, index-centric statistics
57-
are usually not very helpful because it aggregates different physical machines
57+
are usually not very helpful because they aggregate data from different physical machines
5858
operating in different environments.
5959

6060
Index-centric stats are a useful tool to keep in your repertoire, but are not usually
@@ -63,16 +63,16 @@ the first tool to reach for.
6363
=== Pending Tasks
6464

6565
There are certain tasks that only the master can perform, such as creating a new ((("clusters", "administration", "Pending Tasks API")))
66-
index or moving shards around the cluster. Since a cluster can only have one
67-
master, only one node can ever process cluster-level metadata changes. In
66+
index or moving shards around the cluster. Since a cluster can have only one
67+
master, only one node can ever process cluster-level metadata changes. For
6868
99.9999% of the time, this is never a problem. The queue of metadata changes
6969
remains essentially zero.
7070

71-
In some _very rare_ clusters, the number of metadata changes occurs faster than
72-
the master can process them. This leads to a build up of pending actions which
71+
In some _rare_ clusters, the number of metadata changes occurs faster than
72+
the master can process them. This leads to a buildup of pending actions that
7373
are queued.
7474

75-
The _Pending Tasks_ API ((("Pending Tasks API")))will show you what (if any) cluster-level metadata changes
75+
The `pending-tasks` API ((("Pending Tasks API")))will show you what (if any) cluster-level metadata changes
7676
are pending in the queue:
7777

7878
[source,js]
@@ -89,7 +89,7 @@ Usually, the response will look like this:
8989
}
9090
----
9191

92-
Meaning there are no pending tasks. If you have one of the rare clusters that
92+
This means there are no pending tasks. If you have one of the rare clusters that
9393
bottlenecks on the master node, your pending task list may look like this:
9494

9595
[source,js]
@@ -122,50 +122,50 @@ bottlenecks on the master node, your pending task list may look like this:
122122
----
123123

124124
You can see that tasks are assigned a priority (`URGENT` is processed before `HIGH`,
125-
etc), the order it was inserted, how long the action has been queued and
126-
what the action is trying to perform. In the above list, there is a Create Index
127-
action and two Shard Started actions pending.
125+
for example), the order it was inserted, how long the action has been queued and
126+
what the action is trying to perform. In the preceding list, there is a `create-index`
127+
action and two `shard-started` actions pending.
128128

129-
.When should I worry about Pending Tasks?
129+
.When Should I Worry About Pending Tasks?
130130
****
131131
As mentioned, the master node is rarely the bottleneck for clusters. The only
132-
time it can potentially bottleneck is if the cluster state is both very large
132+
time it could bottleneck is if the cluster state is both very large
133133
_and_ updated frequently.
134134
135135
For example, if you allow customers to create as many dynamic fields as they wish,
136136
and have a unique index for each customer every day, your cluster state will grow
137137
very large. The cluster state includes (among other things) a list of all indices,
138138
their types, and the fields for each index.
139139
140-
So if you have 100,000 customers, and each customer averages 1000 fields and 90
141-
days of retention....that's nine billion fields to keep in the cluster state.
140+
So if you have 100,000 customers, and each customer averages 1,000 fields and 90
141+
days of retention--that's nine billion fields to keep in the cluster state.
142142
Whenever this changes, the nodes must be notified.
143143
144-
The master must process these changes which requires non-trivial CPU overhead,
144+
The master must process these changes, which requires nontrivial CPU overhead,
145145
plus the network overhead of pushing the updated cluster state to all nodes.
146146
147-
It is these clusters which may begin to see cluster state actions queuing up.
147+
It is these clusters that may begin to see cluster-state actions queuing up.
148148
There is no easy solution to this problem, however. You have three options:
149149
150150
- Obtain a beefier master node. Vertical scaling just delays the inevitable,
151-
unfortunately
151+
unfortunately.
152152
- Restrict the dynamic nature of the documents in some way, so as to limit the
153-
cluster state size.
154-
- Spin up another cluster once a certain threshold has been crossed.
153+
cluster-state size.
154+
- Spin up another cluster after a certain threshold has been crossed.
155155
****
156156

157-
=== Cat API
157+
=== cat API
158158

159-
If you work from the command line often, the _Cat_ APIs will be very helpful
160-
to you.((("Cat API")))((("clusters", "administration", "Cat API"))) Named after the linux `cat` command, these APIs are designed to be
161-
work like *nix command line tools.
159+
If you work from the command line often, the `cat` APIs will be helpful
160+
to you.((("Cat API")))((("clusters", "administration", "Cat API"))) Named after the linux `cat` command, these APIs are designed to
161+
work like *nix command-line tools.
162162

163163
They provide statistics that are identical to all the previously discussed APIs
164-
(Health, Node Stats, etc), but present the output in tabular form instead of
165-
JSON. This is _very_ convenient as a system administrator and you just want
166-
to glance over your cluster, or find nodes with high memory usage, etc.
164+
(Health, `node-stats`, and so forth), but present the output in tabular form instead of
165+
JSON. This is _very_ convenient for a system administrator, and you just want
166+
to glance over your cluster or find nodes with high memory usage.
167167

168-
Executing a plain GET against the Cat endpoint will show you all available
168+
Executing a plain `GET` against the `cat` endpoint will show you all available
169169
APIs:
170170

171171
[source,bash]
@@ -207,9 +207,9 @@ GET /_cat/health
207207
----
208208

209209
The first thing you'll notice is that the response is plain text in tabular form,
210-
not JSON. The second thing you'll notices is that there are no column headers
210+
not JSON. The second thing you'll notice is that there are no column headers
211211
enabled by default. This is designed to emulate *nix tools, since it is assumed
212-
that once you become familiar with the output you no longer want to see
212+
that once you become familiar with the output, you no longer want to see
213213
the headers.
214214

215215
To enable headers, add the `?v` parameter:
@@ -222,11 +222,11 @@ epoch timestamp cluster status node.total node.data shard
222222
1408723890 12:11:30 elasticsearch_zach yellow 1 1 114 114 0 0 114
223223
----
224224

225-
Ah, much better. We now see the timestamp, cluster name, the status, how many
226-
nodes are in the cluster, etc. All the same information as the Cluster Health
225+
Ah, much better. We now see the timestamp, cluster name, status, the number of
226+
nodes in the cluster, and more--all the same information as the `cluster-health`
227227
API.
228228

229-
Let's look at Node Stats in the Cat API:
229+
Let's look at `node-stats` in the `cat` API:
230230

231231
[source,bash]
232232
----
@@ -236,9 +236,9 @@ host ip heap.percent ram.percent load node.role master name
236236
zacharys-air 192.168.1.131 45 72 1.85 d * Zach
237237
----
238238

239-
We see some stats about the nodes in our cluster, but it is very basic compared
240-
to the full Node Stats output. There are many additional metrics that you can
241-
include, but rather than consulting the documentation, let's just ask the Cat
239+
We see some stats about the nodes in our cluster, but the output is basic compared
240+
to the full `node-stats` output. You can
241+
include many additional metrics, but rather than consulting the documentation, let's just ask the `cat`
242242
API what is available.
243243

244244
You can do this by adding `?help` to any API:
@@ -267,11 +267,11 @@ master | m | m:master-eligible, *:curr
267267
...
268268
...
269269
----
270-
(Note that the output has been truncated for brevity)
270+
(Note that the output has been truncated for brevity).
271271

272-
The first column shows the "fullname", the second column shows the "short name",
273-
and the third column offers a brief description about the parameter . Now that
274-
we know some column names, we can ask for those explicitly using the `?h`
272+
The first column shows the full name, the second column shows the short name,
273+
and the third column offers a brief description about the parameter. Now that
274+
we know some column names, we can ask for those explicitly by using the `?h`
275275
parameter:
276276

277277
[source,bash]
@@ -282,9 +282,9 @@ ip port heapPercent heapMax
282282
192.168.1.131 9300 53 990.7mb
283283
----
284284

285-
Because the Cat API tries to behave like *nix utilities, you can pipe the output
286-
to other tools such as sort, grep, awk, etc. For example, we can find the largest
287-
index in our cluster by using:
285+
Because the `cat` API tries to behave like *nix utilities, you can pipe the output
286+
to other tools such as `sort` `grep` or `awk`. For example, we can find the largest
287+
index in our cluster by using the following:
288288

289289
[source,bash]
290290
----
@@ -319,13 +319,13 @@ yellow cars 5 1 0 0 1249 1249
319319
yellow wavelet2 5 1 0 0 615 615
320320
----
321321

322-
By adding `?bytes=b` we disable the "human readable" formatting on numbers and
322+
By adding `?bytes=b`, we disable the human-readable formatting on numbers and
323323
force them to be listed as bytes. This output is then piped into `sort` so that
324-
our indices are ranked according to size (the 8th column).
324+
our indices are ranked according to size (the eighth column).
325325

326326
Unfortunately, you'll notice that the Marvel indices are clogging up the results,
327327
and we don't really care about those indices right now. Let's pipe the output
328-
through `grep` and remove anything mentioning marvel:
328+
through `grep` and remove anything mentioning Marvel:
329329

330330
[source,bash]
331331
----
@@ -351,13 +351,13 @@ yellow wavelet2 5 1 0 0 615 615
351351
----
352352

353353
Voila! After piping through `grep` (with `-v` to invert the matches), we get
354-
a sorted list of indices without marvel cluttering it up.
354+
a sorted list of indices without Marvel cluttering it up.
355355

356-
This is just a simple example of the flexibility of Cat at the command line.
357-
Once you get used to using Cat, you'll see it like any other *nix tool and start
358-
going crazy with piping, sorting, grepping. If you are a system admin and spend
359-
any length of time ssh'd into boxes...definitely spend some time getting familiar
360-
with the Cat API.
356+
This is just a simple example of the flexibility of `cat` at the command line.
357+
Once you get used to using `cat`, you'll see it like any other *nix tool and start
358+
going crazy with piping, sorting, and grepping. If you are a system admin and spend
359+
any time SSH'd into boxes, definitely spend some time getting familiar
360+
with the `cat` API.
361361

362362

363363

0 commit comments

Comments
 (0)