伺服器負載超高,可能與phpwind有關,大家幫忙看看!
內部的一個工作論壇,用phpwind,用二級域名和目錄訪問都超慢,伺服器負載很高,wc -l httpd進程很多,apache worker方式工作,因為沒有root許可權沒法修改httpd.conf,配置文件中沒有對worker模式進行配置(限制),不知是不是因為這個原因,還是程序上有問題。請遇到過類似情況的朋友幫忙看看!不勝感激!!
top - 10:10:55 up 1 day, 23:09, 1 user, load average: 75.07, 75.13, 74.58
Tasks: 144 total, 2 running, 142 sleeping, 0 stopped, 0 zombie
Cpu(s): 98.2%us, 0.2%sy, 0.0%ni, 0.0%id, 1.3%wa, 0.0%hi, 0.3%si, 0.0%st
Mem: 2075520k total, 2021344k used, 54176k free, 53548k buffers
Swap: 2031608k total, 790776k used, 1240832k free, 384132k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3027 daemon 15 0 369m 25m 15m S 43 1.3 768:45.35 httpd
3117 daemon 15 0 371m 26m 15m S 17 1.3 759:11.96 httpd
2943 daemon 17 0 361m 19m 11m S 7 1.0 339:42.22 httpd
2945 daemon 15 0 337m 21m 13m S 7 1.1 341:43.07 httpd
5146 daemon 15 0 273m 30m 14m S 7 1.5 184:22.58 httpd
11105 daemon 15 0 306m 58m 18m S 7 2.9 61:19.49 httpd
13323 daemon 15 0 317m 56m 15m S 7 2.8 47:03.24 httpd
2973 daemon 15 0 296m 22m 14m S 3 1.1 342:23.27 httpd
3055 daemon 15 0 250m 19m 12m S 3 1.0 112:48.98 httpd
3083 daemon 15 0 201m 17m 13m S 3 0.9 114:06.03 httpd
3375 daemon 15 0 193m 42m 14m S 3 2.1 105:57.12 httpd
3485 daemon 15 0 202m 19m 13m S 3 1.0 105:50.03 httpd
3685 daemon 15 0 282m 32m 14m S 3 1.6 211:16.37 httpd
3718 daemon 15 0 263m 41m 14m S 3 2.1 106:25.23 httpd
3746 daemon 18 0 329m 29m 11m S 3 1.4 105:22.71 httpd
4636 daemon 15 0 317m 54m 15m S 3 2.7 91:35.00 httpd
4706 daemon 15 0 225m 50m 15m S 3 2.5 184:08.38 httpd
5060 daemon 15 0 293m 47m 15m S 3 2.4 87:39.68 httpd
5946 daemon 15 0 186m 38m 15m S 3 1.9 85:25.81 httpd
netstat -an | grep TIME_WAIT |wc -l
343
《解決方案》
原帖由 liuwt123 於 2008-6-12 10:30 發表 http://bbs.chinaunix.net/images/common/back.gif
內部的一個工作論壇,用phpwind,用二級域名和目錄訪問都超慢,伺服器負載很高,wc -l httpd進程很多,apache worker方式工作,因為沒有root許可權沒法修改httpd.conf,配置文件中沒有對worker模式進行配置(限制 ...
1.負載很高.速度是正常的.
load average: 75.07, 75.13, 74.58
2.從你提供的情況分析來看是APACHE的問題.具體問題分析,需要你提供
apache的配置文件
apache的錯誤日誌
系統日誌
根據以上三個方面分析一下原因
[ 本帖最後由 todayhero 於 2008-6-12 10:48 編輯 ]
《解決方案》
但是主站的cms和discuz跑得很好!!所以我懷疑是phpwind,或許是配置問題,不知大家看過沒??
《解決方案》
ServerRoot "/httpd/apache"
Listen 80
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule dbd_module modules/mod_dbd.so
LoadModule dumpio_module modules/mod_dumpio.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
LoadModule substitute_module modules/mod_substitute.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule log_forensic_module modules/mod_log_forensic.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule ident_module modules/mod_ident.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule suexec_module modules/mod_suexec.so
LoadModule cgid_module modules/mod_cgid.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php5_module modules/libphp5.so
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
User daemon
Group daemon
</IfModule>
</IfModule>
ServerName XX.XX.XX.XX:80
DocumentRoot "/data/wwwroot"
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/httpd/apache/htdocs">
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.htm index.php default.php default.htm
</IfModule>
#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.ht">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>
ErrorLog "logs/error_log"
LogLevel warn
<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
CustomLog "logs/access_log" common
#CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
ScriptAlias /cgi-bin/ "/httpd/apache/cgi-bin/"
</IfModule>
<IfModule cgid_module>
#
# ScriptSock: On threaded servers, designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#
#Scriptsock logs/cgisock
</IfModule>
#
# "/httpd/apache/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/httpd/apache/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
#
# DefaultType: 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.
#
DefaultType text/plain
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
# For type maps (negotiated resources):
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
</IfModule>
#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off
# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.
# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf
# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf
# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf
# Language settings
#Include conf/extra/httpd-languages.conf
# User home directories
#Include conf/extra/httpd-userdir.conf
# Real-time info on requests and configuration
#Include conf/extra/httpd-info.conf
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf
# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf
# Various default settings
#Include conf/extra/httpd-default.conf
# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
# starting without SSL on platforms with no /dev/random equivalent
# but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
<VirtualHost *>
DocumentRoot /data/wwwroot
ServerName *
</VirtualHost>
配置了多個虛擬主機
《解決方案》
apache日誌里沒有異常內容,因為剛進行了網站改版,大多數都是File does not exist:
《解決方案》
apache載入的無用模塊太多嗎?
《解決方案》
沒仔細看你的配置
但你的httpd進程佔用了太多的內存和cpu
特別是內存的佔用,是非常不正常的,問題應該是出在這裡
再具體的原因還要看到了才知道
《解決方案》
phpwind 的問題,把它一走後負載馬上下來了,沒找出原因!!
top - 18:52:54 up 2 days, 7:51, 1 user, load average: 0.15, 0.07, 0.02
Tasks: 82 total, 1 running, 81 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.8%us, 0.0%sy, 0.0%ni, 99.0%id, 0.0%wa, 0.0%hi, 0.2%si, 0.0%st
Mem: 2075520k total, 1253188k used, 822332k free, 64404k buffers
Swap: 2031608k total, 10540k used, 2021068k free, 828084k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
20836 daemon 18 0 359m 50m 11m S 1 2.5 0:07.25 httpd
20147 daemon 18 0 361m 55m 14m S 0 2.7 0:24.37 httpd
20714 daemon 18 0 360m 51m 11m S 0 2.5 0:08.23 httpd
1 root 15 0 2032 636 544 S 0 0.0 0:00.55 init
2 root RT 0 0 0 0 S 0 0.0 0:00.00 migration/0
3 root 34 19 0 0 0 S 0 0.0 0:00.00 ksoftirqd/0
4 root RT 0 0 0 0 S 0 0.0 0:00.00 watchdog/0
《解決方案》
問題一:樓主的 phpwind 與cms discuz 在同一台機器?
問題二:配置文件無用內容太多 用的worker 也可以,但是配置優化沒有貼出來呀。
grep -v "#" httpd.conf 過濾下#號。
由於 phpwind 引起的話,可以對phpwind 進行調整 phpwind 我不是特別了解。
但可以先優化 APACHE PHP
如果不行可以換成nginx 試下。
《解決方案》
phpwind 本公司也是用這個呀,怕