1GB VPS - Apache Worker MPM - FCGID - Max concurrent connections - RAM CAP

1 post / 0 new
#1 Tue, 03/26/2013 - 09:07
kiteplans

1GB VPS - Apache Worker MPM - FCGID - Max concurrent connections - RAM CAP

Hi,

I have spent a week or two researching and setting up my server to run Apache with the Worker MPM and FCID. I am trying to optimize it to allow for the most concurrent connections possible. It has been a nightmare to find good info on the Worker MPM.

Server - 1GB RAM (With Apache turned off its only using about 150MB of RAM) I would like Apache to have a memory usage CAP of about 750MB - so that my server will never run out of RAM.

I have been running the server for about 2 years without any problems - but we have recently started streaming MP3`s and this requires more concurrent connections. The server has also had a few minor DDOS attacks - so I trimmed the settings down a ton to prevent the server from running out of memory - I also added some firewall rules to rate limit.

The set up I have now looks like its working well - but I am getting some Segmentation fault errors

[Sat Mar 23 03:19:50 2013] [notice] child pid 28351 exit signal Segmentation fault (11)
[Sat Mar 23 03:56:20 2013] [notice] child pid 29740 exit signal Segmentation fault (11)
*** glibc detected *** /usr/sbin/httpd.worker: malloc(): memory corruption: 0xb83abdd8 ***

And some Out of Memory Errors

Out of memory during array extend.

I am also just afraid that I have trimmed things down too much!

This is my current set up, I would really appreciate some advice.

Apache Settings:

Timeout 30
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 2
#####################
# Spawn 2 child processes, spawning 25 threads for each child process.
# So, a pool of 50 threads is left up and sleeping, ready to serve incoming requests.
# If more requests will come in, apache will spawn new child processes, each one spawning 25 threads,
# enlarging the thread pool until the total number of threads become 50. In that case, apache begin
# to cleanly drop processes, trying to reach 25 threads.
# New processes and its threads are spawned in case of a large spike of requests, until 200 parallel
# client requests are reached, then apache will no longer accept new incoming connections.
# When the load calm down, and requests come back under 200 parallel connections, apache will continue
# to accept connections. After 25, 000 requests served by a child, q. 1000 per thread, the process
# get closed by the father to ensure no memory leak is fired.
<IfModule worker.c>
ServerLimit      16
StartServers         2
MaxClients       400
MinSpareThreads   25
MaxSpareThreads  50
ThreadsPerChild    25
MaxRequestsPerChild  1000
ThreadLimit          64
ThreadStackSize      1048576
</IfModule>
#####################

And then some settings in fcgid.conf

FcgidMinProcessesPerClass 0
FcgidMaxProcessesPerClass 8
FcgidMaxProcesses  25
FcgidIdleTimeout 60
FcgidProcessLifeTime 120
FcgidIdleScanInterval 30