Apache 服务器冻结,直到重新启动

Apache 服务器冻结,直到重新启动

我有一台来自 Hetzner 数据中心的专用服务器,我用它作为下载服务器(文件主机):

  • Intel® Core™ i7-2600 四核处理器,包含超线程技术
  • 32 GB DDR3 RAM
  • 100mb/s 带宽
  • Centos 6.3
  • Apache/2.2.24(Unix)

我正在使用 prefork.c 并将其设置如下:

<IfModule prefork.c>
StartServers 5
MinSpareServers 10
MaxSpareServers 15
ServerLimit 4000
MaxClients 4000
MaxRequestsPerChild 0
</IfModule>

但是当流量增加时,Apache 服务器会冻结,直到重新启动。问题出在哪里?

输出:sysctl -a

kernel.sched_child_runs_first = 0
kernel.sched_min_granularity_ns = 4000000
kernel.sched_latency_ns = 20000000
kernel.sched_wakeup_granularity_ns = 4000000
kernel.sched_tunable_scaling = 1
kernel.sched_features = 3183
kernel.sched_migration_cost = 500000
kernel.sched_nr_migrate = 32
kernel.sched_time_avg = 1000
kernel.sched_shares_window = 10000000
kernel.timer_migration = 1
kernel.sched_rt_period_us = 1000000
kernel.sched_rt_runtime_us = 950000
kernel.sched_compat_yield = 0
kernel.sched_autogroup_enabled = 0
kernel.sched_cfs_bandwidth_slice_us = 5000
kernel.panic = 0
kernel.exec-shield = 1
kernel.core_uses_pid = 1
kernel.core_pattern = |/usr/libexec/abrt-hook-ccpp %s %c %p %u %g %te
kernel.core_pipe_limit = 4
kernel.tainted = 0
kernel.real-root-dev = 0
kernel.print-fatal-signals = 0
kernel.ctrl-alt-del = 0
kernel.ftrace_enabled = 1
kernel.stack_tracer_enabled = 0
kernel.ftrace_dump_on_oops = 0
kernel.modprobe = /sbin/modprobe
kernel.modules_disabled = 0
kernel.kexec_load_disabled = 0
kernel.hotplug =
kernel.acct = 4 2 30
kernel.sysrq = 0
kernel.cad_pid = 1
kernel.threads-max = 508572
kernel.random.poolsize = 4096
kernel.random.entropy_avail = 305
kernel.random.read_wakeup_threshold = 64
kernel.random.write_wakeup_threshold = 128
kernel.random.boot_id = de5e6691-98e5-4dca-990d-310b2a0710d7
kernel.random.uuid = 83eb9637-d234-4150-b088-5092f2f41b7e
kernel.usermodehelper.bset = 4294967295 4294967295
kernel.usermodehelper.inheritable = 4294967295 4294967295
kernel.overflowuid = 65534
kernel.overflowgid = 65534
kernel.pid_max = 32768
kernel.panic_on_oops = 1
kernel.printk = 4 4 1 7
kernel.printk_ratelimit = 5
kernel.printk_ratelimit_burst = 10
kernel.printk_delay = 0
kernel.dmesg_restrict = 0
kernel.kptr_restrict = 1
kernel.ngroups_max = 65536
kernel.watchdog = 1
kernel.watchdog_thresh = 60
kernel.softlockup_panic = 0
kernel.nmi_watchdog = 1
kernel.unknown_nmi_panic = 0
kernel.panic_on_unrecovered_nmi = 0
kernel.panic_on_io_nmi = 0
kernel.bootloader_type = 113
kernel.bootloader_version = 1
kernel.kstack_depth_to_print = 12
kernel.io_delay_type = 0
kernel.randomize_va_space = 2 kernel.acpi_video_flags
= 0 kernel.hung_task_panic
= 0
kernel.hung_task_check_count = 4194304
kernel.hung_task_timeout_secs = 120
kernel.hung_task_warnings = 10
kernel.compat-log = 1
kernel.max_lock_depth = 1024
kernel.poweroff_cmd = /sbin/poweroff
kernel.keys.maxkeys = 200
kernel.keys.maxbytes = 20000
kernel.keys.root_maxkeys = 200
kernel.keys.root_maxbytes = 20000
kernel.keys.gc_delay = 300
kernel.slow-work.min-threads = 2
kernel.slow-work.max-threads = 8
kernel.slow-work.vslow-percentage = 50
kernel.perf_event_paranoid = 1
kernel.perf_event_mlock_kb = 516
kernel.perf_event_max_sample_rate = 100000
kernel.blk_iopoll = 1
kernel.sched_domain.cpu0.domain0.min_interval = 1
kernel.sched_domain.cpu0.domain0.max_interval = 2
kernel.sched_domain.cpu0.domain0.busy_idx = 0
kernel.sched_domain.cpu0.domain0.idle_idx = 0
kernel.sched_domain.cpu0.domain0.newidle_idx = 0
kernel.sched_domain.cpu0.domain0.wake_idx = 0
kernel.sched_domain.cpu0.domain0.forkexec_idx = 0
kernel.sched_domain.cpu0.domain0.busy_factor = 64
kernel.sched_domain.cpu0.domain0.imbalance_pct = 110
kernel.sched_domain.cpu0.domain0.cache_nice_tries = 0
kernel.sched_domain.cpu0.domain0.flags = 687
kernel.sched_domain.cpu0.domain0.name = SIBLING
kernel.sched_domain.cpu0.domain1.min_interval = 1
kernel.sched_domain.cpu0.domain1.max_interval = 4
kernel.sched_domain.cpu0.domain1.busy_idx = 2
kernel.sched_domain.cpu0.domain1.idle_idx = 0
kernel.sched_domain.cpu0.domain1.newidle_idx = 0
kernel.sched_domain.cpu0.domain1.wake_idx = 0
kernel.sched_domain.cpu0.domain1.forkexec_idx = 0 kernel.sched_domain.cpu0.domain1.busy_factor
= 64
kernel.sched_domain.cpu0.domain1.imbalance_pct = 125
kernel.sched_domain.cpu0.domain1.cache_nice_tries = 1
kernel.sched_domain.cpu0.domain1.flags = 4655
kernel.sched_domain.cpu0.domain1.name = MC
kernel.sched_domain.cpu1.domain0.min_interval = 1
kernel.sched_domain.cpu1.domain0.max_interval = 2
kernel.sched_domain.cpu1.domain0.busy_idx = 0
kernel.sched_domain.cpu1.domain0.idle_idx = 0
kernel.sched_domain.cpu1.domain0.newidle_idx = 0
kernel.sched_domain.cpu1.domain0.wake_idx = 0 kernel.sched_domain.cpu1.domain0.forkexec_idx
= 0
kernel.sched_domain.cpu1.domain0.busy_factor = 64
kernel.sched_domain.cpu1.domain0.imbalance_pct = 110
kernel.sched_domain.cpu1.domain0.cache_nice_tries = 0
kernel.sched_domain.cpu1.domain0.flags = 687
kernel.sched_domain.cpu1.domain0.name = SIBLING
kernel.sched_domain.cpu1.domain1.min_interval = 1
kernel.sched_domain.cpu1.domain1.max_interval = 4
kernel.sched_domain.cpu1.domain1.busy_idx = 2
kernel.sched_domain.cpu1.domain1.idle_idx = 0
kernel.sched_domain.cpu1.domain1.newidle_idx = 0 kernel.sched_domain.cpu1.domain1.wake_idx
= 0
kernel.sched_domain.cpu1.domain1.forkexec_idx = 0
kernel.sched_domain.cpu1.domain1.busy_factor = 64
kernel.sched_domain.cpu1.domain1.imbalance_pct = 125
kernel.sched_domain.cpu1.domain1.cache_nice_tries = 1
kernel.sched_domain.cpu1.domain1.flags = 4655
kernel.sched_domain.cpu1.domain1.name = MC
kernel.sched_domain.cpu2.domain0.min_interval = 1
kernel.sched_domain.cpu2.domain0.max_interval = 2
kernel.sched_domain.cpu2.domain0.busy_idx = 0
kernel.sched_domain.cpu2.domain0.idle_idx = 0 kernel.sched_domain.cpu2.domain0.newidle_idx
= 0
kernel.sched_domain.cpu2.domain0.wake_idx =
0 kernel.sched_domain.cpu2.domain0.forkexec_idx = 0
kernel.sched_domain.cpu2.domain0.busy_factor = 64
kernel.sched_domain.cpu2.domain0.imbalance_pct = 110
kernel.sched_domain.cpu2.domain0.cache_nice_tries = 0
kernel.sched_domain.cpu2.domain0.flags = 687
kernel.sched_domain.cpu2.domain0.name = SIBLING
kernel.sched_domain.cpu2.domain1.min_interval = 1
kernel.sched_domain.cpu2.domain1.max_interval = 4
kernel.sched_domain.cpu2.domain1.busy_idx = 2
kernel.sched_domain.cpu2.domain1.idle_idx = 0
kernel.sched_domain.cpu2.domain1.newidle_idx = 0
kernel.sched_domain.cpu2.domain1.wake_idx = 0
kernel.sched_domain.cpu2.domain1.forkexec_idx = 0
kernel.sched_domain.cpu2.domain1.busy_factor = 64
kernel.sched_domain.cpu2.domain1.imbalance_pct = 125
kernel.sched_domain.cpu2.domain1.cache_nice_tries = 1
kernel.sched_domain.cpu2.domain1.flags = 4655
kernel.sched_domain.cpu2.domain1.name = MC
kernel.sched_domain.cpu3.domain0.min_interval = 1
kernel.sched_domain.cpu3.domain0.max_interval = 2 kernel.sched_domain.cpu3.domain0.busy_idx
= 0
kernel.sched_domain.cpu3.domain0.idle_idx = 0
kernel.sched_domain.cpu3.domain0.newidle_idx = 0
kernel.sched_domain.cpu3.domain0.wake_idx = 0
kernel.sched_domain.cpu3.domain0.forkexec_idx = 0
kernel.sched_domain.cpu3.domain0.busy_factor = 64
kernel.sched_domain.cpu3.domain0.imbalance_pct = 110
kernel.sched_domain.cpu3.domain0.cache_nice_tries = 0
kernel.sched_domain.cpu3.domain0.flags = 687
kernel.sched_domain.cpu3.domain0.name = SIBLING
kernel.sched_domain.cpu3.domain1.min_interval = 1
kernel.sched_domain.cpu3.domain1.max_interval = 4
kernel.sched_domain.cpu3.domain1.busy_idx = 2
kernel.sched_domain.cpu3.domain1.idle_idx = 0
kernel.sched_domain.cpu3.domain1.newidle_idx = 0
kernel.sched_domain.cpu3.domain1.wake_idx = 0
kernel.sched_domain.cpu3.domain1.forkexec_idx = 0
kernel.sched_domain.cpu3.domain1.busy_factor = 64
kernel.sched_domain.cpu3.domain1.imbalance_pct = 125
kernel.sched_domain.cpu3.domain1.cache_nice_tries = 1
kernel.sched_domain.cpu3.domain1.flags = 4655
kernel.sched_domain.cpu3.domain1.name = MC
kernel.sched_domain.cpu4.domain0.min_interval = 1
kernel.sched_domain.cpu4.domain0.max_interval = 2
kernel.sched_domain.cpu4.domain0.busy_idx = 0 kernel.sched_domain.cpu4.domain0.idle_idx
= 0
kernel.sched_domain.cpu4.domain0.newidle_idx = 0
kernel.sched_domain.cpu4.domain0.wake_idx = 0
kernel.sched_domain.cpu4.domain0.forkexec_idx = 0
kernel.sched_domain.cpu4.domain0.busy_factor = 64
kernel.sched_domain.cpu4.domain0.imbalance_pct = 110
kernel.sched_domain.cpu4.domain0.cache_nice_tries = 0
kernel.sched_domain.cpu4.domain0.flags = 687
kernel.sched_domain.cpu4.domain0.name = SIBLING
kernel.sched_domain.cpu4.domain1.min_interval = 1
kernel.sched_domain.cpu4.domain1.max_interval = 4
kernel.sched_domain.cpu4.domain1.busy_idx = 2
kernel.sched_domain.cpu4.domain1.idle_idx = 0
kernel.sched_domain.cpu4.domain1.newidle_idx = 0
kernel.sched_domain.cpu4.domain1.wake_idx = 0
kernel.sched_domain.cpu4.domain1.forkexec_idx = 0
kernel.sched_domain.cpu4.domain1.busy_factor = 64
kernel.sched_domain.cpu4.domain1.imbalance_pct = 125
kernel.sched_domain.cpu4.domain1.cache_nice_tries = 1
kernel.sched_domain.cpu4.domain1.flags = 4655
kernel.sched_domain.cpu4.domain1.name = MC
kernel.sched_domain.cpu5.domain0.min_interval = 1
kernel.sched_domain.cpu5.domain0.max_interval = 2 kernel.sched_domain.cpu5.domain0.busy_idx = 0 kernel.sched_domain.cpu5.domain0.idle_idx = 0
kernel.sched_domain.cpu5.domain0.newidle_idx = 0 kernel.sched_domain.cpu5.domain0.wake_idx = 0 kernel.sched_domain.cpu5.domain0.forkexec_idx = 0 kernel.sched_domain.cpu5.domain0.busy_factor = 64 kernel.sched_domain.cpu5.domain0.imbalance_pct = 110 kernel.sched_domain.cpu5.domain0.cache_nice_tries = 0 kernel.sched_domain.cpu5.domain0.flags = 687 kernel.sched_domain.cpu5.domain0.name = SIBLING kernel.sched_domain.cpu5.domain1.min_interval = 1 kernel.sched_domain.cpu5.domain1.max_interval = 4 kernel.sched_domain.cpu5.domain1.busy_idx = 2 kernel.sched_domain.cpu5.domain1.idle_idx = 0 kernel.sched_domain.cpu5.domain1.newidle_idx = 0 kernel.sched_domain.cpu5.domain1.wake_idx = 0 kernel.sched_domain.cpu5.domain1.forkexec_idx = 0 kernel.sched_domain.cpu5.domain1.busy_factor = 64 kernel.sched_domain.cpu5.domain1.imbalance_pct = 125 kernel.sched_domain.cpu5.domain1.cache_nice_tries = 1 kernel.sched_domain.cpu5.domain1.flags = 4655 kernel.sched_domain.cpu5.domain1.name = MC kernel.sched_domain.cpu6.domain0.min_interval = 1 kernel.sched_domain.cpu6.domain0.max_interval = 2 kernel.sched_domain.cpu6.domain0.busy_idx = 0 kernel.sched_domain.cpu6.domain0.idle_idx = 0 kernel.sched_domain.cpu6.domain0.newidle_idx = 0 kernel.sched_domain.cpu6.domain0.wake_idx = 0 kernel.sched_domain.cpu6.domain0.forkexec_idx = 0 kernel.sched_domain.cpu6.domain0.busy_factor = 64 kernel.sched_domain.cpu6.domain0.imbalance_pct = 110 kernel.sched_domain.cpu6.domain0.cache_nice_tries = 0 kernel.sched_domain.cpu6.domain0.flags = 687 kernel.sched_domain.cpu6.domain0.name = SIBLING kernel.sched_domain.cpu6.domain1.min_interval = 1 kernel.sched_domain.cpu6.domain1.max_interval = 4 kernel.sched_domain.cpu6.domain1.busy_idx = 2 kernel.sched_domain.cpu6.domain1.idle_idx = 0 kernel.sched_domain.cpu6.domain1.newidle_idx = 0






































kernel.sched_domain.cpu6.domain1.wake_idx = 0
kernel.sched_domain.cpu6.domain1.forkexec_idx = 0
kernel.sched_domain.cpu6.domain1.busy_factor = 64
kernel.sched_domain.cpu6.domain1.imbalance_pct = 125
kernel.sched_domain.cpu6.domain1.cache_nice_tries = 1
kernel.sched_domain.cpu6.domain1.flags = 4655
kernel.sched_domain.cpu6.domain1.name = MC
kernel.sched_domain.cpu7.domain0.min_interval = 1
kernel.sched_domain.cpu7.domain0.max_interval = 2
kernel.sched_domain.cpu7.domain0.busy_idx = 0
kernel.sched_domain.cpu7.domain0.idle_idx = 0
kernel.sched_domain.cpu7.domain0.newidle_idx = 0
kernel.sched_domain.cpu7.domain0.wake_idx = 0
kernel.sched_domain.cpu7.domain0.forkexec_idx = 0
kernel.sched_domain.cpu7.domain0.busy_factor = 64
kernel.sched_domain.cpu7.domain0.imbalance_pct = 110
kernel.sched_domain.cpu7.domain0.cache_nice_tries = 0
kernel.sched_domain.cpu7.domain0.flags = 687
kernel.sched_domain.cpu7.domain0.name = SIBLING
kernel.sched_domain.cpu7.domain1.min_interval = 1
kernel.sched_domain.cpu7.domain1.max_interval = 4
kernel.sched_domain.cpu7.domain1.busy_idx = 2
kernel.sched_domain.cpu7.domain1.idle_idx = 0
kernel.sched_domain.cpu7.domain1.newidle_idx = 0
kernel.sched_domain.cpu7.domain1.wake_idx = 0 kernel.sched_domain.cpu7.domain1.forkexec_idx
= 0 kernel.sched_domain.cpu7.domain1.busy_factor
= 64
kernel.sched_domain.cpu7.domain1.imbalance_pct = 125
kernel.sched_domain.cpu7.domain1.cache_nice_tries = 1
kernel.sched_domain.cpu7.domain1.flags = 4655
kernel.sched_domain.cpu7.domain1.name = MC
 

谢谢

答案1

检查/etc/sysctl.conf文件中的临时端口数(端口范围)、最大文件处理程序数和套接字内存。所有这些都可能限制 Apache 可以处理的并发请求数。

相关内容