Автор Тема: Настройка апача на нагруженном сервере  (Прочитано 10194 раз)

Оффлайн stpavel

  • Начинающий
  • *
  • Сообщений: 15
Добрый день
Имеется достаточно нагруженный веб сервер  ( > 1.500.000 запросов в сутки )
Установлен apache2 2.2.6

В настройках mpm прописано
<IfModule mpm_prefork_module>
        StartServers         150
        MinSpareServers      150
        MaxSpareServers      200
        MaxClients           300
        MaxRequestsPerChild   0
</IfModule>

Тем не менее в логах так и появляется  ( увеличивал значения StartServers, Min/MaxSpare уже несколько раз по сравнению с теми которые по умолчанию стояли ) :
[Mon Oct 13 18:58:57 2008] [info] server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers), spawning
 16 children, there are 146 idle, and 209 total children
[Mon Oct 13 19:04:39 2008] [info] server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers), spawning
 8 children, there are 148 idle, and 236 total children

До каких разумных пределов можно повышать эти значения ?
Может имеет смысл для такого нагруженного сервера поставить nginx  в качестве frontend к апачу ?

Оффлайн vvk

  • alt linux team
  • ***
  • Сообщений: 124
    • Email
Обязательно nginx фронтендом, ещё желательно отдачу статики отдать nginx-у.
irc.freenode.net #altlinux
http://spo.tyumen.ru/

Оффлайн Vitls

  • Глобальный модератор
  • *****
  • Сообщений: 372
  • Идиотизм вечен!
    • Linux. OpenSource. Life.
    • Email
Кроме того, что сказал vvk, даю пример сервера, который обслуживает около 6 миллионов в сутки.
Timeout 15
KeepAlive Off
MaxKeepAliveRequests 100
KeepAliveTimeout 15

<IfModule prefork.c>
StartServers      50
MinSpareServers   20
MaxSpareServers   20
ServerLimit     1000
MaxClients      1000
MaxRequestsPerChild  100
</IfModule>

А также содержимое /etc/sysctl.conf
net.ipv4.ip_forward = 0

# Controls source route verification
net.ipv4.conf.default.rp_filter = 1

# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0

# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename
# Useful for debugging multi-threaded applications
kernel.core_uses_pid = 1

# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1

# Controls the maximum size of a message, in bytes
kernel.msgmnb = 65536

# Controls the default maxmimum size of a mesage queue
kernel.msgmax = 65536

# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736

# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296
kernel.core_pattern=/root/core

net.ipv4.tcp_rmem = 4096 131072 262144
net.ipv4.tcp_wmem = 4096 131072 262144

#was 135168
net.core.rmem_max = 262144
net.core.wmem_max = 262144

#was 300
net.ipv4.tcp_keepalive_time = 30
net.ipv4.tcp_max_orphans = 8192
net.ipv4.tcp_rfc1337 = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_abort_on_overflow = 1
#was 15
net.ipv4.tcp_fin_timeout = 5

net.ipv4.tcp_sack = 0
net.ipv4.tcp_window_scaling = 0
net.ipv4.tcp_max_tw_buckets = 1440000
net.ipv4.netfilter.ip_conntrack_max = 262144
net.ipv4.ip_conntrack_max = 262144

kernel.panic = 10

# don't cache ssthresh from previous connection
net.ipv4.tcp_no_metrics_save = 0
net.ipv4.tcp_moderate_rcvbuf = 1
# recommended to increase this for 1000 BT or higher
net.core.netdev_max_backlog = 2500
Дело не в том как болезнь вылечить.
Дело в том как других заразить.

Оффлайн stpavel

  • Начинающий
  • *
  • Сообщений: 15
Спасибо