|
| 1 | +.. Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 2 | +.. use this file except in compliance with the License. You may obtain a copy of |
| 3 | +.. the License at |
| 4 | +.. |
| 5 | +.. http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | +.. |
| 7 | +.. Unless required by applicable law or agreed to in writing, software |
| 8 | +.. distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 9 | +.. WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 10 | +.. License for the specific language governing permissions and limitations under |
| 11 | +.. the License. |
| 12 | +
|
| 13 | +.. default-domain:: config |
| 14 | +.. highlight:: ini |
| 15 | + |
| 16 | +.. _config/ioq: |
| 17 | + |
| 18 | +======== |
| 19 | +IO Queue |
| 20 | +======== |
| 21 | + |
| 22 | +CouchDB has an internal subsystem that can prioritize IO associated with certain |
| 23 | +classes of operations. This subsystem can be configured to limit the resources |
| 24 | +devoted to background operations like internal replication and compaction |
| 25 | +according to the settings described below. |
| 26 | + |
| 27 | +.. config:section:: ioq :: IO Queue Configuration |
| 28 | +
|
| 29 | + .. config:option:: concurrency :: Number of in-flight IO requests |
| 30 | +
|
| 31 | + Specifies the maximum number of concurrent in-flight IO requests that |
| 32 | + the queueing system will submit:: |
| 33 | + |
| 34 | + [ioq] |
| 35 | + concurrency = 10 |
| 36 | + |
| 37 | + .. config:option:: ratio :: Preference for selecting background over interactive IO |
| 38 | +
|
| 39 | + The fraction of the time that a background IO request will be selected |
| 40 | + over an interactive IO request when both queues are non-empty:: |
| 41 | + |
| 42 | + [ioq] |
| 43 | + ratio = 0.01 |
| 44 | + |
| 45 | +.. config:section:: ioq.bypass :: Bypass selected IO classes by setting these to true |
| 46 | +
|
| 47 | + System administrators can choose to submit specific classes of IO directly |
| 48 | + to the underlying file descriptor or OS process, bypassing the queues |
| 49 | + altogether. Installing a bypass can yield higher throughput and lower |
| 50 | + latency, but relinquishes some control over prioritization. The following |
| 51 | + classes are recognized: |
| 52 | + |
| 53 | + .. config:option:: os_process |
| 54 | +
|
| 55 | + Messages on their way to an external process (e.g., ``couchjs``). |
| 56 | + |
| 57 | + .. config:option:: read |
| 58 | +
|
| 59 | + Disk IO fulfilling interactive read requests. |
| 60 | + |
| 61 | + .. config:option:: write |
| 62 | +
|
| 63 | + Disk IO required to update a database. |
| 64 | + |
| 65 | + .. config:option:: view_update |
| 66 | +
|
| 67 | + Disk IO required to update views and other secondary indexes. |
| 68 | + |
| 69 | + .. config:option:: shard_sync |
| 70 | +
|
| 71 | + Disk IO issued by the background replication processes that fix any |
| 72 | + inconsistencies between shard copies. |
| 73 | + |
| 74 | + .. config:option:: compaction |
| 75 | +
|
| 76 | + Disk IO issued by compaction jobs. |
| 77 | + |
| 78 | + Without any configuration CouchDB will enqueue all classes of IO. The |
| 79 | + default.ini configuration file that ships with CouchDB activates a bypass |
| 80 | + for each of the interactive IO classes and only background IO goes into the |
| 81 | + queueing system:: |
| 82 | + |
| 83 | + [ioq.bypass] |
| 84 | + os_process = true |
| 85 | + read = true |
| 86 | + write = true |
| 87 | + view_update = true |
| 88 | + shard_sync = false |
| 89 | + compaction = false |
| 90 | + |
| 91 | +Recommendations |
| 92 | +=============== |
| 93 | + |
| 94 | +The default configuration protects against excessive IO from background |
| 95 | +operations like compaction disrupting the latency of interactive operations, |
| 96 | +while maximizing the overall IO throughput devoted to those interactive |
| 97 | +requests. There are certain situations where this configuration could be |
| 98 | +sub-optimal: |
| 99 | + |
| 100 | +* An administrator may want to devote a larger portion of the overall IO |
| 101 | + bandwidth to compaction in order to stay ahead of the incoming write load. In |
| 102 | + this it may be necessary to disable the bypass for ``write`` (to help with |
| 103 | + database compaction) and/or ``view_update`` (to help with view index compaction) |
| 104 | + and then increase the ``ratio`` to give compaction a higher priority. |
| 105 | + |
| 106 | +* A server with a large number of views that do not need to be comlpetely |
| 107 | + up-to-date may benefit from removing the bypass on ``view_update`` in order to |
| 108 | + optimize the latency for regular document read and write operations, and build |
| 109 | + the views during quieter periods. |
0 commit comments