Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

關於apache

[复制链接]
豪劍 发表于 2004-5-2 08:50:50 | 显示全部楼层 |阅读模式
我的伺服器又出現問題了,重啟後數分鐘就慢起來,然後掛了
我查到是有兩三個apache進程竟佔cpu資源20%  
請問究竟什麼問題會引致這樣啊
cqfanli 发表于 2004-5-2 14:36:32 | 显示全部楼层
不知道您的httpd.conf文件是怎么配置的,不好查呀
您至少要给出httpd.conf的某些设定值,或者top的截图吧
回复

使用道具 举报

 楼主| 豪劍 发表于 2004-5-2 20:16:17 | 显示全部楼层
Originally posted by cqfanli at 2004-5-2 02:36 PM:
不知道您的httpd.conf文件是怎么配置的,不好查呀
您至少要给出httpd.conf的某些设定值,或者top的截图吧

httpd.conf

#
# Based upon the NCSA server configuration files originally by Rob McCool.
#
# This is the main Apache server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs-2.0/> for detailed information about
# the directives.
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned.  
#
# The configuration directives are grouped into three basic sections:
#  1. Directives that control the operation of the Apache server process as a
#     whole (the 'global environment').
#  2. Directives that define the parameters of the 'main' or 'default' server,
#     which responds to requests that aren't handled by a virtual host.
#     These directives also provide default values for the settings
#     of all virtual hosts.
#  3. Settings for virtual hosts, which allow Web requests to be sent to
#     different IP addresses or hostnames and have them handled by the
#     same Apache server process.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path.  If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo.log"
# with ServerRoot set to "/usr/local/apache_2.0.47" will be interpreted by the
# server as "/usr/local/apache_2.0.47/logs/foo.log".
#

### Section 1: Global Environment
#
# The directives in this section affect the overall operation of Apache,
# such as the number of concurrent requests it can handle or where it
# can find its configuration files.
#

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# NOTE!  If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the LockFile documentation (available
# at <URL:http://httpd.apache.org/docs-2.0/mod/mpm_common.html#lockfile>);
# you will save yourself a lot of trouble.
#
# Do NOT add a slash at the end of the directory path.
#
ServerRoot "/usr/local/apache_2.0.47"

#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
<IfModule !mpm_winnt.c>
<IfModule !mpm_netware.c>
# LockFile logs/accept.lock
</IfModule>
</IfModule>

#
# ScoreBoardFile: File used to store internal server process information.
# If unspecified (the default), the scoreboard will be stored in an
# anonymous shared memory segment, and will be unavailable to third-party
# applications.
# If specified, ensure that no two invocations of Apache share the same
# scoreboard file. The scoreboard file MUST BE STORED ON A LOCAL DISK.
#
<IfModule !mpm_netware.c>
<IfModule !perchild.c>
# ScoreBoardFile logs/apache_runtime_status
</IfModule>
</IfModule>


#
# PidFile: The file in which the server should record its process
# identification number when it starts.
#
<IfModule !mpm_netware.c>
#PidFile logs/httpd.pid
PidFile /var/run/httpd.pid
</IfModule>

#
# Timeout: The number of seconds before receives and sends time out.
#
TimeOut 100

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive off

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15

##
## Server-Pool Size Regulation (MPM specific)
##

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves

<IfModule prefork.c>
ServerLimit       3000
StartServers       20
MaxClients        1900
#MinSpareThreads     25
#MaxSpareThreads     75
#ThreadsPerChild     50
#MaxRequestsPerChild  1000

#StartServers       8
#MinSpareServers    5
#MaxSpareServers   20
#MaxClients       512
#ServerLimit 1024
#MaxRequestsPerChild  1000
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule worker.c>
StartServers        20
MaxClients        1900
MinSpareThreads     25
MaxSpareThreads     75
ThreadsPerChild     25
MaxRequestsPerChild  0
</IfModule>

# perchild MPM
# NumServers: constant number of server processes
# StartThreads: initial number of worker threads in each server process
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# MaxThreadsPerChild: maximum number of worker threads in each server process
# MaxRequestsPerChild: maximum number of connections per server process
<IfModule perchild.c>
NumServers           5
StartThreads         5
MinSpareThreads      5
MaxSpareThreads     10
MaxThreadsPerChild  20
MaxRequestsPerChild  0
</IfModule>

# WinNT MPM
# ThreadsPerChild: constant number of worker threads in the server process
# MaxRequestsPerChild: maximum  number of requests a server process serves
<IfModule mpm_winnt.c>
ThreadsPerChild 300
MaxRequestsPerChild  0
</IfModule>

# BeOS MPM
# StartThreads: how many threads do we initially spawn?
# MaxClients:   max number of threads we can have (1 thread == 1 client)
# MaxRequestsPerThread: maximum number of requests each thread will process
<IfModule beos.c>
StartThreads               10
MaxClients                 1900
MaxRequestsPerThread       10000
</IfModule>   

# NetWare MPM
# ThreadStackSize: Stack size allocated for each worker thread
# StartThreads: Number of worker threads launched at server startup
# MinSpareThreads: Minimum number of idle threads, to handle request spikes
# MaxSpareThreads: Maximum number of idle threads
# MaxThreads: Maximum number of worker threads alive at the same time
# MaxRequestsPerChild: Maximum  number of requests a thread serves. It is
#                      recommended that the default value of 0 be set for this
#                      directive on NetWare.  This will allow the thread to
#                      continue to service requests indefinitely.                          
<IfModule mpm_netware.c>
ThreadStackSize      65536
StartThreads           250
MinSpareThreads         25
MaxSpareThreads        250
MaxThreads            1000
MaxRequestsPerChild      0
</IfModule>

# OS/2 MPM
# StartServers: Number of server processes to maintain
# MinSpareThreads: Minimum number of idle threads per process,
#                  to handle request spikes
# MaxSpareThreads: Maximum number of idle threads per process
# MaxRequestsPerChild: Maximum number of connections per server process
<IfModule mpmt_os2.c>
StartServers           2
MinSpareThreads        5
MaxSpareThreads       10
MaxRequestsPerChild    0
</IfModule>

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
# Listen 12.34.56.78:80

Listen *:80
回复

使用道具 举报

 楼主| 豪劍 发表于 2004-5-2 20:22:52 | 显示全部楼层
硬件配置:
p4 2.4g
512ddr ram
一個10分鐘 300人的論壇
2個10分鐘 50人的論壇
3個10分鐘10人以下的論壇


全部都是d2
回复

使用道具 举报

cqfanli 发表于 2004-5-3 01:13:04 | 显示全部楼层
<IfModule prefork.c>
ServerLimit       3000
StartServers       20
MaxClients        1900
#MinSpareThreads     25
#MaxSpareThreads     75
#ThreadsPerChild     50
#MaxRequestsPerChild  1000

#StartServers       8
#MinSpareServers    5
#MaxSpareServers   20
#MaxClients       512
#ServerLimit 1024
#MaxRequestsPerChild  1000
</IfModule>

呵呵,这些设置我觉得不合理,你全部改为默认值,肯定一切就好了
回复

使用道具 举报

 楼主| 豪劍 发表于 2004-5-7 13:46:46 | 显示全部楼层
Originally posted by cqfanli at 2004-5-3 01:13 AM:
<IfModule prefork.c>
ServerLimit       3000
StartServers       20
MaxClients        1900
#MinSpareThreads     25
#MaxSpareThreads     75
#ThreadsPerChild     50
#MaxRequestsPerChild  1 ...

已查出問題了,發覺是其中一個論壇有問題,停用了就沒有問題,但不停用,server 的cpu資源立即就被數個apachr進程(竟然一個可以佔2x%)
然後server便當了
回复

使用道具 举报

UP.Linux 发表于 2004-5-8 09:52:26 | 显示全部楼层
值开的太大了,超出了你系统的承受能力了。
这样的值不修改一下,早晚还有这样的情况。
回复

使用道具 举报

 楼主| 豪劍 发表于 2004-5-21 23:52:29 | 显示全部楼层
Originally posted by UP.Linux at 2004-5-8 09:52 AM:
值开的太大了,超出了你系统的承受能力了。
这样的值不修改一下,早晚还有这样的情况。

那項值呢請問?
回复

使用道具 举报

 楼主| 豪劍 发表于 2004-5-21 23:54:47 | 显示全部楼层
apache佔2x%已解決,不過一到高峰時,就會無法顯示網頁,我想應該是apache問題,不知哪個設定值可以防止這情況發生
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-12-23 05:20 , Processed in 0.028484 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表