Chinaunix

标题: 装BSD两个星期了,网站经常莫明其秒的挂掉,哪个高手帮帮我 [打印本页]

作者: kingstone32    时间: 2007-04-01 17:21
标题: 装BSD两个星期了,网站经常莫明其秒的挂掉,哪个高手帮帮我
机器配置PD2.66  1G 160G
论坛DZ5.5
PHP Version 5.2.1
MYSQL 5
FreeBSD www.local.com 6.2-STABLE FreeBSD 6.2-STABLE #0: Fri Mar 23 03:44:52 CST 2007 root@www.local.com:/usr/obj/usr/src/sys/SuperKernel-SMP-ULE-64bit amd64

论坛刚开速度很快,可是15分钟在线人数超过400人后就容易出问题了,不是MYSQL报错就是APACHE挂掉,

专门找了做IDC方面的人帮我装的系统,做了很多优化,两个星期了,可是情况都没有怎么改善,看看这里有没有高手能看出是什么问题
作者: llzqq    时间: 2007-04-01 18:23
对你现在服务器的配置情况一无所知,想帮忙都难
作者: kingstone32    时间: 2007-04-01 18:29
还需要哪些具体的配置情况?我一一列出来
作者: bGFuZ3Vl    时间: 2007-04-01 18:39
标题: 回复 3楼 kingstone32 的帖子
先想办法贴个 dmesg 出来
作者: 小稻    时间: 2007-04-01 18:52
用PD做服务器,不荡死才怪
作者: iceblood    时间: 2007-04-01 19:03
SuperKernel-SMP-ULE-64bit amd64
用ULE?别用这个。
作者: kingstone32    时间: 2007-04-01 20:34
原帖由 iceblood 于 2007-4-1 19:03 发表
SuperKernel-SMP-ULE-64bit amd64
用ULE?别用这个。


是因为ULE的原因?那应该用哪个版本稳定高效呢?

dmesg的结果全是FAIL,难道哪里出问题了

[ 本帖最后由 kingstone32 于 2007-4-1 20:57 编辑 ]
作者: kingstone32    时间: 2007-04-01 20:35
原帖由 小稻 于 2007-4-1 18:52 发表
用PD做服务器,不荡死才怪


确实烫,搬服务器回来装系统的时候换过CPU风扇温度才降下来
作者: xuezongqing    时间: 2007-04-01 20:37
是什么主板???估计硬件有问题。。你用的是什么机箱?什么板子?散热过关吗?
作者: xuezongqing    时间: 2007-04-01 20:39
我托管的服务器机箱用的是千际1U机箱。。散热还是不错滴:)就是价格太贵了
作者: kingstone32    时间: 2007-04-01 20:41
dmesg 的结果放上来:


swap_pager_getswapspace(3): failed
swap_pager_getswapspace(3): failed
swap_pager_getswapspace(2): failed
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(2): failed
swap_pager_getswapspace(2): failed
swap_pager_getswapspace(2): failed
swap_pager_getswapspace(2): failed
swap_pager_getswapspace(3): failed
swap_pager_getswapspace(4): failed
swap_pager_getswapspace(2): failed
swap_pager_getswapspace(2): failed
swap_pager_getswapspace(2): failed
swap_pager_getswapspace(2): failed
swap_pager_getswapspace(2): failed
swap_pager_getswapspace(2): failed
swap_pager_getswapspace(2): failed
swap_pager_getswapspace(2): failed
swap_pager_getswapspace(2): failed
swap_pager_getswapspace(2): failed
swap_pager_getswapspace(2): failed
swap_pager_getswapspace(2): failed
swap_pager_getswapspace(2): failed
swap_pager_getswapspace(2): failed
swap_pager_getswapspace(2): failed
swap_pager_getswapspace(2): failed
swap_pager_getswapspace(4): failed
swap_pager_getswapspace(2): failed
swap_pager_getswapspace(3): failed
swap_pager_getswapspace(2): failed
swap_pager_getswapspace(2): failed
swap_pager_getswapspace(: failed
swap_pager_getswapspace(3): failed
swap_pager_getswapspace(2): failed
swap_pager_getswapspace(2): failed
swap_pager_getswapspace(2): failed
swap_pager_getswapspace(3): failed
pid 21296 (httpd), uid 80, was killed: out of swap space
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(16): failed
作者: kingstone32    时间: 2007-04-01 20:45
原帖由 xuezongqing 于 2007-4-1 20:37 发表
是什么主板???估计硬件有问题。。你用的是什么机箱?什么板子?散热过关吗?


主板是技嘉的945G,怎么看得出是硬件问题呢,机箱是1U得,换过CPU风扇,温度在40-50度左右吧
作者: HonestQiao    时间: 2007-04-01 22:23
pid 21296 (httpd), uid 80, was killed: out of swap space???

居然超出了这个的大小?

top看看,把最开始的帖上来
作者: HonestQiao    时间: 2007-04-01 22:31
另外,看看top里面的mysql的信息,帖上来。
作者: kingstone32    时间: 2007-04-02 04:09
今天晚上我关闭了会员注册,晚上很晚回来看到论坛还没有挂掉,登录SSH速度还可以,先贴个TOP上来给大家看看

www# top
last pid: 37070;  load averages:  0.10,  0.08,  0.09    up 1+05:12:58  04:08:17
45 processes:  1 running, 44 sleeping
CPU states:  1.1% user,  0.0% nice,  1.3% system,  0.0% interrupt, 97.5% idle
Mem: 320M Active, 275M Inact, 205M Wired, 46M Cache, 111M Buf, 35M Free
Swap: 2002M Total, 240M Used, 1763M Free, 11% Inuse, 8K In

  PID USERNAME  THR PRI NICE   SIZE    RES STATE  C   TIME   WCPU COMMAND
23320 mysql      13  20    0   813M   275M kserel 1 304:42  0.00% mysqld
29064 root        1   8    0   117M  4780K nanslp 0   0:17  0.00% httpd
  646 root        1  76    0  9468K  1088K select 0   0:03  0.00% sendmail
  493 root        1  76    0  3664K   452K select 0   0:02  0.00% syslogd
  640 root        1  76    0 19656K   444K select 0   0:01  0.00% sshd
37017 www         1   4    0   119M 13936K accept 1   0:01  0.00% httpd
37029 www         1  76    0   119M 13188K select 1   0:01  0.00% httpd
37035 www         1  76    0   118M 12572K select 1   0:01  0.00% httpd
  658 root        1   8    0  3664K   388K nanslp 0   0:01  0.00% cron
  652 smmsp       1  20    0  9336K   740K pause  0   0:01  0.00% sendmail
37052 www         1   4    0   119M 13280K accept 0   0:00  0.00% httpd
37050 www         1  76    0   119M 12956K select 1   0:00  0.00% httpd
37044 www         1   4    0   119M 13004K accept 0   0:00  0.00% httpd
37057 www         1  76    0   120M 13520K select 1   0:00  0.00% httpd
37056 www         1   4    0   119M 12036K accept 1   0:00  0.00% httpd
37066 www         1  76    0   119M 12148K select 1   0:00  0.00% httpd
作者: HonestQiao    时间: 2007-04-02 09:29
从中,我有几个疑问,方可继续判断你的问题,并给提出解决方法:
1. 查看你的/etc/my.cnf,是否使用了蹩脚的配置?
  因为你的物理内存才1G,而你的MySQL就基本要吃完了
  一般是你给MySQL分配了较大的缓存空间
2. apachectl -l看看使用的是prefork还是worker呢?
   apachectl -v看看apache的版本
  因为你的Apache占有内存也真的是非常地大。
  另外还要告诉我们,你到底启用了哪些模块?

因为以上原因,物理内存耗尽,那么必然就去使用交换分区。
交换分区使用频繁,必然导致速度很慢几乎挂掉。
因为使用过多的内存和交换分区,可能导致交换分区都不够使用,出现上面的提示,以及程序异常退出。
作者: kingstone32    时间: 2007-04-02 10:51
谢谢楼上的,apache已经转到进程模式了

www# apachectl -l
Compiled in modules:
  core.c
  prefork.c
  http_core.c
  mod_so.c


www# apachectl -v
Server version: Apache/2.2.4 (FreeBSD)
Server built:   Mar 27 2007 02:27:31

my.cnf的配置:
# Example MySQL config file for very large systems.
#
# This is for a large system with memory of 1G-2G where the system runs mainly
# MySQL.
#
# You can copy this file to
# /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is /usr/local/mysql5/var) or
# ~/.my.cnf to set user-specific options.
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.

# The following options will be passed to all MySQL clients
[client]
#password       = your_password
port            = 3306
socket          = /tmp/mysql.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
port            = 3306
socket          = /tmp/mysql.sock
skip-locking
key_buffer = 384M
max_allowed_packet = 1M
table_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 32M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8
max_connections=2048


# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking

# Replication Master Server (default)
# binary logging is required for replication
#log-bin=mysql-bin

# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id       = 1

# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
#    the syntax is:
#
#    CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
#    MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
#
#    where you replace <host>, <user>, <password> by quoted strings and
#    <port> by the master's port number (3306 by default).
#
#    Example:
#
#    CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
#    MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# 2) Set the variables below. However, in case you choose this method, then
#    start replication for the first time (even unsuccessfully, for example
#    if you mistyped the password in master-password and the slave fails to
#    connect), the slave will create a master.info file, and any later
#    change in this file to the variables' values below will be ignored and
#    overridden by the content of the master.info file, unless you shutdown
#    the slave server, delete master.info and restart the slaver server.
#    For that reason, you may want to leave the lines below untouched
#    (commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id       = 2
#
# The replication master for this slave - required
#master-host     =   <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user     =   <username>
#
# The password the slave will authenticate with when connecting to
# the master - required
#master-password =   <password>
#
# The port the master is listening on.
# optional - defaults to 3306
#master-port     =  <port>
#
# binary logging - not required for slaves, but recommended
#log-bin=mysql-bin

# Point the following paths to different dedicated disks
#tmpdir         = /tmp/
#log-update     = /path-to-dedicated-directory/hostname

# Uncomment the following if you are using BDB tables
#bdb_cache_size = 384M
#bdb_max_lock = 100000

# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /usr/local/mysql5/var/
#innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend
#innodb_log_group_home_dir = /usr/local/mysql5/var/
#innodb_log_arch_dir = /usr/local/mysql5/var/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 384M
#innodb_additional_mem_pool_size = 20M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 100M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[isamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M

[myisamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout
作者: kingstone32    时间: 2007-04-02 10:56
今天网站又挂掉了,TOP情况如下:

PID USERNAME  THR PRI NICE   SIZE    RES STATE  C   TIME   WCPU COMMAND
23320 mysql      13  20    0   813M   269M kserel 1 383:36 12.70% mysqld
  646 root        1  76    0  9468K  1024K select 0   0:04  0.00% sendmail
  493 root        1  76    0  3664K   456K select 0   0:02  0.00% syslogd
  640 root        1  76    0 19656K   420K select 1   0:01  0.00% sshd
41342 root        1   8    0   117M 14544K nanslp 0   0:01  0.00% httpd
41458 www         1   4    0   119M 21084K accept 0   0:01  0.00% httpd
41459 www         1  76    0   119M 21012K select 1   0:01  0.00% httpd
  658 root        1   8    0  3664K   380K nanslp 0   0:01  0.00% cron
41430 www         1  76    0   119M 20752K select 0   0:01  0.00% httpd
  652 smmsp       1  20    0  9336K   768K pause  0   0:01  0.00% sendmail
41489 www         1  76    0   119M 20652K select 1   0:00  0.00% httpd
41485 www         1  76    0   119M 21012K select 1   0:00  0.00% httpd
41507 www         1   4    0   119M 20488K accept 0   0:00  0.00% httpd
41516 www         1   4    0   119M 20228K sbwait 1   0:00  0.00% httpd
41303 root        1  76    0 30604K  3392K select 1   0:00  0.00% sshd
41512 www         1   4    0   119M 20532K accept 1   0:00  0.00% httpd
41530 www         1  76    0   119M 20540K select 1   0:00  0.00% httpd

停掉APACHE后netstat和vmstat的结果:

www# netstat -an | grep 61.143.210.228.80 | grep "WA" | wc -l
    1620


www# vmstat
procs      memory      page                   disk   faults      cpu
r b w     avm    fre  flt  re  pi  po  fr  sr ad2   in   sy  cs us sy id
0 0 1 1078752  51216 1202  34  39  35 1437 2875   0  818 25986 8482  8 17 75
作者: walkerxk    时间: 2007-04-02 11:15
我的Ubuntu服务器也是这样,不过好像有时间段的,有几天不正常过几天就好了,然后一个月内就没有问题,差不多过一个月又是这样,以前没有开虚拟主机的时候没有问题,所以怀疑是apache的问题:
下面是top时按照SWAP排序:可以看到apache明显比其他的服务器高很多,而且这是我优化以后的结果,前几天没有优化的时候是每个120m左右。现在的SWAP算正常的,不稳定的时候used大概是free的两倍。
Tasks: 512 total,   2 running, 510 sleeping,   0 stopped,   0 zombie
Cpu(s): 19.0% us,  3.0% sy,  4.4% ni, 65.7% id,  7.1% wa,  0.1% hi,  0.7% si
Mem:   2052244k total,  2009992k used,    42252k free,    14648k buffers
Swap:  1951856k total,   741628k used,  1210228k free,   492596k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  SWAP COMMAND                                      
6816 mysql     16   0  565m  57m 2696 S  0.3  2.9 124:48.79 507m mysqld                                       
10641 panjy     34  19  509m 353m 3712 S 77.6 17.6   1939:12 155m python                                       
11375 www-data  16   0  109m  21m 8040 S  0.0  1.1   0:00.22  87m apache2                                      
9327 www-data  16   0  109m  21m 8136 S  0.0  1.1   0:00.28  87m apache2                                      
11385 www-data  16   0  109m  21m 8176 S  0.0  1.1   0:00.40  87m apache2                                      
10968 www-data  16   0  102m  15m 8084 S  0.0  0.8   0:00.19  87m apache2                                      
7906 www-data  16   0  103m  16m 8116 S  0.0  0.8   0:00.18  87m apache2                                      
7879 root      16   0  100m  13m 7436 S  0.3  0.7   0:02.28  86m apache2                                      
11447 www-data  16   0  100m  13m 7544 S  0.0  0.7   0:00.01  86m apache2                                      
11222 www-data  16   0  105m  19m 8320 S  0.0  1.0   0:00.76  86m apache2                                      
12275 www-data  18   0  100m  13m 7492 S  0.0  0.7   0:00.00  86m apache2                                      
12277 www-data  18   0  100m  13m 7492 S  0.0  0.7   0:00.00  86m apache2                                      
7918 www-data  15   0  100m  13m 7508 S  0.0  0.7   0:00.01  86m apache2                                      
7919 www-data  16   0  100m  13m 7508 S  0.0  0.7   0:00.00  86m apache2                                      
7920 www-data  15   0  100m  13m 7508 S  0.0  0.7   0:00.00  86m apache2                                      
7921 www-data  15   0  100m  13m 7508 S  0.0  0.7   0:00.00  86m apache2                                      
7922 www-data  15   0  100m  13m 7508 S  0.0  0.7   0:00.00  86m apache2                                      
8657 www-data  15   0  100m  13m 7508 S  0.0  0.7   0:00.00  86m apache2                                      
8667 www-data  15   0  100m  13m 7508 S  0.0  0.7   0:00.00  86m apache2                                      
9242 www-data  15   0  100m  13m 7508 S  0.0  0.7   0:00.00  86m apache2                                      
9769 www-data  15   0  100m  13m 7508 S  0.0  0.7   0:00.00  86m apache2                                      
10083 www-data  15   0  100m  13m 7508 S  0.0  0.7   0:00.00  86m apache2                                      
10310 www-data  16   0  100m  13m 7508 S  0.0  0.7   0:00.00  86m apache2                                      
11376 www-data  16   0  100m  13m 7508 S  0.0  0.7   0:00.00  86m apache2                                      
11560 www-data  16   0  100m  13m 7508 S  0.0  0.7   0:00.00  86m apache2                                      
11614 www-data  16   0  100m  13m 7508 S  0.0  0.7   0:00.00  86m apache2                                      
11623 www-data  16   0  100m  13m 7508 S  0.0  0.7   0:00.00  86m apache2                                      
11637 www-data  16   0  100m  13m 7508 S  0.0  0.7   0:00.00  86m apache2                                      
11638 www-data  16   0  100m  13m 7508 S  0.0  0.7   0:00.00  86m apache2                                      
11642 www-data  16   0  100m  13m 7508 S  0.0  0.7   0:00.00  86m apache2                                      
11645 www-data  16   0  100m  13m 7508 S  0.0  0.7   0:00.00  86m apache2

dmesg前面的都是系统启动的内容,我想没有什么用,就不发了,这个是后面的部分。
[ 5011.093270] ip_tables: (C) 2000-2002 Netfilter core team
[104298.196088] TCP: Treason uncloaked! Peer 202.108.130.138:64327/80 shrinks window 1989837571:1989845176. Rep
aired.
[197651.374072] saslauthd[7071]: segfault at ffffffffab5f9180 rip 00002aaaabcb7d80 rsp 00007fffff9ee248 error 4
[197662.745798] saslauthd[7070]: segfault at ffffffffab5f9180 rip 00002aaaabcb7d80 rsp 00007fffff9ee248 error 4
[206465.576897] KERNEL: assertion (cnt <= tp->packets_out) failed at net/ipv4/tcp_input.c (1542)
[309438.338013] saslauthd[7068]: segfault at ffffffffab5f9180 rip 00002aaaabcb7d80 rsp 00007fffff9ee248 error 4
[309439.123949] saslauthd[7073]: segfault at ffffffffab5f9180 rip 00002aaaabcb7d80 rsp 00007fffff9ee248 error 4
[309440.231172] saslauthd[7072]: segfault at ffffffffab5f9180 rip 00002aaaabcb7d80 rsp 00007fffff9ee248 error 4
[320102.663685] ibm_acpi: ec object not found
[352573.096712] KERNEL: assertion (cnt <= tp->packets_out) failed at net/ipv4/tcp_input.c (1542)
[352573.104295] KERNEL: assertion (cnt <= tp->packets_out) failed at net/ipv4/tcp_input.c (1542)
[416142.323578] Losing some ticks... checking if CPU frequency changed.
作者: walkerxk    时间: 2007-04-02 11:16
还有,怎么用top -bn1查看SWAP的情况,默认是不显示SWAP那列的。
作者: walkerxk    时间: 2007-04-02 11:25
Apache/2.0.54
Compiled in modules:
  core.c
  mod_access.c
  mod_auth.c
  mod_log_config.c
  mod_logio.c
  mod_env.c
  mod_setenvif.c
  prefork.c
  http_core.c
  mod_mime.c
  mod_status.c
  mod_autoindex.c
  mod_negotiation.c
  mod_dir.c
  mod_alias.c
  mod_so.c
启用以下模块:
bw.load(必需)
cgi.load
dav_fs.load
dav.load
dav_svn.load(必需)
fcgid.load
limitipconn.load(必需)
mod_python.load(必需)
perl.load(必需)
php4.load(必需)
proxy.load(必需)
rewrite.load(必需)
userdir.load
作者: HonestQiao    时间: 2007-04-02 11:26
lz前面说了,报错。

那么,mysql报什么错呢?
作者: kingstone32    时间: 2007-04-02 11:35
没有调整最大连接数会报too many connects的错误,加到2048后就会经常出现下面的错误或者APACHE被阻死了,网页完全打不开

Discuz! info: Can not connect to MySQL server

Time: 2007-3-30 10:39pm
Script: /index.php

Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (61)
Errno.: 2002

Similar error report has beed dispatched to administrator before.
作者: 大大狗    时间: 2007-04-02 11:51
原帖由 kingstone32 于 2007-4-2 11:35 发表
没有调整最大连接数会报too many connects的错误,加到2048后就会经常出现下面的错误或者APACHE被阻死了,网页完全打不开

Discuz! info: Can not connect to MySQL server

Time: 2007-3-30 10:39pm
Script ...

这个MYSQL报错 最好看一下日志 里面会写的很清楚 可能是权限问题
作者: isjfk    时间: 2007-04-02 15:38
原帖由 大大狗 于 2007-4-2 11:51 发表

这个MYSQL报错 最好看一下日志 里面会写的很清楚 可能是权限问题

不是权限问题,是他的mysql不堪重负仆街了...
作者: xuezongqing    时间: 2007-04-02 17:10
每个httpd进程竟然占内存20M。太恐怖了吧。。
我使用的版本一般都是apache1.3.XX版本的。。每个httpd时程也才几M。
不过我觉得要稳定一些的话。还是用apache1.3X php4X mysql3.23.59好一些
作者: cdcchen    时间: 2007-04-02 21:49
我的也是这样啊,郁闷死了,查资料说把apache的KeepAlive关了就行了,我试了,确实要好多了,但隔几天还是会出现load非常大,大到三四百之多,系统就跟死了没区别,只是现在隔的时间比较长,大约四五天就出现一次这种情况,只能重启,难道大家没有遇到这种情况的吗??那我也太倒霉了吧
作者: kingstone32    时间: 2007-04-02 22:25
下午加了条1G内存,竟然还是挂掉了,直接打不开论坛,难道是APACHE和MYSQL的版本太新不稳定??

HTTPD占用那么多内存是怎么回事??

从新贴一下现在的dmesg和top的结果:

www# top
last pid: 12011;  load averages: 66.50, 78.40, 77.48    up 0+05:50:42  23:26:09
935 processes: 22 running, 906 sleeping, 7 lock
CPU states: 25.6% user,  0.0% nice, 73.6% system,  0.8% interrupt,  0.0% idle
Mem: 1169M Active, 161M Inact, 484M Wired, 66M Cache, 213M Buf, 29M Free
Swap: 2002M Total, 423M Used, 1580M Free, 21% Inuse, 264K In

  PID USERNAME  THR PRI NICE   SIZE    RES STATE  C   TIME   WCPU COMMAND
  605 mysql     440  20    0  1135M   273M kserel 0 346:48  4.39% mysqld
  608 root        1   8    0   117M   920K nanslp 0   0:24  0.00% httpd
8832 www         1   4    0   119M 10748K sbwait 1   0:02  0.00% httpd
9242 www         1   4    0   120M 10128K sbwait 0   0:02  0.00% httpd
10225 www         1   4    0   119M 11248K sbwait 1   0:01  0.00% httpd
9057 www         1   4    0   120M 10028K sbwait 1   0:01  0.00% httpd
10510 www         1   4    0   119M 11436K sbwait 0   0:01  0.00% httpd
9658 www         1   4    0   119M 11000K sbwait 0   0:01  0.00% httpd
9956 www         1   4    0   119M 11464K sbwait 1   0:01  0.00% httpd
10435 www         1   4    0   119M 11032K sbwait 0   0:01  0.00% httpd
9261 www         1   4    0   121M 10620K sbwait 1   0:01  0.00% httpd
10008 www         1   4    0   119M 11848K sbwait 0   0:01  0.00% httpd
9169 www         1   4    0   119M 11136K sbwait 0   0:01  0.00% httpd
9809 www         1   4    0   121M 12524K sbwait 1   0:01  0.00% httpd
10182 www         1   4    0   120M 11152K sbwait 1   0:01  0.00% httpd
10395 www         1   4    0   119M 11376K sbwait 1   0:01  0.00% httpd


www# dmesg
Copyright (c) 1992-2007 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 6.2-STABLE #0: Fri Mar 23 03:44:52 CST 2007
    root@www.local.com:/usr/obj/usr/src/sys/SuperKernel-SMP-ULE-64bit
Timecounter "i8254" frequency 1193182 Hz quality 0
CPU: Intel(R) Pentium(R) D  CPU 2.66GHz (2660.21-MHz K8-class CPU)
  Origin = "GenuineIntel"  Id = 0xf47  Stepping = 7
  Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
  Features2=0x651d<SSE3,RSVD2,MON,DS_CPL,TM2,CNTX-ID,CX16,XTPR>
  AMD Features=0x20100800<SYSCALL,NX,LM>
  AMD Features2=0x1<LAHF>
  Cores per package: 2
real memory  = 2139029504 (2039 MB)
avail memory = 2057859072 (1962 MB)
ACPI APIC Table: <GBT    AWRDACPI>
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
cpu0 (BSP): APIC ID:  0
cpu1 (AP): APIC ID:  1
ioapic0: Changing APIC ID to 2
ioapic0 <Version 2.0> irqs 0-23 on motherboard
kbd1 at kbdmux0
acpi0: <GBT AWRDACPI> on motherboard
acpi0: Power Button (fixed)
cpu0: <ACPI CPU> on acpi0
acpi_throttle0: <ACPI CPU Throttling> on cpu0
cpu1: <ACPI CPU> on acpi0
acpi_throttle1: <ACPI CPU Throttling> on cpu1
acpi_throttle1: failed to attach P_CNT
device_attach: acpi_throttle1 attach returned 6
acpi_button0: <Power Button> on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
pci0: <display, VGA> at device 2.0 (no driver attached)
pci0: <serial bus, USB> at device 29.0 (no driver attached)
pci0: <serial bus, USB> at device 29.1 (no driver attached)
pci0: <serial bus, USB> at device 29.2 (no driver attached)
pci0: <serial bus, USB> at device 29.3 (no driver attached)
pci0: <serial bus, USB> at device 29.7 (no driver attached)
pcib1: <ACPI PCI-PCI bridge> at device 30.0 on pci0
pci1: <ACPI PCI bus> on pcib1
fxp0: <Intel 82559 Pro/100 Ethernet> port 0xa000-0xa03f mem 0xe0100000-0xe0100fff,0xe0000000-0xe00fffff irq 19 at device 1.0 on pci1
miibus0: <MII bus> on fxp0
inphy0: <i82555 10/100 media interface> on miibus0
inphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
fxp0: Ethernet address: 00:03:47:98:f5:ee
pci1: <network, ethernet> at device 5.0 (no driver attached)
pci0: <multimedia, audio> at device 30.2 (no driver attached)
isab0: <PCI-ISA bridge> at device 31.0 on pci0
isa0: <ISA bus> on isab0
atapci0: <Intel ICH7 SATA300 controller> port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0xf000-0xf00f at device 31.2 on pci0
ata0: <ATA channel 0> on atapci0
ata1: <ATA channel 1> on atapci0
pci0: <serial bus, SMBus> at device 31.3 (no driver attached)
ppc0: <Standard parallel printer port> port 0x378-0x37f irq 7 on acpi0
ppc0: Generic chipset (NIBBLE-only) in COMPATIBLE mode
ppbus0: <Parallel port bus> on ppc0
plip0: <PLIP network interface> on ppbus0
lpt0: <Printer> on ppbus0
lpt0: Interrupt-driven port
ppi0: <Parallel I/O> on ppbus0
atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
psm0: <PS/2 Mouse> irq 12 on atkbdc0
psm0: [GIANT-LOCKED]
psm0: model Generic PS/2 mouse, device ID 0
orm0: <ISA Option ROM> at iomem 0xc0000-0xca7ff on isa0
sc0: <System console> at flags 0x100 on isa0
sc0: VGA <16 virtual consoles, flags=0x300>
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
Timecounters tick every 1.000 msec
ipfw2 (+ipv6) initialized, divert loadable, rule-based forwarding disabled, default to accept, logging limited to 20 packets/entry by default
ad2: 156333MB <Maxtor 6L160M0 BACE1G20> at ata1-master SATA150
SMP: AP CPU #1 Launched!
Trying to mount root from ufs:/dev/ad2s1a
WARNING: / was not properly dismounted
WARNING: /tmp was not properly dismounted
WARNING: /usr was not properly dismounted
/usr: mount pending error: blocks 4 files 0
WARNING: /var was not properly dismounted
/var: mount pending error: blocks 24 files 14
fxp0: device timeout
fxp0: device timeout
fxp0: link state changed to UP
fxp0: SCB timeout: 0x70 0x0 0x50 0x400
fxp0: SCB timeout: 0xf0 0x0 0x50 0x400
fxp0: SCB timeout: 0xf0 0x0 0x50 0x400
fxp0: SCB timeout: 0xf0 0x0 0x50 0x400
fxp0: SCB timeout: 0xf0 0x0 0x50 0x400
fxp0: SCB timeout: 0xf0 0x0 0x50 0x400
fxp0: SCB timeout: 0xf0 0x0 0x50 0x400
fxp0: SCB timeout: 0xf0 0x0 0x50 0x400
fxp0: SCB timeout: 0xf0 0x0 0x50 0x400
fxp0: SCB timeout: 0xf0 0x0 0x50 0x400
fxp0: SCB timeout: 0xf0 0x0 0x50 0x400
fxp0: SCB timeout: 0xf0 0x0 0x50 0x400
fxp0: SCB timeout: 0xf0 0x0 0x50 0x400
fxp0: SCB timeout: 0xf0 0x0 0x50 0x400
fxp0: SCB timeout: 0xf0 0x0 0x50 0x400
fxp0: SCB timeout: 0xf0 0x0 0x50 0x400
fxp0: SCB timeout: 0xf0 0x0 0x50 0x400
fxp0: SCB timeout: 0xf0 0x0 0x50 0x400
fxp0: SCB timeout: 0xf0 0x0 0x50 0x400
fxp0: SCB timeout: 0xf0 0x0 0x50 0x400
fxp0: SCB timeout: 0xf0 0x0 0x50 0x400
fxp0: SCB timeout: 0xf0 0x0 0x50 0x400
fxp0: SCB timeout: 0xf0 0x0 0x50 0x400
fxp0: SCB timeout: 0xf0 0x0 0x50 0x400
fxp0: SCB timeout: 0xf0 0x0 0x50 0x400
fxp0: SCB timeout: 0xf0 0x0 0x50 0x400
fxp0: device timeout
collecting pv entries -- suggest increasing PMAP_SHPGPERPROC

[ 本帖最后由 kingstone32 于 2007-4-2 23:27 编辑 ]
作者: aha111    时间: 2007-04-03 08:46
关注
作者: cdcchen    时间: 2007-04-03 09:08
把httpd.conf里的KeepAlive设成off试一下,应该会好一点点
作者: isjfk    时间: 2007-04-03 09:57
last pid: 12011;  load averages: 66.50, 78.40, 77.48    up 0+05:50:42  23:26:09
935 processes: 22 running, 906 sleeping, 7 lock
CPU states: 25.6% user,  0.0% nice, 73.6% system,  0.8% interrupt,  0.0% idle
Mem: 1169M Active, 161M Inact, 484M Wired, 66M Cache, 213M Buf, 29M Free
Swap: 2002M Total, 423M Used, 1580M Free, 21% Inuse, 264K In


上帝呀...
作者: cdcchen    时间: 2007-04-03 10:20
跟我的一样,Load会变和非常大,能达到300多,跟死机一样,我快晕了,再解决不了我得换linux,被老板披了好几天了
作者: kingstone32    时间: 2007-04-03 10:21
原帖由 cdcchen 于 2007-4-3 09:08 发表
把httpd.conf里的KeepAlive设成off试一下,应该会好一点点


httpd.conf里面怎么没有KeepAlive这个参数呢?加在哪里?
作者: HonestQiao    时间: 2007-04-03 10:27
LZ的mysql到底怎么设置的?
作者: kingstone32    时间: 2007-04-03 10:41
刚装系统的时候为了不出乱码,用的是MYSQL4.0.27,调整参数不见好转后现在转成了MYSQL5
my.cnf配置如下:

# Example MySQL config file for very large systems.
#
# This is for a large system with memory of 1G-2G where the system runs mainly
# MySQL.
#
# You can copy this file to
# /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is /usr/local/mysql5/var) or
# ~/.my.cnf to set user-specific options.
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.

# The following options will be passed to all MySQL clients
[client]
#password       = your_password
port            = 3306
socket          = /tmp/mysql.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
port            = 3306
socket          = /tmp/mysql.sock
skip-locking
key_buffer = 384M
max_allowed_packet = 1M
table_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 32M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8
max_connections=2048


# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking

# Replication Master Server (default)
# binary logging is required for replication
#log-bin=mysql-bin

# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id       = 1

# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
#    the syntax is:
#
#    CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
#    MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
#
#    where you replace <host>, <user>, <password> by quoted strings and
#    <port> by the master's port number (3306 by default).
#
#    Example:
#
#    CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
#    MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# 2) Set the variables below. However, in case you choose this method, then
#    start replication for the first time (even unsuccessfully, for example
#    if you mistyped the password in master-password and the slave fails to
#    connect), the slave will create a master.info file, and any later
#    change in this file to the variables' values below will be ignored and
#    overridden by the content of the master.info file, unless you shutdown
#    the slave server, delete master.info and restart the slaver server.
#    For that reason, you may want to leave the lines below untouched
#    (commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id       = 2
#
# The replication master for this slave - required
#master-host     =   <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user     =   <username>
#
# The password the slave will authenticate with when connecting to
# the master - required
#master-password =   <password>
#
# The port the master is listening on.
# optional - defaults to 3306
#master-port     =  <port>
#
# binary logging - not required for slaves, but recommended
#log-bin=mysql-bin

# Point the following paths to different dedicated disks
#tmpdir         = /tmp/
#log-update     = /path-to-dedicated-directory/hostname

# Uncomment the following if you are using BDB tables
#bdb_cache_size = 384M
#bdb_max_lock = 100000

# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /usr/local/mysql5/var/
#innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend
#innodb_log_group_home_dir = /usr/local/mysql5/var/
#innodb_log_arch_dir = /usr/local/mysql5/var/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 384M
#innodb_additional_mem_pool_size = 20M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 100M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[isamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M

[myisamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout

[ 本帖最后由 kingstone32 于 2007-4-3 10:43 编辑 ]
作者: HonestQiao    时间: 2007-04-03 10:44
mysql的日志里的错误信息呢》、
作者: kingstone32    时间: 2007-04-03 13:28
错误日志比较大,我以附件形式发上来

www.local.com.rar

5.3 KB, 下载次数: 54


作者: fsm11    时间: 2007-04-03 14:01
070403 10:57:29  mysqld started
070403 10:57:29 Warning: setrlimit returned ok, but didn't change limits. Max open files is 11095 (request: 1050634)
070403 10:57:29 Warning: Changed limits: max_connections: 2048  table_cache: 4518
看看你的mysql连接数,强烈建议你检查程序, 看看是不是用户退出后更本就没有把该用户进成杀掉,还在运行,这样不死我才贵呢!!

[ 本帖最后由 fsm11 于 2007-4-3 14:02 编辑 ]
作者: suek    时间: 2007-04-03 14:10
1G内存的话,建议还是用i386的内核吧
作者: iceblood    时间: 2007-04-03 14:19
要不要我给你看看?把IP 用户/密码 站内短信发给我。
作者: cauhacker    时间: 2007-04-03 16:07
原帖由 xuezongqing 于 2007-4-1 20:39 发表
我托管的服务器机箱用的是千际1U机箱。。散热还是不错滴:)就是价格太贵了


那个箱子散热不错……我晕死!
勤诚的人应该去集体自杀了
作者: gucuiwen    时间: 2007-04-03 16:51
070403 10:57:29 Warning: setrlimit returned ok, but didn't change limits. Max open files is 11095 (request: 1050634)

我也怀疑是程序有问题,执行完后没有释放资源,没见过一个软件要打开那么多文件。
作者: kingstone32    时间: 2007-04-03 19:48
我也曾经怀疑过是程序问题,可是怎么查到底是哪个程序有问题呢?网站就一个SupeSite v4和DZ5.5
作者: xuezongqing    时间: 2007-04-03 21:13
原帖由 cauhacker 于 2007-4-3 16:07 发表


那个箱子散热不错……我晕死!
勤诚的人应该去集体自杀了

我买的那款1U机箱里有十个散热风扇的。。夏天的时候至强2。4G(533外频的)温度在40度左右。反正我去年8月份到现在还没有出过问题。包机箱电源以cpu风扇。算下来近1400元。用着还可以就是价格感觉太贵了

20058821574338.jpg (35.12 KB, 下载次数: 71)

20058821574338.jpg

作者: kingstone32    时间: 2007-04-03 21:30
原帖由 suek 于 2007-4-3 14:10 发表
1G内存的话,建议还是用i386的内核吧


刚刚加了条内存,现在是2G了,只是频率不一样
作者: anthonyfeng    时间: 2007-04-03 22:16
应该在上线前做好测试工作,现在把老板和顾客都得罪了。
作者: sunnypan    时间: 2007-04-04 09:08
建议把apache换成lighttpd,可以省下不少内存。
作者: Coolriver    时间: 2007-04-04 10:58
你的机器那样的负载是很正常的。
目前能做的是调整一下Apache的mpm
<IfModule mpm_prefork_module>
    StartServers          25
    MinSpareServers       25
    MaxSpareServers      50
    ServerLimit         2000
    MaxClients          1500
    MaxRequestsPerChild   10000 #一定要定义这个值
</IfModule>

另外,你的Mysql占用太多资源

请适当减少
[mysqld]
port            = 3306
socket          = /tmp/mysql.sock
skip-locking
key_buffer = 384M
max_allowed_packet = 1M
table_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 32M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8
max_connections=2048

改为:
[mysqld]
port            = 3306
socket          = /tmp/mysql.sock
skip-locking
key_buffer = 256M
max_allowed_packet = 1M
table_cache = 512  #根据你打开表的数量定
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 16M
thread_cache_size = 8
query_cache_size = 16M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8  #实际CPU数理乘2
max_connections=1000 #应该够用了
max_connect_error=1000

这样试一下。
作者: lubber    时间: 2007-04-04 12:47
我用ULE的时候感觉不稳定
作者: kingstone32    时间: 2007-04-04 21:02
原帖由 Coolriver 于 2007-4-4 10:58 发表
你的机器那样的负载是很正常的。
目前能做的是调整一下Apache的mpm
<IfModule mpm_prefork_module>
    StartServers          25
    MinSpareServers       25
    MaxSpareServers      50
...


谢谢,不过我这样调整后论坛不到半个小时就挂了,重启后还出现下面的错误:
Discuz! info: Can not connect to MySQL server

Time: 2007-4-4 9:01pm
Script: /index.php

Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Errno.: 2002

Similar error report has beed dispatched to administrator before.
作者: compnik    时间: 2007-04-04 21:11
呵呵,估计是被dos了
作者: kingstone32    时间: 2007-04-04 21:56
原帖由 compnik 于 2007-4-4 21:11 发表
呵呵,估计是被dos了


机房有硬防的,BSD也装了IPFW,应该可以抵御啊,今天是人太多所以挂掉了,现在把apache 換到 lighttpd 试试,估计是负载过高了
作者: kingstone32    时间: 2007-04-04 22:04
原帖由 lubber 于 2007-4-4 12:47 发表
我用ULE的时候感觉不稳定


那用哪个版本较稳定呢?
作者: HonestQiao    时间: 2007-04-04 22:07
原帖由 kingstone32 于 2007-4-4 21:56 发表


机房有硬防的,BSD也装了IPFW,应该可以抵御啊,今天是人太多所以挂掉了,现在把apache 換到 lighttpd 试试,估计是负载过高了


负载高,也不至于mysql挂掉啊。

挂掉的时候,mysql又是什么提示?
作者: compnik    时间: 2007-04-04 22:42
原帖由 kingstone32 于 2007-4-4 21:56 发表


机房有硬防的,BSD也装了IPFW,应该可以抵御啊,今天是人太多所以挂掉了,现在把apache 換到 lighttpd 试试,估计是负载过高了



换多少个*httpd都没有用
你的问题明显是mysql联接数过多引起的
十之八九是应用层的dos

还是赶快先查清楚是不是单个ip过来的吧,
这种问题居然还讨论半天....
作者: lsstarboy    时间: 2007-04-04 23:43
cpu0 (BSP): APIC ID:  0
cpu1 (AP): APIC ID:  1
ioapic0: Changing APIC ID to 2
ioapic0 <Version 2.0> irqs 0-23 on motherboard
kbd1 at kbdmux0
acpi0: <GBT AWRDACPI> on motherboard
acpi0: Power Button (fixed)
cpu0: <ACPI CPU> on acpi0
acpi_throttle0: <ACPI CPU Throttling> on cpu0
cpu1: <ACPI CPU> on acpi0
acpi_throttle1: <ACPI CPU Throttling> on cpu1
acpi_throttle1: failed to attach P_CNT


楼主的CPU地方已经出现问题。建议换一个能用的32位的SMP内核试试。

64位再加上双核,用更传统的方式也许更安全一些。

[ 本帖最后由 lsstarboy 于 2007-4-4 23:44 编辑 ]
作者: PKkingSon    时间: 2007-04-05 13:36
Prefork 不要那么配置.
ServerLimit 800
MaxClient 640
先看看,其他参数默认

如果装了discuz,请检查下是不是有插件,并在本地装一个干净的discuz,和你正在run的对照一下数据结构.重要是cdb_members和cdb_threads表,看看有没有出现varchar类型的字段,我们在设计这个表的时候,都是按定长设计的。
作者: zhengwei_zw    时间: 2007-04-05 21:25
好象LZ还跑有pgsql
作者: kingstone32    时间: 2007-04-05 23:41
原帖由 HonestQiao 于 2007-4-4 22:07 发表


负载高,也不至于mysql挂掉啊。

挂掉的时候,mysql又是什么提示?


负载高的时候(15分钟1300人在线)是APACHE挂掉了,MYSQL没有报错
作者: kingstone32    时间: 2007-04-05 23:46
原帖由 compnik 于 2007-4-4 22:42 发表



换多少个*httpd都没有用
你的问题明显是mysql联接数过多引起的
十之八九是应用层的dos

还是赶快先查清楚是不是单个ip过来的吧,
这种问题居然还讨论半天....


机房查过,可是基本都是正常流量,自己用IPFW自动封掉50并发的IP,也没有效果
作者: kingstone32    时间: 2007-04-05 23:53
原帖由 lsstarboy 于 2007-4-4 23:43 发表


楼主的CPU地方已经出现问题。建议换一个能用的32位的SMP内核试试。

64位再加上双核,用更传统的方式也许更安全一些。


难道要把CPU换成P4才正常?或者重装成32位的操作系统?
作者: kingstone32    时间: 2007-04-05 23:56
把Apache换成lighttpd后运行DZ论坛更慢了,看来lighttpd只适合运行静态网页,动态还是用apache好,下面是我用lighttpd后top的结果:
last pid: 38737;  load averages:  1.08,  0.98,  0.88    up 1+02:45:36  23:50:58
178 processes: 8 running, 170 sleeping
CPU states: 22.5% user,  0.0% nice, 32.9% system,  0.9% interrupt, 43.6% idle
Mem: 297M Active, 1183M Inact, 294M Wired, 68M Cache, 213M Buf, 8896K Free
Swap: 2002M Total, 2002M Free

  PID USERNAME  THR PRI NICE   SIZE    RES STATE  C   TIME   WCPU COMMAND
38217 root        1  88    0 45932K 36452K RUN    0  78:35 21.78% lighttpd
30774 mysql      27  20    0   330M 89048K kserel 1 133:00 11.18% mysqld
38734 root        1   4    0 21032K  8372K sbwait 0   0:16  3.71% php
31516 root        1   4    0 21216K  8164K sbwait 0   0:14  0.00% php
38733 root        1   4    0 21068K  8400K sbwait 1   0:07  0.00% php
38584 root        1   4    0 20292K  7660K accept 0   0:07  0.00% php
38711 root        1   4    0 21648K  8580K sbwait 1   0:06  0.00% php
31514 root        1   4    0 21212K  8244K sbwait 1   0:05  0.00% php
31512 root        1   4    0 20748K  7812K sbwait 0   0:02  0.00% php
38686 root        1  76    0  7216K  2420K CPU1   1   0:02  0.00% top
  650 root        1  76    0  9468K  2840K select 0   0:02  0.00% sendmail
  492 root        1  76    0  3664K  1048K select 0   0:02  0.00% syslogd
  644 root        1  76    0 19656K  2428K select 0   0:01  0.00% sshd
31510 root        1   4    0 20172K  7300K accept 1   0:01  0.00% php
31508 root        1   4    0 19148K  6284K accept 1   0:01  0.00% php
31504 root        1   4    0 20180K  7304K accept 0   0:00  0.00% php
作者: zonyonq    时间: 2007-04-06 10:46
我不太懂这些,只是看到你日志中有如下信息:

  1. WARNING: / was not properly dismounted
  2. WARNING: /tmp was not properly dismounted
  3. WARNING: /usr was not properly dismounted
  4. /usr: mount pending error: blocks 4 files 0
  5. WARNING: /var was not properly dismounted
复制代码

不知道和这个有没关系呢!
作者: lsstarboy    时间: 2007-04-06 14:55
    root@www.local.com:/usr/obj/usr/src/sys/SuperKernel-SMP-ULE-64bit
Timecounter "i8254" frequency 1193182 Hz quality 0
CPU: Intel(R) Pentium(R) D  CPU 2.66GHz (2660.21-MHz K8-class CPU)
  Origin = "GenuineIntel"  Id = 0xf47  Stepping = 7
  Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
  Features2=0x651d<SSE3,RSVD2,MON,DS_CPL,TM2,CNTX-ID,CX16,XTPR>
  AMD Features=0x20100800<SYSCALL,NX,LM>
  AMD Features2=0x1<LAHF>
  Cores per package: 2


又仔细看了一下楼主的dmesg,应该是用错内核了。你是Intel 奔腾D的处理器,却用了AMD的64位内核。CPU频率后的字符应该是686-class,而你的是K8-class。建议你换一个普通的32位SMP内核试试。如果基本上稳定,再自己编译一个你自己的内核。
BTW:可以cp备份你原来的内核后,直接复制新内核到boot目录就行了。
作者: Momoass    时间: 2007-04-06 14:56
装64位系统,1G的内存也太小了,4G才相当于32位的2G
换lighttpd+FastCGI/PHP看看
作者: seven007    时间: 2007-04-06 15:10
路过
作者: kingstone32    时间: 2007-04-06 17:44
原帖由 Momoass 于 2007-4-6 14:56 发表
装64位系统,1G的内存也太小了,4G才相当于32位的2G
换lighttpd+FastCGI/PHP看看


已经是2G内存,现在用了lighttpd+FastCGI/PHP,15分钟2000多人在线都没问题了,看来是APACHE吃内存吃得厉害
作者: Coolriver    时间: 2007-04-08 12:21
另外请楼主减少一下mysql 的 time_out 值
作者: leeda    时间: 2007-04-17 09:28
关注中~~~~~~~~~~~~~
作者: wangbin    时间: 2007-05-11 22:40
我觉得可能是起初分区不合理的原因吧
作者: wangbin    时间: 2008-09-17 19:38
楼主的问题解决了吗??
作者: pandalinux    时间: 2008-09-17 21:32
看过很多的测试, 64位系统大都比32系统慢. 只有使用4G以上服务器的时候, 我才不得不用64bit 的系统.

而且7以前的FB, 一般建议让MYSQL使用LINUXTHREAD. 而且MYSQL效率一般都很低.

我个人以为, 与其用几个星期找优化方案. 不如备份系统, 上FB 7 + ULE.
作者: wangbin    时间: 2008-09-18 18:23
原帖由 HonestQiao 于 2007-4-2 09:29 发表

从中,我有几个疑问,方可继续判断你的问题,并给提出解决方法:
1. 查看你的/etc/my.cnf,是否使用了蹩脚的配置?
  因为你的物理内存才1G,而你的MySQL就基本要吃完了
  一般是你给MySQL分配了较大的缓存空间
2. apachectl -l看看使用的是prefork还是worker呢?
   apachectl -v看看apache的版本
  因为你的Apache占有内存也真的是非常地大。
  另外还要告诉我们,你到底启用了哪些模块?

因为以上原因,物理内存耗尽,那么必然就去使用交换分区。
交换分区使用频繁,必然导致速度很慢几乎挂掉。
因为使用过多的内存和交换分区,可能导致交换分区都不够使用,出现上面的提示,以及程序异常退出。
...


感谢楼主提供思路!
作者: wangbin    时间: 2008-10-30 02:12
顶起来,让更多人关注!
作者: wangbin    时间: 2008-11-04 03:53
k8 用32位起不来了。
作者: wangbin    时间: 2009-01-05 21:32
原帖由 lsstarboy 于 2007-4-6 14:55 发表


又仔细看了一下楼主的dmesg,应该是用错内核了。你是Intel 奔腾D的处理器,却用了AMD的64位内核。CPU频率后的字符应该是686-class,而你的是K8-class。建议你换一个普通的32位SMP内核试试。如果基本上稳定, ...


我出现同样的问题,但从前用的也是64位的没有问题。
作者: smilecat    时间: 2009-01-06 10:15
台式机吧,感觉好弱的配置哦
作者: wangbin    时间: 2009-05-30 21:13
晕菜啊!!!这样的问题我也遇到了!!
作者: lsstarboy    时间: 2009-05-30 21:37
原帖由 wangbin 于 2009-5-30 21:13 发表
晕菜啊!!!这样的问题我也遇到了!!

练手的绝好机会来了!!!
有时候可是千日难逢啊!!
前些日子遇到一个DELL的烂机器不稳定,一下子硬件操作命令增强了很多。




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2