내 잡다한 노트

모니터링 방법론 본문

DevOps/SRE

모니터링 방법론

peanutwalnut 2024. 9. 8. 18:50

모니터링 방법론

USE method

https://www.brendangregg.com/usemethod.html

For every resource, check utilization, saturation, and erros.

resource

  • CPU : sockets, cores, hardware threads ( virtual CPUs )
  • memory : capacity
  • network interface
  • storage devices : I/O, capacity
  • Controllers: storage, network cards
  • Interconnects: CPU, memory, I/O
  • Utilization (이용률): the average time that the resource was busy servicing work
  • Saturation (포화 상태): the degree to which the resource has extra work which it can’t service, often queuedcpu 대기열, 디스크 I/O 대기열, 네트워크 대기열
  • container cpu throttling, cpu i/o wait load, network bandwidth, busting
  • Errors : the count of error events
  • http 5xx error , 디스크 I/O 오류, 네트워크 패킷 손실,

RED method

https://www.youtube.com/watch?v=TJLpYXbnfQ4

  • Rate : the number of requests per second
  • Errors : the number of those requests that are failing
  • Duration : the amount of time those requests take

Google SRE

https://sre.google/sre-book/monitoring-distributed-systems/

The Four Golden Signals

The four golden signals of monitoring are latency, traffic, errors, and saturation. If you can only measure four metrics of your user-facing system, focus on these four.

Latency

The time it takes to service a request. It’s important to distinguish between the latency of successful requests and the latency of failed requests. For example, an HTTP 500 error triggered due to loss of connection to a database or other critical backend might be served very quickly; however, as an HTTP 500 error indicates a failed request, factoring 500s into your overall latency might result in misleading calculations. On the other hand, a slow error is even worse than a fast error! Therefore, it’s important to track error latency, as opposed to just filtering out errors.


Traffic

A measure of how much demand is being placed on your system, measured in a high-level system-specific metric. For a web service, this measurement is usually HTTP requests per second, perhaps broken out by the nature of the requests (e.g., static versus dynamic content). For an audio streaming system, this measurement might focus on network I/O rate or concurrent sessions. For a key-value storage system, this measurement might be transactions and retrievals per second.

Errors

The rate of requests that fail, either explicitly (e.g., HTTP 500s), implicitly (for example, an HTTP 200 success response, but coupled with the wrong content), or by policy (for example, "If you committed to one-second response times, any request over one second is an error"). Where protocol response codes are insufficient to express all failure conditions, secondary (internal) protocols may be necessary to track partial failure modes. Monitoring these cases can be drastically different: catching HTTP 500s at your load balancer can do a decent job of catching all completely failed requests, while only end-to-end system tests can detect that you’re serving the wrong content.


Saturation

How "full" your service is. A measure of your system fraction, emphasizing the resources that are most constrained (e.g., in a memory-constrained system, show memory; in an I/O-constrained system, show I/O). Note that many systems degrade in performance before they achieve 100% utilization, so having a utilization target is essential.In complex systems, saturation can be supplemented with higher-level load measurement: can your service properly handle double the traffic, handle only 10% more traffic, or handle even less traffic than it currently receives? For very simple services that have no parameters that alter the complexity of the request (e.g., "Give me a nonce" or "I need a globally unique monotonic integer") that rarely change configuration, a static value from a load test might be adequate. As discussed in the previous paragraph, however, most services need to use indirect signals like CPU utilization or network bandwidth that have a known upper bound. Latency increases are often a leading indicator of saturation. Measuring your 99th percentile response time over some small window (e.g., one minute) can give a very early signal of saturation.Finally, saturation is also concerned with predictions of impending saturation, such as "It looks like your database will fill its hard drive in 4 hours."

If you measure all four golden signals and page a human when one signal is problematic (or, in the case of saturation, nearly problematic), your service will be at least decently covered by monitoring.