AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[load-average](server)

Martin Hope
Get Schwifty
Asked: 2021-02-26 08:30:35 +0800 CST

多核系统的平均负载解释

  • 0

我试图了解我的 Debian 系统中的平均负载。我已经阅读了对显示值的一些解释,并且我了解到这个数字代表我的系统“过载”的程度。因此,0.5 的平均负载意味着我的系统可以计算两倍,而无需任何额外的延迟。平均负载为 2 意味着我的系统可以处理大约一半的负载。

我读过负载平均数应该除以系统中的处理器数。因此,2-CPU 系统上 2 的平均负载等于单 CPU 系统上 1 的平均负载。正确的?

但现在困境来了。多核系统怎么样?在这个问题上似乎存在很大的争议。大多数关于它的旧信息表明内核数不等于处理器数,因此 8 核系统上的平均负载不除以内核数。也有很多较新的文章说,核心数大致对应于CPU的数量,所以负载平均值应该除以核心数。

什么信息是对的?

我可能会用这个来回答我自己的问题,因为我附上了我的系统的屏幕截图,它有 8 个内核,其中只有一个是 100% 使用的——我的平均负载是 1.02。因此,这看起来应该将负载平均值除以内核数,以获得有关系统负载的相关信息。我对吗?

平均负载

central-processing-unit debian multi-core load-average htop
  • 2 个回答
  • 416 Views
Martin Hope
Mat
Asked: 2020-08-27 23:13:52 +0800 CST

ZFS:arc_prune 正在使用 100% 的 CPU,平均负载较高

  • 1

我有一个带有两个 ZFS raidz1 池的4 磁盘存储服务器,昨晚它突然开始以100% CPU运行,平均负载很高:

root@stg1:~# w
 07:05:48 up 296 days, 17:19,  1 user,  load average: 27.06, 25.49, 24.74
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT

我有许多正在消耗大量 CPU 的 arc_prune 进程:

arc_prune 使用大量 CPU

我的zfs_arc_max大小是默认大小(应该是系统 RAM 的 50%),实际上它使用的大小不超过 16 Gb:

------------------------------------------------------------------------
ZFS Subsystem Report                Thu Aug 27 07:09:34 2020
ARC Summary: (HEALTHY)
    Memory Throttle Count:          0

ARC Misc:
    Deleted:                567.62m
    Mutex Misses:               10.46m
    Evict Skips:                10.46m

ARC Size:               102.63% 15.99   GiB
    Target Size: (Adaptive)     100.00% 15.58   GiB
    Min Size (Hard Limit):      6.25%   996.88  MiB
    Max Size (High Water):      16:1    15.58   GiB

ARC Size Breakdown:
    Recently Used Cache Size:   56.67%  9.06    GiB
    Frequently Used Cache Size: 43.33%  6.93    GiB

ARC Hash Breakdown:
    Elements Max:               1.48m
    Elements Current:       21.99%  325.26k
    Collisions:             62.96m
    Chain Max:              6
    Chains:                 12.66k

ARC Total accesses:                 36.36b
    Cache Hit Ratio:        81.78%  29.74b
    Cache Miss Ratio:       18.22%  6.62b
    Actual Hit Ratio:       81.55%  29.65b

    Data Demand Efficiency:     89.52%  598.92m
    Data Prefetch Efficiency:   22.19%  7.58m

    CACHE HITS BY CACHE LIST:
      Anonymously Used:     0.18%   53.22m
      Most Recently Used:       2.05%   608.89m
      Most Frequently Used:     97.66%  29.04b
      Most Recently Used Ghost: 0.05%   14.79m
      Most Frequently Used Ghost:   0.06%   17.72m

    CACHE HITS BY DATA TYPE:
      Demand Data:          1.80%   536.16m
      Prefetch Data:        0.01%   1.68m
      Demand Metadata:      97.83%  29.09b
      Prefetch Metadata:        0.36%   107.49m

    CACHE MISSES BY DATA TYPE:
      Demand Data:          0.95%   62.77m
      Prefetch Data:        0.09%   5.89m
      Demand Metadata:      97.10%  6.43b
      Prefetch Metadata:        1.87%   123.70m


DMU Prefetch Efficiency:                    12.04b
    Hit Ratio:          1.04%   124.91m
    Miss Ratio:         98.96%  11.92b



ZFS Tunable:
    zfs_arc_p_min_shift                               0
    zfs_checksums_per_second                          20
    zvol_request_sync                                 0
    zfs_object_mutex_size                             64
    spa_slop_shift                                    5
    zfs_sync_taskq_batch_pct                          75
    zfs_vdev_async_write_max_active                   10
    zfs_multilist_num_sublists                        0
    zfs_no_scrub_prefetch                             0
    zfs_vdev_sync_read_min_active                     10
    zfs_dmu_offset_next_sync                          0
    metaslab_debug_load                               0
    zfs_vdev_mirror_rotating_seek_inc                 5
    zfs_vdev_mirror_non_rotating_inc                  0
    zfs_read_history                                  0
    zfs_multihost_history                             0
    zfs_metaslab_switch_threshold                     2
    metaslab_fragmentation_factor_enabled             1
    zfs_admin_snapshot                                1
    zfs_delete_blocks                                 20480
    zfs_arc_meta_prune                                10000
    zfs_free_min_time_ms                              1000
    zfs_dedup_prefetch                                0
    zfs_txg_history                                   0
    zfs_vdev_max_active                               1000
    zfs_vdev_sync_write_min_active                    10
    spa_load_verify_data                              1
    zfs_dirty_data_max_max                            4294967296
    zfs_send_corrupt_data                             0
    zfs_scan_min_time_ms                              1000
    dbuf_cache_lowater_pct                            10
    zfs_send_queue_length                             16777216
    dmu_object_alloc_chunk_shift                      7
    zfs_arc_shrink_shift                              0
    zfs_resilver_min_time_ms                          3000
    zfs_free_bpobj_enabled                            1
    zfs_vdev_mirror_non_rotating_seek_inc             1
    zfs_vdev_cache_max                                16384
    ignore_hole_birth                                 1
    zfs_multihost_fail_intervals                      5
    zfs_arc_sys_free                                  0
    zfs_sync_pass_dont_compress                       5
    zio_taskq_batch_pct                               75
    zfs_arc_meta_limit_percent                        75
    zfs_arc_p_dampener_disable                        1
    spa_load_verify_metadata                          1
    dbuf_cache_hiwater_pct                            10
    zfs_read_chunk_size                               1048576
    zfs_arc_grow_retry                                0
    metaslab_aliquot                                  524288
    zfs_vdev_async_read_min_active                    1
    zfs_vdev_cache_bshift                             16
    metaslab_preload_enabled                          1
    l2arc_feed_min_ms                                 200
    zfs_scrub_delay                                   4
    zfs_read_history_hits                             0
    zfetch_max_distance                               8388608
    send_holes_without_birth_time                     1
    zfs_max_recordsize                                1048576
    zfs_dbuf_state_index                              0
    dbuf_cache_max_bytes                              104857600
    zfs_zevent_cols                                   80
    zfs_no_scrub_io                                   0
    zil_slog_bulk                                     786432
    spa_asize_inflation                               24
    l2arc_write_boost                                 8388608
    zfs_arc_meta_limit                                0
    zfs_deadman_enabled                               1
    zfs_abd_scatter_enabled                           1
    zfs_vdev_async_write_active_min_dirty_percent     30
    zfs_free_leak_on_eio                              0
    zfs_vdev_cache_size                               0
    zfs_vdev_write_gap_limit                          4096
    l2arc_headroom                                    2
    zfs_per_txg_dirty_frees_percent                   30
    zfs_compressed_arc_enabled                        1
    zfs_scan_ignore_errors                            0
    zfs_resilver_delay                                2
    zfs_metaslab_segment_weight_enabled               1
    zfs_dirty_data_max_max_percent                    25
    zio_dva_throttle_enabled                          1
    zfs_vdev_scrub_min_active                         1
    zfs_arc_average_blocksize                         8192
    zfs_vdev_queue_depth_pct                          1000
    zfs_multihost_interval                            1000
    zio_requeue_io_start_cut_in_line                  1
    spa_load_verify_maxinflight                       10000
    zfetch_max_streams                                8
    zfs_multihost_import_intervals                    10
    zfs_mdcomp_disable                                0
    zfs_zevent_console                                0
    zfs_sync_pass_deferred_free                       2
    zfs_nocacheflush                                  0
    zfs_arc_dnode_limit                               0
    zfs_delays_per_second                             20
    zfs_dbgmsg_enable                                 0
    zfs_scan_idle                                     50
    zfs_vdev_raidz_impl                               [fastest] original scalar
    zio_delay_max                                     30000
    zvol_threads                                      32
    zfs_vdev_async_write_min_active                   2
    zfs_vdev_sync_read_max_active                     10
    l2arc_headroom_boost                              200
    zfs_sync_pass_rewrite                             2
    spa_config_path                                   /etc/zfs/zpool.cache
    zfs_pd_bytes_max                                  52428800
    zfs_dirty_data_sync                               67108864
    zfs_flags                                         0
    zfs_deadman_checktime_ms                          5000
    zfs_dirty_data_max_percent                        10
    zfetch_min_sec_reap                               2
    zfs_mg_noalloc_threshold                          0
    zfs_arc_meta_min                                  0
    zvol_prefetch_bytes                               131072
    zfs_deadman_synctime_ms                           1000000
    zfs_autoimport_disable                            1
    zfs_arc_min                                       0
    l2arc_noprefetch                                  1
    zfs_nopwrite_enabled                              1
    l2arc_feed_again                                  1
    zfs_vdev_sync_write_max_active                    10
    zfs_prefetch_disable                              0
    zfetch_array_rd_sz                                1048576
    zfs_metaslab_fragmentation_threshold              70
    l2arc_write_max                                   8388608
    zfs_dbgmsg_maxsize                                4194304
    zfs_vdev_read_gap_limit                           32768
    zfs_delay_min_dirty_percent                       60
    zfs_recv_queue_length                             16777216
    zfs_vdev_async_write_active_max_dirty_percent     60
    metaslabs_per_vdev                                200
    zfs_arc_lotsfree_percent                          10
    zfs_immediate_write_sz                            32768
    zil_replay_disable                                0
    zfs_vdev_mirror_rotating_inc                      0
    zvol_volmode                                      1
    zfs_arc_meta_strategy                             1
    dbuf_cache_max_shift                              5
    metaslab_bias_enabled                             1
    zfs_vdev_async_read_max_active                    3
    l2arc_feed_secs                                   1
    zfs_arc_max                                       0
    zfs_zevent_len_max                                256
    zfs_free_max_blocks                               100000
    zfs_top_maxinflight                               32
    zfs_arc_meta_adjust_restarts                      4096
    l2arc_norw                                        0
    zfs_recover                                       0
    zvol_inhibit_dev                                  0
    zfs_vdev_aggregation_limit                        131072
    zvol_major                                        230
    metaslab_debug_unload                             0
    metaslab_lba_weighting_enabled                    1
    zfs_txg_timeout                                   5
    zfs_arc_min_prefetch_lifespan                     0
    zfs_vdev_scrub_max_active                         2
    zfs_vdev_mirror_rotating_seek_offset              1048576
    zfs_arc_pc_percent                                0
    zfs_vdev_scheduler                                noop
    zvol_max_discard_blocks                           16384
    zfs_arc_dnode_reduce_percent                      10
    zfs_dirty_data_max                                3344961536
    zfs_abd_scatter_max_order                         10
    zfs_expire_snapshot                               300
    zfs_arc_dnode_limit_percent                       10
    zfs_delay_scale                                   500000
    zfs_mg_fragmentation_threshold                    85

这些是我的 ZFS 池:

root@stg1:~# zpool status
  pool: bpool
 state: ONLINE
status: Some supported features are not enabled on the pool. The pool can
    still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
    the pool may no longer be accessible by software that does not support
    the features. See zpool-features(5) for details.
  scan: scrub repaired 0B in 0h0m with 0 errors on Sun Aug  9 00:24:06 2020
config:

    NAME                                         STATE     READ WRITE CKSUM
    bpool                                        ONLINE       0     0     0
      raidz1-0                                   ONLINE       0     0     0
        ata-HGST_HUH721010ALE600_JEJRYJ7N-part3  ONLINE       0     0     0
        ata-HGST_HUH721010ALE600_JEKELZTZ-part3  ONLINE       0     0     0
        ata-HGST_HUH721010ALE600_JEKEW7PZ-part3  ONLINE       0     0     0
        ata-HGST_HUH721010ALE600_JEKG492Z-part3  ONLINE       0     0     0

errors: No known data errors

  pool: rpool
 state: ONLINE
  scan: scrub repaired 0B in 7h34m with 0 errors on Sun Aug  9 07:58:40 2020
config:

    NAME                                         STATE     READ WRITE CKSUM
    rpool                                        ONLINE       0     0     0
      raidz1-0                                   ONLINE       0     0     0
        ata-HGST_HUH721010ALE600_JEJRYJ7N-part4  ONLINE       0     0     0
        ata-HGST_HUH721010ALE600_JEKELZTZ-part4  ONLINE       0     0     0
        ata-HGST_HUH721010ALE600_JEKEW7PZ-part4  ONLINE       0     0     0
        ata-HGST_HUH721010ALE600_JEKG492Z-part4  ONLINE       0     0     0

errors: No known data errors

驱动器是 SATA,不幸的是我无法添加任何缓存 SSD 设备。

我能做些什么来释放一些 CPU 吗?

zfs cpu-usage load-average
  • 1 个回答
  • 2377 Views
Martin Hope
faultintolerant
Asked: 2020-06-25 11:59:32 +0800 CST

是否有一个 linux 工具可以每 x 秒打印一次平均负载和 CPU 空闲百分比?

  • 2

我似乎找不到在终端窗口中每 X 秒打印一次 LOAD AVERAGE 和 CPU PERCENT IDLE 的工具。我正在寻找类似 vmstat 的东西,但上面显示的这两个值。

terminal cpu-usage load-average
  • 2 个回答
  • 284 Views
Martin Hope
Miloš Đakonović
Asked: 2016-10-06 06:11:34 +0800 CST

Apache 越来越多地消耗资源,直到重新启动

  • 0

我的apache2( Ubuntu 12.04) 在某些(可变的)时间段内出现了异常的系统资源利用率。我很肯定我没有那么多流量,而且 dos/ddos 几乎不在列表中,因为没有 web 服务器重新启动可以对 dos/ddos 做任何事情。

有什么症状?

系统负载(uptime命令)显示2- 2.5- 3。在 8 核机器上,通常的负载永远不会超过,0.8除非发生其他事情,通常是0.1- 0.2。

top命令证明apache是罪魁祸首。

为什么我对可容忍的系统负载很重视?

似乎磁盘 I/O 也增加了(温度升高了 2-3 摄氏度),我宁愿避免这种情况,因为两个硬盘都有好几年了。而且我不知道这是怎么回事。

配置文件/etc/apache2/apache2.conf(删除大注释):

#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
LockFile ${APACHE_LOCK_DIR}/accept.lock

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
# This needs to be set in /etc/apache2/envvars
#
PidFile ${APACHE_PID_FILE}

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 5

##
## Server-Pool Size Regulation (MPM specific)
##

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadLimit: ThreadsPerChild can be changed to this maximum value during a
#              graceful restart. ThreadLimit can only be changed by stopping
#              and starting Apache.
# ThreadsPerChild: constant number of worker threads in each server process
# MaxClients: maximum number of simultaneous client connections
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_worker_module>
    StartServers          2
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadLimit          64
    ThreadsPerChild      25
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

# event MPM
# StartServers: initial number of server processes to start
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxClients: maximum number of simultaneous client connections
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_event_module>
    StartServers          2
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadLimit          64
    ThreadsPerChild      25
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

#
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives.  See also the AllowOverride
# directive.
#

AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy all
</Files>

#
# DefaultType is the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value.  If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
# It is also possible to omit any default MIME type and let the
# client's browser guess an appropriate action instead. Typically the
# browser will decide based on the file's extension then. In cases
# where no good assumption can be made, letting the default MIME type
# unset is suggested  instead of forcing the browser to accept
# incorrect  metadata.
#
DefaultType None


#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog ${APACHE_LOG_DIR}/error.log

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

# Include module configuration:
Include mods-enabled/*.load
Include mods-enabled/*.conf

# Include all the user configurations:
Include httpd.conf

# Include ports listing
Include ports.conf

#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
# If you are behind a reverse proxy, you might want to change %h into %{X-Forwarded-For}i
#
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.

# Include generic snippets of statements
Include conf.d/

# Include the virtual host configurations:
Include sites-enabled/



<IfModule mod_spamhaus.c>
  MS_METHODS POST,PUT,OPTIONS,CONNECT
  MS_WhiteList /etc/spamhaus.wl
  MS_CacheSize 256
</IfModule>

加载的模块:

 core_module (static)
 log_config_module (static)
 logio_module (static)
 mpm_prefork_module (static)
 http_module (static)
 so_module (static)
 alias_module (shared)
 auth_basic_module (shared)
 authn_file_module (shared)
 authz_default_module (shared)
 authz_groupfile_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 cgi_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 headers_module (shared)
 mime_module (shared)
 evasive20_module (shared)
 negotiation_module (shared)
 php5_module (shared)
 qos_module (shared)
 reqtimeout_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 ssl_module (shared)
 status_module (shared)
 unique_id_module (shared)
Syntax OK

任何帮助表示赞赏。

performance apache-2.2 web-server high-load load-average
  • 1 个回答
  • 100 Views
Martin Hope
Alexis Wilke
Asked: 2016-09-17 12:42:08 +0800 CST

HAProxy 是否可以确定后端服务器的负载并避免向负载高的服务器发送请求?

  • 2

我想知道知道每个后端服务器的 loadavg 是否会有优势,并要求 HAProxy 将下一个请求发送到 loadavg 最低的计算机。

但是,我还没有看到任何可以在 HAProxy 中提供这种功能的东西。也许它不可用?

我发现这篇文章显示了一个带有use_backend命令的前端定义,但我认为地图将被加载一次并在 HAProxy 运行的整个持续时间内缓存。否则,通过 loadavg 动态更改对项目进行排序的地图不会有任何区别......

frontend ft_items
  [...]
  use_backend %[path,lower,map(/etc/haproxy/items.map,bk_default)]

我不清楚轮询对我的应用程序是否足够好,因为有些请求需要 50 毫秒(图像、CSS 等),而其他请求可能需要 2 秒(大型报告)。因此,检查计算机的 loadavg 似乎更符合此应用程序的要求。

load-balancing haproxy load-average
  • 2 个回答
  • 2789 Views
Martin Hope
terdon
Asked: 2016-04-19 09:37:45 +0800 CST

如何根据可用内核数选择最大负载阈值?

  • 5

我有一个在 Linux 机器上运行一些计算密集型任务的管道。启动这些的脚本会检查当前的平均负载,如果它高于某个阈值,则等待直到负载低于该阈值。这是在 Ubuntu 虚拟机上(如果相关,则在 Ubuntu 主机上运行),它可以分配可变数量的内核。我们的开发和生产机器都是运行在同一物理服务器上的虚拟机,我们根据需要手动为每个虚拟机分配内核。

我注意到,即使虚拟机只有 20 个内核,大约 60 个内核的负载也不会使机器瘫痪。我对Linux 平均负载的工作原理的理解是,任何超过 CPU 数量的东西都表明存在问题,但显然事情并没有那么清楚。

我正在考虑将阈值设置为$(grep -c processor /proc/cpuinfo) x Nwhere N>=1。是否有任何聪明的方法来确定N应该采取的价值以最大化性能和最小化延迟?

换句话说,在性能开始下降之前,我如何知道机器可以支持的最大平均负载?我天真地期望这是 CPU 的数量(所以,N=1),但这似乎并不成立。由于内核的数量可能会有所不同,因此测试可能的组合既复杂又耗时,而且由于这是由不同人使用的机器,因此不切实际。

那么,如何根据可用内核数确定可接受的最大平均负载阈值?

performance linux load-average
  • 2 个回答
  • 2762 Views
Martin Hope
Glasnhost
Asked: 2014-10-09 10:24:12 +0800 CST

Nagios 基础:理解 check_load 图

  • 3

我的数据库服务器(一个 cpu 虚拟机)由 Nagios 监控。

我没有使用 Nagios 的经验,也无法理解这张图:

  • 纵轴的单位是什么?
  • 和平均值?什么是“米”?

check_load_average

load-average
  • 1 个回答
  • 4072 Views
Martin Hope
James
Asked: 2012-06-03 18:06:16 +0800 CST

是什么导致异常高的平均负载?

  • 7

我注意到上周周二晚上,平均负载急剧上升,似乎不正常,因为流量很小。通常,这些数字通常平均在 0.40 左右或更低,并且我的服务器内容(mysql、php 和 apache)都经过了优化。我注意到 IOWait 异常高,即使进程几乎没有使用任何 CPU。

顶部 - 01:44:39 up 1 day, 21:13, 1 user, load average: 1.41, 1.09, 0.86
任务:总共60个,1个跑步,59个睡觉,0个停止,0个僵尸
CPU0:0.0%us、0.0%sy、0.0%ni、100.0%id、0.0%wa、0.0%hi、0.0%si、0.0%st
CPU1:0.0%us、0.0%sy、0.0%ni、100.0%id、0.0%wa、0.0%hi、0.0%si、0.0%st
CPU2:0.0%us、0.3%sy、0.0%ni、99.7%id、0.0%wa、0.0%hi、0.0%si、0.0%st
CPU3:0.0%us、0.0%sy、0.0%ni、100.0%id、0.0%wa、0.0%hi、0.0%si、0.0%st
CPU4:0.0%us、0.0%sy、0.0%ni、100.0%id、0.0%wa、0.0%hi、0.0%si、0.0%st
CPU5:0.0%us、0.0%sy、0.0%ni、100.0%id、0.0%wa、0.0%hi、0.0%si、0.0%st
CPU6:0.0%us、0.0%sy、0.0%ni、100.0%id、0.0%wa、0.0%hi、0.0%si、0.0%st
CPU7:0.0%us、0.0%sy、0.0%ni、91.5%id、8.5%wa、0.0%hi、0.0%si、0.0%st
内存:总计 1048576k,已使用 331944k,空闲 716632k,缓冲区 0k
Swap: 0k total, 0k used, 0k free, 0k cached

  PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ 命令           
    1 根 15 0 2468 1376 1140 S 0 0.1 0:00.92 初始化               
 1656 根 15 0 13652 5212 664 S 0 0.5 0:00.00 apache2            
 9323 根 18 0 13652 5212 664 S 0 0.5 0:00.00 apache2            
10079 根 18 0 3972 1248 972 S 0 0.1 0:00.00 苏                 
10080 根 15 0 4612 1956 1448 S 0 0.2 0:00.01 bash               
11298 根 15 0 13652 5212 664 S 0 0.5 0:00.00 apache2            
11778 菊苣 15 0 2344 1092 884 S 0 0.1 0:00.05 顶部                
15384 根 18 0 17544 13m 1568 S 0 1.3 0:02.28 miniserv.pl        
15585 根 15 0 8280 2736 2168 S 0 0.3 0:00.02 sshd               
15608 菊苣 15 0 8280 1436 860 S 0 0.1 0:00.02 sshd      

这是 VMStat

procs ----------memory------------ ---swap-- -----io---- -system-- ----cpu-- --
 rb swpd 免费 buff 缓存 si so bi bo in cs us sy id wa
 1 0 0 768644 0 0 0 0 14 23 0 10 1 0 99 0

IOStat - 没有异常

总磁盘读取:67.13 K/s | 总磁盘写入:0.00 B/s
  TID PRIO 用户磁盘读取磁盘写入交换 IO> 命令          
19496 be/4 chikorit 11.85 K/s 0.00 B/s 0.00 % 0.00 % apache2 -k 启动
19501 be/4 mysql 3.95 K/s 0.00 B/s 0.00 % 0.00 % mysqld
19568 be/4 chikorit 11.85 K/s 0.00 B/s 0.00 % 0.00 % apache2 -k 启动
19569 be/4 chikorit 11.85 K/s 0.00 B/s 0.00 % 0.00 % apache2 -k 启动
19570 be/4 chikorit 11.85 K/s 0.00 B/s 0.00 % 0.00 % apache2 -k 启动
19571 be/4 chikorit 7.90 K/s 0.00 B/s 0.00 % 0.00 % apache2 -k 启动
19573 be/4 chikorit 7.90 K/s 0.00 B/s 0.00 % 0.00 % apache2 -k 启动
    1 be/4 根 0.00 B/s 0.00 B/s 0.00 % 0.00 % 初始化
11778 be/4 菊苣 0.00 B/s 0.00 B/s 0.00 % 0.00 % 顶部
19470 be/4 mysql 0.00 B/s 0.00 B/s 0.00 % 0.00 % mysqld

平均负载图表 - http://i.stack.imgur.com/kYsD0.png

在确定之前,我想确定这是否是 MySQL 的问题。此外,这是 OpenVZ 上的 Ubuntu 10.04 LTS 服务器。

编辑:这可能会给 IO Wait 一个很好的画面

顶部 - 22:12:22 到 17:41,1 个用户,平均负载:1.10、1.09、0.93
任务:共33个,1个跑,32个睡,0个停止,0个丧尸
中央处理器:0.6%us、0.2%sy、0.0%ni、89.0%id、10.1%wa、0.0%hi、0.0%si、0.0%st
内存:总计 1048576k,已使用 260708k,空闲 787868k,缓冲区 0k
Swap: 0k total, 0k used, 0k free, 0k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ 命令
1 根 15 0 2468 1376 1140 S 0 0.1 0:00.88 初始化
5849 根 15 0 12336 4028 668 S 0 0.4 0:00.00 apache2
8063 根 15 0 12336 4028 668 S 0 0.4 0:00.00 apache2
9732 根 16 0 8280 2728 2168 S 0 0.3 0:00.02 sshd
9746 菊苣 18 0 8412 1444 864 S 0 0.1 0:01.10 sshd
9747 菊苣 18 0 4576 1960 1488 S 0 0.2 0:00.24 bash
13706 菊苣 15 0 2344 1088 884 R 0 0.1 0:00.03 顶部
15745 菊苣 15 0 12968 5108 1280 S 0 0.5 0:00.00 apache2
15751 菊苣 15 0 72184 25m 18m S 0 2.5 0:00.37 php5-fpm
15790 菊苣 18 0 12472 4640 1192 S 0 0.4 0:00.00 apache2
15797 菊苣 15 0 72888 23m 16m S 0 2.3 0:00.06 php5-fpm
16038 根 15 0 67772 2848 592 D 0 0.3 0:00.00 php5-fpm
16309 系统日志 18 0 24084 1316 992 S 0 0.1 0:00.07 rsyslogd
16316 根 15 0 5472 908 500 S 0 0.1 0:00.00 sshd
16326 根 15 0 2304 908 712 S 0 0.1 0:00.02 cron
17464 根 15 0 10252 7560 856 D 0 0.7 0:01.88 psad
17466 根 18 0 1684 276 208 S 0 0.0 0:00.31 psadwatchd
17559 root 18 0 11444 2020 732 S 0 0.2 0:00.47 sendmail-mta
17688 根 15 0 10252 5388 1136 S 0 0.5 0:03.81 蟒蛇
17752 teamspea 19 0 44648 7308 4676 S 0 0.7 1:09.70 ts3server_linux
18098 根 15 0 12336 6380 3032 S 0 0.6 0:00.47 apache2
18099 菊苣 18 0 10368 2536 464 S 0 0.2 0:00.00 apache2
18120 ntp 15 0 4336 1316 984 S 0 0.1 0:00.87 ntpd
18379 根 15 0 12336 4028 668 S 0 0.4 0:00.00 apache2
18387 mysql 15 0 62796 36m 5864 S 0 3.6 1:43.26 mysqld
19584 根 15 0 12336 4028 668 S 0 0.4 0:00.02 apache2
22498 根 16 0 12336 4028 668 S 0 0.4 0:00.00 apache2
24260 根 15 0 67772 3612 1356 S 0 0.3 0:00.22 php5-fpm
27712 根 15 0 12336 4028 668 S 0 0.4 0:00.00 apache2
27730 根 15 0 12336 4028 668 S 0 0.4 0:00.00 apache2
30343 根 15 0 12336 4028 668 S 0 0.4 0:00.00 apache2
30366 根 15 0 12336 4028 668 S 0 0.4 0:00.00 apache2

这是今天的免费内存。

             缓存的已用空闲共享缓冲区总数
内存:1024 302 721 0 0 0
-/+ 缓冲区/缓存:302 721
交换:0 0 0

更新:查看日志,尤其是导致 CPU 峰值的 PHP5-FPM。我发现它的段由于某些明显的原因而出错。

[03-Jun-2012 06:11:20] 注意:[pool www] child 14132 started
[03-Jun-2012 06:11:25] 警告:[pool www] child 13664 在开始 53.686322 秒后退出信号 11 (SIGSEGV)
[03-Jun-2012 06:11:25] 注意:[pool www] child 14328 已启动
[03-Jun-2012 06:11:25] 警告:[pool www] child 14132 在开始 4.708681 秒后退出信号 11 (SIGSEGV)
[03-Jun-2012 06:11:25] 注意:[pool www] child 14329 started
[03-Jun-2012 06:11:58] 警告:[pool www] child 14328 在开始 32.981228 秒后退出信号 11 (SIGSEGV)
[03-Jun-2012 06:11:58] 注意:[pool www] child 15745 started
[03-Jun-2012 06:12:25] 警告:[pool www] child 15745 在开始 27.442864 秒后退出信号 11 (SIGSEGV)
[03-Jun-2012 06:12:25] 注意:[pool www] child 17446 started
[03-Jun-2012 06:12:25] 警告:[pool www] child 14329 在开始 60.411278 秒后退出信号 11 (SIGSEGV)
[03-Jun-2012 06:12:25] 注意:[pool www] child 17447 已启动
[03-Jun-2012 06:13:02] 警告:[pool www] child 17446 在开始 36.746793 秒后退出信号 11 (SIGSEGV)
[03-Jun-2012 06:13:02] 注意:[pool www] child 18133 started
[03-Jun-2012 06:13:48] 警告:[pool www] child 17447 在开始 82.710107 秒后退出信号 11 (SIGSEGV)

我认为这可能是导致问题的原因。如果这是原因,可能将其关闭到 fastcgi/fcgid 可能会解决它......但是,我仍然想看看是否有其他原因可能导致它这样做。

iowait load-average
  • 4 个回答
  • 10092 Views
Martin Hope
Mike B
Asked: 2010-03-04 18:11:58 +0800 CST

关于平均负载过高时 SendMail 守护程序操作的问题

  • 4

我的 sendmail 服务器开始拒绝连接,因为平均负载太高(由于垃圾邮件问题已经解决)。

Error was: sendmail[13400]: rejecting connections on daemon MTA: load average: 50

不过,我想更好地理解这种行为。

  • 这个阈值设置在哪里?
  • “平均负载”是什么意思?
  • 平均负载多久计算一次?
  • 有没有办法主动监控这个?还是在平均负载接近高值时发出警报?显然 sendmail 会给连接的 MTA 一个 4.0.0 类 dsn,但我正在寻找某种警报机制。

谢谢,

米


嗨,大家好,

当我看到它再次出现时,我以为我会再撞一次。我现在看到的问题是,由于超过平均负载而排队的消息以后不会重新发送(即使在性能恢复到可接受的水平之后。知道为什么会这样吗?

谢谢,

米

linux smtp sendmail load-average dsn
  • 1 个回答
  • 20839 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve