免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 4861 | 回复: 10
打印 上一主题 下一主题

[Web] n多的httpd,网站几乎打不开。 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-10-27 19:29 |只看该作者 |倒序浏览
新装的freebsd 6.1
编译了内核。
ps -A 之后出现了几百个httpd

top中可以看到好多好多。网站慢的几乎打不开。内存吃光

配置如下,根据论坛中的高人指示

MaxKeepAliveRequests 20000

<IfModule prefork.c>
ServerLimit 2000
StartServers 10
MinSpareServers 10
MaxSpareServers 15
MaxClients 1500
MaxRequestsPerChild 10000
</IfModule>

12261  ??  I      0:00.00 /usr/local/apache/bin/httpd -k start
12262  ??  I      0:00.14 /usr/local/apache/bin/httpd -k start
12263  ??  S      0:00.01 /usr/local/apache/bin/httpd -k start
12264  ??  I      0:00.00 /usr/local/apache/bin/httpd -k start
12265  ??  I      0:00.06 /usr/local/apache/bin/httpd -k start
12266  ??  I      0:00.03 /usr/local/apache/bin/httpd -k start
12267  ??  I      0:00.09 /usr/local/apache/bin/httpd -k start
12268  ??  I      0:00.09 /usr/local/apache/bin/httpd -k start
12269  ??  I      0:00.00 /usr/local/apache/bin/httpd -k start
12270  ??  I      0:00.00 /usr/local/apache/bin/httpd -k start
12271  ??  I      0:00.00 /usr/local/apache/bin/httpd -k start
12272  ??  I      0:00.00 /usr/local/apache/bin/httpd -k start
12273  ??  I      0:00.04 /usr/local/apache/bin/httpd -k start
  516  v0  Is     0:00.03 login [pam] (login)
  541  v0  I      0:00.05 -csh (csh)
1117  v0  S+     0:05.56 top
  517  v1  Is+    0:00.00 /usr/libexec/getty Pc ttyv1
  518  v2  Is+    0:00.00 /usr/libexec/getty Pc ttyv2
  519  v3  Is+    0:00.00 /usr/libexec/getty Pc ttyv3
  520  v4  Is+    0:00.00 /usr/libexec/getty Pc ttyv4
  521  v5  Is+    0:00.00 /usr/libexec/getty Pc ttyv5
  522  v6  Is+    0:00.00 /usr/libexec/getty Pc ttyv6
  523  v7  Is+    0:00.00 /usr/libexec/getty Pc ttyv7
1547  p0  Is     0:00.01 -sh (sh)
1552  p0  I      0:00.01 su
1553  p0  S      0:00.07 _su (csh)
12287  p0  R+     0:00.00 ps -A
6721  p1  Is     0:00.00 -sh (sh)
6754  p1  I      0:00.01 su
6787  p1  I+     0:00.03 _su (csh)

论坛徽章:
0
2 [报告]
发表于 2006-10-27 19:39 |只看该作者
在机房等着呢,大家帮帮忙吧,周末又过不好了。

论坛徽章:
0
3 [报告]
发表于 2006-10-28 07:56 |只看该作者
netstat 结果呢

论坛徽章:
0
4 [报告]
发表于 2006-10-28 15:11 |只看该作者
中间的连接甚至更多。

Active Internet connections
Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)
tcp4       0      0  club.http              218.90.44.234.1901     ESTABLISHED
tcp4       0    696  club.http              221.227.47.252.1695    ESTABLISHED
tcp4       0      0  club.http              58.44.23.75.1853       ESTABLISHED
tcp4       0      0  club.http              211.140.10.104.16510   ESTABLISHED
tcp4       0      0  club.http              218.4.227.11.23373     ESTABLISHED
tcp4       0    696  club.http              190.182.162.60.b.60742 ESTABLISHED
tcp4       0      0  club.http              181.38.180.60.br.2989  ESTABLISHED
tcp4       0      0  club.http              61.190.143.142.1450    ESTABLISHED
tcp4       0      0  club.http              124.160.38.166.1516    ESTABLISHED
tcp4       0      0  club.http              61.164.15.6.1133       ESTABLISHED
tcp4       0      0  club.http              60.19.196.52.24776     ESTABLISHED
tcp4       0      0  club.http              121.33.251.3.4794      ESTABLISHED
tcp4       0      0  club.http              219.137.215.152.1644   ESTABLISHED
tcp4       0      0  club.http              219.137.215.152.1641   ESTABLISHED
tcp4       0      0  club.http              150.196.188.60.b.2461  ESTABLISHED
tcp4       0      0  club.http              60.25.77.101.2570      ESTABLISHED
tcp4       0      0  club.http              219.137.215.152.1639   ESTABLISHED
tcp4       0      0  club.http              60.216.192.145.1238    ESTABLISHED
tcp4       0      0  club.http              218.244.83.193.1265    ESTABLISHED
tcp4       0      0  club.http              221.203.53.150.19317   ESTABLISHED
tcp4       0      0  club.http              59.50.228.149.4886     ESTABLISHED
tcp4       0      0  club.http              203.135.175.96.2169    ESTABLISHED
tcp4       0      0  club.http              61.241.146.167.2304    ESTABLISHED
tcp4       0      0  club.http              61.184.131.111.3149    ESTABLISHED
tcp4       0      0  club.http              60.209.188.218.1149    ESTABLISHED
tcp4       0      0  club.http              58.60.228.177.1477     ESTABLISHED
tcp4       0    696  club.http              221.6.120.206.33968    ESTABLISHED
tcp4       0      0  club.http              218.9.188.47.1269      ESTABLISHED
tcp4       0      0  club.http              218.206.155.4.12441    ESTABLISHED
tcp4       0      0  club.http              219.129.1.3.3833       ESTABLISHED
tcp4       0      0  club.http              61.167.60.229.12051    ESTABLISHED
tcp4       0      0  club.http              222.134.228.116.2571   ESTABLISHED
tcp4       0      0  club.http              59.58.16.153.2046      ESTABLISHED
tcp4       0      0  club.http              121.24.179.66.2036     ESTABLISHED
tcp4       0      0  club.http              124.161.163.163.2468   ESTABLISHED
tcp4       0      0  club.http              221.196.132.24.24478   ESTABLISHED
tcp4       0      0  club.http              218.108.63.106.33632   ESTABLISHED
tcp4       0      0  club.http              58.59.206.7.1336       ESTABLISHED
tcp4       0    696  club.http              222.216.2.181.41625    ESTABLISHED
tcp4       0      0  club.http              219.130.116.168.1097   ESTABLISHED
tcp4       0      0  club.http              218.244.206.40.2283    ESTABLISHED
tcp4       0      0  club.http              60.11.144.104.2366     ESTABLISHED
tcp4       0      0  club.http              60.209.129.232.1239    ESTABLISHED
tcp4       0      0  club.http              124.91.12.30.1406      ESTABLISHED
tcp4       0    696  club.http              61.173.42.163.4206     ESTABLISHED
tcp4       0      0  club.http              218.95.112.16.25246    ESTABLISHED
tcp4       0      0  club.http              59.38.35.194.29210     ESTABLISHED
tcp4       0      0  club.http              218.23.209.99.1176     ESTABLISHED
tcp4       0      0  club.http              222.35.193.199.1048    ESTABLISHED
tcp4       0      0  club.http              59.32.4.27.1972        ESTABLISHED
tcp4       0      0  club.http              219.82.167.205.3047    ESTABLISHED
tcp4       0      0  club.http              218.15.9.218.2014      ESTABLISHED
tcp4       0      0  club.http              125.93.31.149.64277    ESTABLISHED
tcp4       0      0  club.http              221.122.37.124.22390   ESTABLISHED
tcp4       0      0  club.http              218.109.120.98.45587   ESTABLISHED
tcp4       0      0  club.http              2.167.163.60.bro.2437  ESTABLISHED
tcp4       0      0  club.http              61.48.122.181.3878     ESTABLISHED
tcp4       0      0  club.http              221.3.29.176.2384      ESTABLISHED
tcp4       0      0  club.http              218.9.232.238.34320    ESTABLISHED
tcp4       0      0  club.http              218.24.145.159.11502   ESTABLISHED
tcp4       0      0  club.http              222.48.213.231.1711    ESTABLISHED
tcp4       0      0  club.http              59.41.239.110.1538     ESTABLISHED
tcp4       0      0  club.http              210.83.194.34.45581    ESTABLISHED
tcp4       0      0  club.http              61.190.158.17.2048     ESTABLISHED
tcp4       0      0  club.http              222.130.19.35.22580    ESTABLISHED
tcp4       0      0  club.http              60.214.50.202.1376     ESTABLISHED
tcp4       0      0  club.http              60.214.50.202.1374     ESTABLISHED
tcp4       0      0  club.http              218.26.56.26.1201      ESTABLISHED
tcp4       0      0  club.http              218.80.11.61.2966      ESTABLISHED
tcp4       0      0  club.http              2.167.163.60.bro.2436  ESTABLISHED
tcp4       0      0  club.http              218.15.125.250.1554    ESTABLISHED
tcp4       0      0  club.http              124.166.35.148.1549    ESTABLISHED
tcp4       0      0  club.http              hn.kd.dhcp.63857       ESTABLISHED
tcp4       0      0  club.http              221.214.195.91.50682   ESTABLISHED
tcp4       0      0  club.http              202.205.121.130.1429   ESTABLISHED
tcp4       0      0  club.http              221.193.216.77.53699   ESTABLISHED
tcp4       0      0  club.http              60.55.152.164.1483     ESTABLISHED
tcp4       0      0  club.http              125.43.234.34.4574     ESTABLISHED
tcp4       0      0  club.http              218.24.59.234.2753     ESTABLISHED
tcp4       0      0  club.http              218.21.93.5.2233       ESTABLISHED
tcp4       0      0  club.http              221.196.83.177.2432    ESTABLISHED
tcp4       0      0  club.http              221.214.73.8.2498      ESTABLISHED
tcp4       0      0  club.http              222.162.215.232.1144   ESTABLISHED
tcp4       0      0  club.http              218.59.164.242.17942   ESTABLISHED
tcp4       0      0  club.http              60.23.121.140.42429    ESTABLISHED
tcp4       0      0  club.http              214.144.0.218.br.1253  ESTABLISHED
tcp4       0      0  club.http              218.7.208.75.2944      ESTABLISHED
tcp4       0      0  club.http              60.215.248.82.2811     ESTABLISHED
tcp4       0      0  club.http              121.46.218.199.1291    ESTABLISHED
tcp4       0      0  club.http              219.129.165.68.1713    FIN_WAIT_2
tcp4       0      0  club.http              202.105.64.207.58905   FIN_WAIT_2
tcp4       0     52  club.ssh               dns1.1789              ESTABLISHED
Active UNIX domain sockets
Address  Type   Recv-Q Send-Q    Inode     Conn     Refs  Nextref Addr
c4eeb348 stream      0      0        0 c4eeb3d4        0        0
c4eeb3d4 stream      0      0        0 c4eeb348        0        0
c4eec000 stream      0      0 c4eea330        0        0        0 /var/run/devd.pipe
c4eeb460 dgram       0      0        0 c4eebd20        0 c4eebc94
c4eebc94 dgram       0      0        0 c4eebd20        0        0
c4eebd20 dgram       0      0 c4effaa0        0 c4eeb460        0 /var/run/logpriv
c4eebdac dgram       0      0 c4eea770        0        0        0 /var/run/log

论坛徽章:
0
5 [报告]
发表于 2006-10-28 15:40 |只看该作者
无奈,先换成windows2003使用iis就好了,可是我十分相信freebsd的稳定啊,非常想用,请大家帮忙啊,谢谢啦。

论坛徽章:
0
6 [报告]
发表于 2006-10-28 17:51 |只看该作者
==

把配置文件说一下。

用用下面的配置(可能要做些修改和替换),如果没问题,可能和现有的配置有关。

Listen 80
ServerRoot @@ServerRoot@@
DocumentRoot @@ServerRoot@@/htdocs

User  nobody
# If you're not on Linux, you'll probably need to change Group
Group nobody

<IfModule prefork.c>
MaxClients       150
StartServers     5
MinSpareServers  5
MaxSpareServers 10
</IfModule>

<IfModule worker.c>
StartServers         2
MaxClients         150
MinSpareThreads     25
MaxSpareThreads     75
ThreadsPerChild     25
MaxRequestsPerChild  0
</IfModule>

# Assume no memory leaks at all
MaxRequestsPerChild 0

# it's always nice to know the server has started
ErrorLog logs/error_log

# Some benchmarks require logging, which is a good requirement.  Uncomment
# this if you need logging.
#TransferLog logs/access_log

<Directory />
    # The server can be made to avoid following symbolic links,
    # to make security simpler. However, this takes extra CPU time,
    # so we will just let it follow symlinks.
    Options FollowSymLinks

    # Don't check for .htaccess files in each directory - they slow
    # things down
    AllowOverride None

    # If this was a real internet server you'd probably want to
    # uncomment these:
    order deny,allow
    deny from all
    # !!! FOR MAXIMUM SECURITY, PLEASE ENABLE THE ABOVE TWO LINES!
</Directory>

# If this was a real internet server you'd probably want to uncomment this:
<Directory "@@ServerRoot@@/htdocs">
    order allow,deny
    allow from all
</Directory>

# OK that's enough hints.  Read the documentation if you want more.

==

论坛徽章:
0
7 [报告]
发表于 2006-10-28 22:04 |只看该作者
谢谢楼上的,我使用了您的配置后虽然不会出现很多httpd,但是站点也访问不了了,或者说是慢的无法忍受。
-----------------------------------------------------------------------------
tcp4       0      0  club.http              59.38.242.55.1239      FIN_WAIT_2
tcp4       0  12223  club.http              58.40.143.250.1383     FIN_WAIT_1
tcp4       0      0  club.http              59.40.56.16.2780       FIN_WAIT_2
tcp4       0      0  club.http              59.40.56.16.2774       FIN_WAIT_2
tcp4       0  12221  club.http              218.17.205.72.18596    FIN_WAIT_1
tcp4       0      0  club.http              59.40.56.16.2764       FIN_WAIT_2
tcp4       0      0  club.http              221.212.193.115.23124  FIN_WAIT_2
tcp4       0      0  club.http              61.50.175.110.47093    FIN_WAIT_2
tcp4       0  10690  club.http              221.7.211.145.18662    FIN_WAIT_1
tcp4       0   9384  club.http              221.7.211.145.18661    FIN_WAIT_1
tcp4       0   5726  club.http              61.134.229.177.1975    LAST_ACK
tcp4       0      0  club.http              221.232.51.160.1640    FIN_WAIT_1
tcp4       0      0  club.http              59.40.115.118.32142    LAST_ACK
tcp4       0      0  club.http              221.207.137.100.1304   FIN_WAIT_2
tcp4       0      0  club.http              221.207.137.100.1303   FIN_WAIT_2
tcp4       0      0  club.http              221.207.137.100.1302   FIN_WAIT_2
tcp4       0      0  club.http              221.207.137.100.1301   FIN_WAIT_2
tcp4       0      0  club.http              221.207.137.100.1300   FIN_WAIT_2
tcp4       0      0  club.http              221.207.137.100.1298   FIN_WAIT_2
tcp4       0      0  club.http              222.246.210.199.1358   FIN_WAIT_2
tcp4       0      0  club.http              219.136.172.52.2634    FIN_WAIT_2
tcp4       0      0  club.http              218.13.48.38.54852     FIN_WAIT_2
tcp4       0      0  club.http              218.13.48.38.54851     FIN_WAIT_2
tcp4       0      0  club.ftp               dns1.2303              ESTABLISHED
tcp4       0     52  club.ssh               dns1.1789              ESTABLISHED
Active UNIX domain sockets
Address  Type   Recv-Q Send-Q    Inode     Conn     Refs  Nextref Addr
c4eeb348 stream      0      0        0 c4eeb3d4        0        0
c4eeb3d4 stream      0      0        0 c4eeb348        0        0
c4eec000 stream      0      0 c4eea330        0        0        0 /var/run/devd.pipe
c81c97a8 dgram       0      0        0 c4eebd20        0 c4eeb460
c4eeb460 dgram       0      0        0 c4eebd20        0 c4eebc94
c4eebc94 dgram       0      0        0 c4eebd20        0        0
c4eebd20 dgram       0      0 c4effaa0        0 c81c97a8        0 /var/run/logpriv
c4eebdac dgram       0      0 c4eea770        0        0        0 /var/run/log

论坛徽章:
1
技术图书徽章
日期:2013-12-05 23:25:45
8 [报告]
发表于 2006-10-28 22:04 |只看该作者
1. 你现在的MPM到底是perfork还是worker

2. 最好启用一个防火墙例如ipfw,效果就好多了,小规模的dos什么的不怕。

论坛徽章:
0
9 [报告]
发表于 2006-10-28 22:11 |只看该作者
应该不是ddos,因为我换到windows机器上都没有问题,使用楼上的配置后连接数出现了900多,没有针对个别状态进行统计。
-----------------------------
贴出我的两个配置文件sysctl.conf
-----------------------------
# $FreeBSD: src/etc/sysctl.conf,v 1.8 2003/03/13 18:43:50 mux Exp $
#
#  This file is read when going to multi-user and its contents piped thru
#  ``sysctl'' to adjust kernel values.  ``man 5 sysctl.conf'' for details.
#

# Uncomment this to prevent users from seeing information about processes that
# are being run under another UID.
#security.bsd.see_other_uids=0

net.inet.ip.check_interface=1
net.inet.tcp.blackhole=2
net.inet.udp.blackhole=1
net.inet.tcp.recvspace=65535
net.inet.tcp.sendspace=65535
kern.ipc.somaxconn=32768
kern.ipc.maxsockbuf=2097152
net.inet.ip.redirect=0
net.inet.icmp.icmplim=100
net.inet.tcp.always_keepalive=1
net.inet.tcp.delayed_ack=1
net.inet.udp.maxdgram=65535
net.local.stream.sendspace=65535
net.local.stream.recvspace=65535
kern.maxfiles=65536
kern.maxfilesperproc=65536
net.inet.udp.checksum=1
net.inet.tcp.msl=7500
net.inet.tcp.syncookies=1
net.inet.icmp.bmcastecho=0
net.inet.icmp.maskrepl=0
kern.securelevel=0
---------------------------------------------------
loader.conf
kern.maxdsiz="536870912"
kern.ipc.maxsockets="4008"
kern.ipc.nmbclusters="32768"
kern.ipc.nmbufs="65535"
kern.ipc.nsfbufs="2496"
net.inet.tcp.tcbhashsize="2048"

论坛徽章:
0
10 [报告]
发表于 2006-10-28 22:12 |只看该作者
httpd -l
Compiled in modules:
  core.c
  mod_access.c
  mod_auth.c
  mod_include.c
  mod_log_config.c
  mod_env.c
  mod_setenvif.c
  prefork.c
  http_core.c
  mod_mime.c
  mod_status.c
  mod_autoindex.c
  mod_asis.c
  mod_cgi.c
  mod_negotiation.c
  mod_dir.c
  mod_imap.c
  mod_actions.c
  mod_userdir.c
  mod_alias.c
  mod_so.c
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP