RadarURL
Skip to content
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

질문 :

Hi, our servers are running mediawiki and at certain times of the day it's taking 100% of the cpu load with only 12req/s according to mod_status.
Do you guys have any idea what's causing this?

Here's the server specs:
Windows 2003 Server SP1
Apache 2.0.58 (using apache2handler for php)
PHP 5.2.6

Xeon 5110 1.6hz CPU
4Gigs of ram


Any help would be greatly appreciated!Thanks in advance!

 

답변 :

Often some PHP extensions causes such a CPU load. Try to disable all not needed PHP extensions in your php.ini
You also can try to run PHP over fcgid and separate PHP from the httpd processes.

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Hello all. I am having a similar issue. It has plagued me since I started using Apache pretty much.

Dual 2.4 ghz/4gb/Win2k3 sp1. I had been using 5.2.6 php, Apache2.2.9, but recently upgraded to PHP version 5.2.8 and Apache 2.2.11. MySQL runs on another machine entirely.

Problem: httpd.exe grows at an astonishing rate. It grows to ~550 megs in about 6 minutes under small load, and in about 2 minutes under heavy load. At about the mid 500-600 meg memory usage, Apache restarts. At the time of restart, I still have over 1.5 gb of free memory.

Code:
[Tue Jan 27 04:23:39 2009] [notice] Apache/2.2.11 (Win32) configured -- resuming normal operations
[Tue Jan 27 04:23:39 2009] [notice] Server built: Dec 10 2008 00:10:06
[Tue Jan 27 04:23:39 2009] [notice] Parent: Created child process 2492
[Tue Jan 27 04:23:39 2009] [notice] Disabled use of AcceptEx() WinSock2 API
[Tue Jan 27 04:23:39 2009] [notice] Child 2492: Child process is running
[Tue Jan 27 04:23:39 2009] [notice] Child 2492: Acquired the start mutex.
[Tue Jan 27 04:23:39 2009] [notice] Child 2492: Starting 1700 worker threads.
[Tue Jan 27 04:23:39 2009] [notice] Child 2492: Listening on port 80.
[Tue Jan 27 04:27:24 2009] [notice] Parent: Received shutdown signal -- Shutting down the server.


I have tried just about every combination of values for the following settings in httpd.conf:

Code:
KeepAlive On
KeepAliveTimeout 10
MaxKeepAliveRequests 5000

<IfModule mpm_winnt.c>
ThreadLimit 1920
ThreadsPerChild 1800
MaxRequestsPerChild 0
</IfModule>


I was excited to see a new version of eAccelerator so I gave that a try and it crashes PHP within 15 minutes guaranteed with the following error:

Code:
zend_mm_heap corrupted
Error in my_thread_global_end(): 1382 threads didn't exit


...where threads is any value from 1 to 2000.

As a last resort, last night I attempted to replace apache2php2_2.dll with mod fcgi. I could not get it to work. The only 2 outcomes from configuring my Apache for fcgi were either:

1. permission on php files denied.
2. user promted to download php file.

So i reverted to the apache2php, disabled eAccelerator, and im back in the same boat of Apache bloating to 600 megs in under 5-10 minutes, restarting, and a completely pegged CPU.

I understand this is a lot of stuff, and that I really shouldnt be using windows, but ive done my due diligence here and would love some help here as im obviously over my head.

My wish list:

1. run Apache in some config so that it runs stable, doesnt restart or crash
2. keep my server CPUs from constantly being at 100% usage with only moderate traffic.
3. get eAccelerator and fcgi to work without crashing PHP and causing Apache to stop and not restart.

Thanks all!

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Update: I switched from php5apache2_2.dll to using mod_fcgid and my memory issues are resolved. it took over 3 hours for apache to climb to 200 mb today using this setup. On a side note, eAccelerator seems to behave better with fcgid over php5apache2_2.dll.

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Fastcgi is running PHP not as module, but over the binary as cgi. The f(ast)cgid(daemon) keeps the process alive so apache does not have to start it new for every request. which makes it faster over regular cgi.

For a setup on debian / ubuntu see http://www.howtoforge.com/how-to-set-up-apache2-with-mod_fcgid-and-php5-on-ubuntu-8.10

just a every short example without explaining. For more details see the docs => http://fastcgi.coremail.cn/configuration.htm

fcgid.conf

Code:

<IfModule mod_fcgid.c>
        AddHandler fcgid-script .fcgi
        IPCConnectTimeout 20
</IfModule>


Starter-Script
Code:

#!/bin/sh
PHPRC="/etc/php5/"
PHP_FCGI_MAX_REQUESTS=5000
export PHPRC
export PHP_FCGI_MAX_REQUESTS
exec /usr/bin/php5-cgi


vHost-Config
Code:

<VirtualHost <ip>:80>
        ServerName <ip>
        ServerAdmin webmaster@example.com
        DocumentRoot /var/www/default/html/
        ErrorLog /var/www/default/logs/error.log
        LogLevel warn
        CustomLog /var/www/default/logs/access.log actra

        SuexecUserGroup apache-default apache-default
        AddHandler fcgid-script .php
        AddHandler cgi-script .pl .cgi

        <Directory /var/www/default/html/>
                Options Indexes FollowSymLinks MultiViews +ExecCGI
                FCGIWrapper /var/www/default/php-fcgi/php-fcgi-starter .php
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>

 

출처 : http://www.apachelounge.com/viewtopic.php?t=2851

?

List of Articles
번호 제목 글쓴이 날짜 조회 수
71 한 서버에 여러개의 SSL 인증서 사용 하는 방법 JaeSoo 2013.03.01 4202
70 톰캣 8 소개 JAESOO 2016.01.01 338
69 윈도우에서 아파치2.2.2, Php5.3.13, FastCGI 설치하기 JaeSoo 2013.03.08 3411
68 윈도우에 아파치 설치 2.2.3 httpd.conf 완전분해 JaeSoo 2013.02.20 5048
67 웹서버 속도 저하 문제 해결 (xp,Apache 2.2.X, XAMPP) JaeSoo 2010.04.05 5837
66 웹서버 속도 저하 문제 해결 (Apache 2.2.x) - Win32DisableAcceptEx JaeSoo 2012.07.14 2676
65 외부 링크 방지 JaeSoo 2011.09.22 6112
64 아파치 환경에서의 SSL 구성하기 JaeSoo 2013.02.26 1697
63 아파치 프로세스의 메모리 사용량 줄이기 JaeSoo 2011.06.01 9324
62 아파치 웹 서버 장애 해결하기 JaeSoo 2012.09.08 1830
61 아파치 리라이트(rewrite) 엔진과 워터마킹을 이용한 이미지 무단 링크 방지 JaeSoo 2012.03.07 2936
60 아파치 로그분석 webalizer 설치 JAESOO 2014.12.21 481
59 아파치 mod rewrite 모듈 사용관련 옵션 JaeSoo 2013.04.18 3734
58 아파치 httpd.conf 재시작 없이 설정 적용하기 JAESOO 2016.05.02 270
57 싸이트 외부링크 차단하는방법 JaeSoo 2011.02.19 7187
56 불법웹(이미지) 링크 차단에 대한 설정법 JaeSoo 2011.09.22 7315
55 보안서버(SSL) 도입 의무화를 위반하면?? JaeSoo 2013.02.26 3141
54 보안서버 구축 의무화, A부터 Z까지 ("이달부터 벌금?"…) JaeSoo 2013.02.26 3529
53 리눅스 아파치 로그 뷰어 webalizer, utf-8로 변환하기 JAESOO 2014.12.22 544
52 리눅스 사용자 계정별 웹서버 운영하기 JAESOO 2014.05.27 1872
Board Pagination Prev 1 2 3 4 Next
/ 4

PageViews   Today : 10683 Yesterday : 5037 Total : 21966735  /  Counter Status   Today : 10330 Yesterday : 4602 Total : 1193053

Edited by JAESOO

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


이 PC에는 나눔글꼴이 설치되어 있지 않습니다.

이 사이트를 나눔글꼴로 보기 위해서는
나눔글꼴을 설치해야 합니다.

설치 취소