LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-30-2004, 08:56 AM   #1
Phaethar
Member
 
Registered: Oct 2003
Location: MN
Distribution: CentOS, Fedora
Posts: 182

Rep: Reputation: 30
Limiting child processes in Apache?


I'm trying to find a way to limit the number of child processes that Apache will spawn. The default settings are causing some problems when it opens too many, so I'd like to find a way to set it to around 50 or so. I can't find any value in the httpd.conf file to set this, so I'm hoping someone here might know of how to do it. If possible, I'd like to make sure that these child processes are persistent and just re-used again, rather than being closed and recreated each time. This would be for Apache 2.0 running on Fedora Core1.

Thanks for any advice.
 
Old 04-30-2004, 09:32 AM   #2
Matt Collier
Member
 
Registered: Apr 2004
Distribution: Debian
Posts: 80

Rep: Reputation: 15
settings MaxRequestsPerChild to 0 will stop a child dying after it's served x amount of requests, the amount of clients or threads depends on the MPM version of apache2


##
## 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>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 20
MaxRequestsPerChild 0
</IfModule>

# pthread MPM
# StartServers ......... initial number of server processes to start
# MaxClients ........... maximum number of server processes allowed to start
# 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 2
MaxClients 150
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 (then it dies)

<IfModule perchild.c>
NumServers 5
StartThreads 5
MinSpareThreads 5
MaxSpareThreads 10
MaxThreadsPerChild 20
MaxRequestsPerChild 0
AcceptMutex fcntl
</IfModule>
 
Old 11-02-2004, 06:24 PM   #3
chotgor1
LQ Newbie
 
Registered: Nov 2004
Posts: 3

Rep: Reputation: 0
---------------- BACKGROUND:

H, I have ASUS XP2600 , 512MB RAM, RedHat 9, MySQL 3.23.58, Apache 2.0.40 dedicated server 1 Ethernet card very fast internet connection, running 2 websites..

1. phpbb forum with 700MB database, 14000 registered members, 30-80 constant connected users.. In this forum photo attachments are so often used ..

2. media download site that serves mp3s and mpegs.. most downloaded files are 20-60MB mpegs.. I restricted the number of downloads to certain number and that count restarts in the beginning of every hour.. so every hour 0:00 minute, there is some rush for the users to download media files..

----------------- PROBLEM:

a) I was running the phpbb forum around 1-2 months on the fresh Redhat 9 installation without much of problem.. I moved to this server, so the database and attached files were already in massive size from the beginning.. The server was running very nice & smoothly..

b) I installed my downloads site, and the server started to have problem.. it started to crash once a day, and later on twice a day.. and 2-3 days later it started to become unresponsive almost every hour..

c) Firstly after a reboot its Free Memory starts at 350MB and quickly gets down to 5MB, and after that the CPU load average will start to increase reaching as high as 15-30.. After a while with high load average like that, it stays unresponsive, not answering any more HTTP requests, and the load average will come down to very low like 0.07 shown in below example..
---------------------------------------------------------------------------
00:57:07 up 2:06, 1 user, load average: 0.07, 0.02, 0.52
189 processes: 187 sleeping, 2 running, 0 zombie, 0 stopped
CPU states: 0.1% user 0.0% system 0.0% nice 0.0% iowait 99.8% idle
Mem: 481556k av, 476376k used, 5180k free, 0k shrd, 1644k buff
323948k actv, 0k in_d, 10212k in_c
Swap: 979956k av, 559776k used, 420180k free 209020k cached

PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND
3496 root 15 0 1192 1192 868 R 0.1 0.2 0:00 0 top
1 root 15 0 108 76 56 S 0.0 0.0 0:05 0 init
2 root 15 0 0 0 0 SW 0.0 0.0 0:00 0 keventd
3 root 15 0 0 0 0 SW 0.0 0.0 0:00 0 kapmd
4 root 34 19 0 0 0 SWN 0.0 0.0 0:00 0 ksoftirqd_CPU0
9 root 25 0 0 0 0 SW 0.0 0.0 0:00 0 bdflush
5 root 15 0 0 0 0 SW 0.0 0.0 0:00 0 kswapd
6 root 15 0 0 0 0 SW 0.0 0.0 0:00 0 kscand/DMA
7 root 15 0 0 0 0 SW 0.0 0.0 0:05 0 kscand/Normal
8 root 15 0 0 0 0 SW 0.0 0.0 0:00 0 kscand/HighMem
10 root 15 0 0 0 0 SW 0.0 0.0 0:00 0 kupdated
11 root 25 0 0 0 0 SW 0.0 0.0 0:00 0 mdrecoveryd
15 root 15 0 0 0 0 SW 0.0 0.0 0:00 0 kjournald
73 root 25 0 0 0 0 SW 0.0 0.0 0:00 0 khubd
2258 root 17 0 0 0 0 SW 0.0 0.0 0:00 0 kjournald
2596 root 15 0 196 156 112 S 0.0 0.0 0:00 0 syslogd
2600 root 15 0 60 4 0 S 0.0 0.0 0:00 0 klogd
2618 rpc 23 0 80 4 0 S 0.0 0.0 0:00 0 portmap
2637 rpcuser 25 0 80 4 0 S 0.0 0.0 0:00 0 rpc.statd
2704 root 25 0 56 4 0 S 0.0 0.0 0:00 0 apmd
2741 root 15 0 616 520 372 S 0.0 0.1 0:00 0 sshd
2756 root 24 0 152 4 0 S 0.0 0.0 0:00 0 xinetd
2768 root 25 0 164 4 0 S 0.0 0.0 0:00 0 safe_mysqld
2802 mysql 15 0 22844 7992 696 S 0.0 1.6 2:06 0 mysqld
---------------------------------------------------------------------------

d) or in many cases the mysqld becomes unresponsive, saying the /tmp/mysql.sock file cant be found.. "service mysqld restart" will restart the mysqld but it still doesn work until I do "killall -9 mysqld, killall -9 httpd, service mysqld start, service httpd start"..

Please help me on this issue, I have been trying to solve it by myself in last week trying to change different values in httpd.conf, my.conf .. it still persists becoming totally unresponsive every other hour or at least in 2-3 hours..

Thank you very much in advance,
Kun.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache 2 Child Processes Seg faulting! DavidHayes Linux - Software 1 04-20-2005 08:54 PM
forking 7 child processes ianomc Programming 5 11-07-2004 01:33 PM
Rotatelogs - Do I have too many child processes? fireman949 Linux - Software 2 06-08-2004 03:04 PM
parent and child processes skora Programming 5 11-02-2003 11:41 AM
Apache: limiting the number of processes that start up tarballed Linux - Networking 2 09-02-2003 04:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration