You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 21, 2021. It is now read-only.
Copy file name to clipboardexpand all lines: 510_Deployment/45_dont_touch.asciidoc
+16-19
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,8 @@
1
1
2
-
=== Don't touch these settings!
2
+
=== Don't Touch These Settings!
3
3
4
4
There are a few hotspots in Elasticsearch that people just can't seem to avoid
5
-
tweaking. ((("deployment", "settings to leave unaltered"))) We understand: knobs just beg to be turned.
6
-
7
-
But of all the knobs to turn, these you should _really_ leave alone. They are
5
+
tweaking. ((("deployment", "settings to leave unaltered"))) We understand: knobs just beg to be turned. But of all the knobs to turn, these you should _really_ leave alone. They are
8
6
often abused and will contribute to terrible stability or terrible performance.
9
7
Or both.
10
8
@@ -27,10 +25,10 @@ like Elasticsearch. The official recommendation is to use CMS.
27
25
There is a newer GC called the Garbage First GC (G1GC). ((("Garbage First GC (G1GC)"))) This newer GC is designed
28
26
to minimize pausing even more than CMS, and operate on large heaps. It works
29
27
by dividing the heap into regions and predicting which regions contain the most
30
-
reclaimable space. By collecting those regions first ("garbage first"), it can
28
+
reclaimable space. By collecting those regions first (_garbage first_), it can
31
29
minimize pauses and operate on very large heaps.
32
30
33
-
Sounds great! Unfortunately, G1GC is still new and fresh bugs are found routinely.
31
+
Sounds great! Unfortunately, G1GC is still new, and fresh bugs are found routinely.
34
32
These bugs are usually of the segfault variety, and will cause hard crashes.
35
33
The Lucene test suite is brutal on GC algorithms, and it seems that G1GC hasn't
36
34
had the kinks worked out yet.
@@ -46,37 +44,36 @@ a lot? More threads! Node idling 95% of the time? More threads!
46
44
47
45
The default threadpool settings in Elasticsearch are very sensible. For all
48
46
threadpools (except `search`) the threadcount is set to the number of CPU cores.
49
-
If you have 8 cores, you can only be running 8 threads simultaneously. It makes
50
-
sense to only assign 8 threads to any particular threadpool.
47
+
If you have eight cores, you can be running only eight threads simultaneously. It makes
48
+
sense to assign only eight threads to any particular threadpool.
51
49
52
50
Search gets a larger threadpool, and is configured to `# cores * 3`.
53
51
54
52
You might argue that some threads can block (such as on a disk I/O operation),
55
-
which is why you need more threads. This is not actually not a problem in Elasticsearch:
56
-
much of the disk IO is handled by threads managed by Lucene, not Elasticsearch.
53
+
which is why you need more threads. This is not a problem in Elasticsearch:
54
+
much of the disk I/O is handled by threads managed by Lucene, not Elasticsearch.
57
55
58
56
Furthermore, threadpools cooperate by passing work between each other. You don't
59
57
need to worry about a networking thread blocking because it is waiting on a disk
60
58
write. The networking thread will have long since handed off that work unit to
61
59
another threadpool and gotten back to networking.
62
60
63
-
Finally, the compute capacity of your process is finite. More threads just forces
64
-
the processor to switch thread contexts. A processor can only run one thread
61
+
Finally, the compute capacity of your process is finite. Having more threads just forces
62
+
the processor to switch thread contexts. A processor can run only one thread
65
63
at a time, so when it needs to switch to a different thread, it stores the current
66
-
state (registers, etc) and loads another thread. If you are lucky, the switch
64
+
state (registers, and so forth) and loads another thread. If you are lucky, the switch
67
65
will happen on the same core. If you are unlucky, the switch may migrate to a
68
-
different core and require transport on inter-core communication bus.
66
+
different core and require transport on an inter-core communication bus.
69
67
70
-
This context switching eats up cycles simply doing administrative housekeeping
71
-
-- estimates can peg it as high as 30μs on modern CPUs. So unless the thread
68
+
This context switching eats up cycles simply by doing administrative housekeeping; estimates can peg it as high as 30μs on modern CPUs. So unless the thread
72
69
will be blocked for longer than 30μs, it is highly likely that that time would
73
70
have been better spent just processing and finishing early.
74
71
75
-
People routinely set threadpools to silly values. On 8 core machines, we have
76
-
run across configs with 60, 100 or even 1000 threads. These settings will simply
72
+
People routinely set threadpools to silly values. On eight core machines, we have
73
+
run across configs with 60, 100, or even 1000 threads. These settings will simply
77
74
thrash the CPU more than getting real work done.
78
75
79
-
So. Next time you want to tweak a threadpool...please don't. And if you
76
+
So. Next time you want to tweak a threadpool, please don't. And if you
80
77
_absolutely cannot resist_, please keep your core count in mind and perhaps set
81
78
the count to double. More than that is just a waste.
0 commit comments