[
203
]
I'd hate to use a cliché example in order to fully illustrate this concept, but I can't
resist, so here goes. A load average on a Linux server is equivalent to the check-
out area at a supermarket. A supermarket will have several registers open, where
customers can pay to finalize their purchases and move along. In my experience,
you would have something like 20 check-out registers but only two cashiers working
at any one time, but for this example, we'll assume each register has a cashier
operating it.
Each cashier is only able to handle one customer at a time. If there are more
customers waiting to check out then there are cashiers, the lines will start to back up
and customers will get frustrated. In a situation where there are four cashiers and
four customers being helped at a time, the cashiers would be at capacity, which is not
really a big deal since no one is waiting. What can add to this problem is a customer
that is paying by check and/or using a few dozen coupons, which makes the
checkout process much longer (similar to a resource-intensive process). If there were
four cashiers and six customers waiting, then there would be two more customers
than the store is able to handle at the same time. This is essentially how load average
works. Each cashier is a CPU, and each customer is a process that needs CPU time.
Just like the cashiers, each CPU can only handle one task at a time, with some tasks
hogging the CPU longer than others. If there are exactly as many tasks as there are
CPUs, there's no cause for concern. But if the lines start to back up, we may want to
investigate what is taking so long. To take action, we may hire an additional cashier
(add a new CPU) or ask a disgruntled customer to leave (kill a process).
Let's take a look at another example load average:
1.87, 1.53, 1.22
In this situation, we shouldn't be concerned, because our hypothetical server has four
CPUs, and none of them have been at capacity within the 1-, 5-, or 15-minute time
periods. Even though the load is consistently higher than 1, we have CPU resources
to spare, so it's no big deal. If we had one of those awesome new Threadripper
CPUs from AMD, which can have 32 cores (or maybe more by the time you're
reading this), then those numbers would represent
extremely
low load. Going back
to our supermarket comparison, the load average in the previous example would be
equivalent to having four cashiers with an average of almost two customers being
assisted during any 1 minute. If this server only had one CPU, we would probably
want to figure out what's causing the line to begin to back up.
While having a low load average is usually a good thing, it can actually represent a
really big problem depending on the context. When we deploy servers, we do so to
get some sort of work done.
Monitoring System Resources
Do'stlaringiz bilan baham: |