|
| 1 | +.. Licensed to the Apache Software Foundation (ASF) under one or more contributor license |
| 2 | + agreements. See the NOTICE file distributed with this work for additional information regarding |
| 3 | + copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 |
| 4 | + (the "License"); you may not use this file except in compliance with the License. You may obtain |
| 5 | + a copy of the License at |
| 6 | +
|
| 7 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +
|
| 9 | + Unless required by applicable law or agreed to in writing, software distributed under the License |
| 10 | + is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
| 11 | + or implied. See the License for the specific language governing permissions and limitations |
| 12 | + under the License. |
| 13 | +
|
| 14 | +.. include:: ../../../../common.defs |
| 15 | + |
| 16 | +.. _admin-stats-core-eventloop: |
| 17 | + |
| 18 | +Event Loop |
| 19 | +********** |
| 20 | + |
| 21 | +The core of network processing in |TS| is the :term:`event loop`. This loop executes any pending |
| 22 | +events and performs I/O operations on network connections. The time spent in the event loop is a |
| 23 | +critical component of latency as any network connection has at most one I/O operation per loop. The |
| 24 | +general mechanism is |
| 25 | + |
| 26 | +* Dispatch any pending events. |
| 27 | + |
| 28 | +* Check for any pending I/O activity. This wait a variable amount of time. It is at most |
| 29 | + :ts:cv:`proxy.config.thread.max_heartbeat_mseconds` milliseconds. It is reduced to the amount of |
| 30 | + time until the next scheduled event. Although this is done in milliseconds, system timers are |
| 31 | + rarely that accurate. |
| 32 | + |
| 33 | +* For each network connection dispatch an event to the corresponding network virtual connection |
| 34 | + object. |
| 35 | + |
| 36 | +* Dispatch any events generated while handling I/O in the previous step |
| 37 | + |
| 38 | +Event loops that take a long time will have a noticeable impact on transaction latency. There are a |
| 39 | +number of statistics gathered to help determine if this is the problem. Because instantaneous values |
| 40 | +are not useful, the data is gathered in three different time buckets - 10, 100, and 1000 seconds. |
| 41 | +There is a parallel set of statistics for each, and each larger time period includes the smaller |
| 42 | +ones. The statistic values are all "for this time period". For example, the statistic |
| 43 | +"proxy.process.eventloop.count.100s" is "the number of event loops executed in the last 100 |
| 44 | +seconds". |
| 45 | + |
| 46 | +In general, the maximum loop time will create a floor under response latency. If that is frequently |
| 47 | +high then it is likely transactions are experiencing significant latency. |
| 48 | + |
| 49 | +.. rubric:: 10 Second Metrics |
| 50 | + |
| 51 | +.. ts:stat:: global proxy.process.eventloop.count.10s integer |
| 52 | +
|
| 53 | + Number of event loops executed in the last 10 seconds. |
| 54 | + |
| 55 | +.. ts:stat:: global proxy.process.eventloop.events.10s integer |
| 56 | +
|
| 57 | + Number of events dispatched in the last 10 seconds. |
| 58 | + |
| 59 | +.. ts:stat:: global proxy.process.eventloop.events.min.10s integer |
| 60 | +
|
| 61 | + Minimum number of events dispatched in a single loop in the last 10 seconds. |
| 62 | + |
| 63 | +.. ts:stat:: global proxy.process.eventloop.events.max.10s integer |
| 64 | +
|
| 65 | + Maximum number of events dispatched in a single loop in the last 10 seconds. |
| 66 | + |
| 67 | +.. ts:stat:: global proxy.process.eventloop.wait.10s integer |
| 68 | +
|
| 69 | + Number of loops in which the I/O activity check was done with a non-zero time out in the last 10 |
| 70 | + seconds. |
| 71 | + |
| 72 | +.. ts:stat:: global proxy.process.eventloop.time.min.10s integer |
| 73 | + :units: nanoseconds |
| 74 | + |
| 75 | + The minimum amount of time spent in a single loop in the last 10 seconds. |
| 76 | + |
| 77 | +.. ts:stat:: global proxy.process.eventloop.time.max.10s integer |
| 78 | + :units: nanoseconds |
| 79 | + |
| 80 | + The maximum amount of time spent in a single loop in the last 10 seconds. |
| 81 | + |
| 82 | +.. rubric:: 100 Second Metrics |
| 83 | + |
| 84 | +.. ts:stat:: global proxy.process.eventloop.count.100s integer |
| 85 | +
|
| 86 | + Number of event loops executed in the last 100 seconds. |
| 87 | + |
| 88 | +.. ts:stat:: global proxy.process.eventloop.events.100s integer |
| 89 | +
|
| 90 | + Number of events dispatched in the last 100 seconds. |
| 91 | + |
| 92 | +.. ts:stat:: global proxy.process.eventloop.events.min.100s integer |
| 93 | +
|
| 94 | + Minimum number of events dispatched in a single loop in the last 100 seconds. |
| 95 | + |
| 96 | +.. ts:stat:: global proxy.process.eventloop.events.max.100s integer |
| 97 | +
|
| 98 | + Maximum number of events dispatched in a single loop in the last 100 seconds. |
| 99 | + |
| 100 | +.. ts:stat:: global proxy.process.eventloop.wait.100s integer |
| 101 | +
|
| 102 | + Number of loops in which the I/O activity check was done with a non-zero time out in the last 100 |
| 103 | + seconds. |
| 104 | + |
| 105 | +.. ts:stat:: global proxy.process.eventloop.time.min.100s integer |
| 106 | + :units: nanoseconds |
| 107 | + |
| 108 | + The minimum amount of time spent in a single loop in the last 100 seconds. |
| 109 | + |
| 110 | +.. ts:stat:: global proxy.process.eventloop.time.max.100s integer |
| 111 | + :units: nanoseconds |
| 112 | + |
| 113 | + The maximum amount of time spent in a single loop in the last 100 seconds. |
| 114 | + |
| 115 | +.. rubric:: 1000 Second Metrics |
| 116 | + |
| 117 | +.. ts:stat:: global proxy.process.eventloop.count.1000s integer |
| 118 | +
|
| 119 | + Number of event loops executed in the last 1000 seconds. |
| 120 | + |
| 121 | +.. ts:stat:: global proxy.process.eventloop.events.1000s integer |
| 122 | +
|
| 123 | + Number of events dispatched in the last 1000 seconds. |
| 124 | + |
| 125 | +.. ts:stat:: global proxy.process.eventloop.events.min.1000s integer |
| 126 | +
|
| 127 | + Minimum number of events dispatched in a single loop in the last 1000 seconds. |
| 128 | + |
| 129 | +.. ts:stat:: global proxy.process.eventloop.events.max.1000s integer |
| 130 | +
|
| 131 | + Maximum number of events dispatched in a single loop in the last 1000 seconds. |
| 132 | + |
| 133 | +.. ts:stat:: global proxy.process.eventloop.wait.1000s integer |
| 134 | +
|
| 135 | + Number of loops in which the I/O activity check was done with a non-zero time out in the last 1000 |
| 136 | + seconds. |
| 137 | + |
| 138 | +.. ts:stat:: global proxy.process.eventloop.time.min.1000s integer |
| 139 | + :units: nanoseconds |
| 140 | + |
| 141 | + The minimum amount of time spent in a single loop in the last 1000 seconds. |
| 142 | + |
| 143 | +.. ts:stat:: global proxy.process.eventloop.time.max.1000s integer |
| 144 | + :units: nanoseconds |
| 145 | + |
| 146 | + The maximum amount of time spent in a single loop in the last 1000 seconds. |
0 commit comments