Reducing Apache Memory usage and Average Process Size ValueReduce number of Apache processesWhy so much maxrequestworkers suggestion by apachebuddy?Apache crashing VPS - need to reduce memory usageApache and memory usageApache memory usage optimizationHow to reduce memory usage per virtual serverApache Start Servers, Min/Max Spare Servers Ram Consumption InfluenceUnderused Apache server raise MaxRequestWorkers reached: memory leak?How can I know how much virtual memory apache service is usingOptimize Apache for high concurrent requestsIs Apache Prefork working fast then Worker MPM to serve static content?Apache uses 100% CPU but only part of RAM on heavy load
Is there a DSLR/mirorless camera with minimal options like a classic, simple SLR?
Printing Pascal’s triangle for n number of rows in Python
Teaching a class likely meant to inflate the GPA of student athletes
Is using 'echo' to display attacker-controlled data on the terminal dangerous?
Can a human be transformed into a Mind Flayer?
Excel division by 0 error when trying to average results of formulas
Increase speed altering column on large table to NON NULL
60s or 70s novel about Empire of Man making 1st contact with 1st discovered alien race
Advantages of the Exponential Family: why should we study it and use it?
If there's something that implicates the president why is there then a national security issue? (John Dowd)
Why did Intel abandon unified CPU cache?
How creative should the DM let an artificer be in terms of what they can build?
PDF vs. PNG figure: why does figure load so much faster even if file sizes are the same?
How can I deal with uncomfortable silence from my partner?
Can I utilise a baking stone to make crepes?
How to hide rifle during medieval town entrance inspection?
How to safely destroy (a large quantity of) valid checks?
How to trick the reader into thinking they're following a redshirt instead of the protagonist?
What is the purpose of bonds within an investment portfolio?
Bb13b9 confusion
Which languages would be most useful in Europe at the end of the 19th century?
Is it legal for a bar bouncer to confiscate a fake ID
UTC timestamp format for launch vehicles
Return a String containing only alphabets without spaces
Reducing Apache Memory usage and Average Process Size Value
Reduce number of Apache processesWhy so much maxrequestworkers suggestion by apachebuddy?Apache crashing VPS - need to reduce memory usageApache and memory usageApache memory usage optimizationHow to reduce memory usage per virtual serverApache Start Servers, Min/Max Spare Servers Ram Consumption InfluenceUnderused Apache server raise MaxRequestWorkers reached: memory leak?How can I know how much virtual memory apache service is usingOptimize Apache for high concurrent requestsIs Apache Prefork working fast then Worker MPM to serve static content?Apache uses 100% CPU but only part of RAM on heavy load
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I know that question is little long but i choosed to describe each and every aspect which i observed from my end.
I am using a Linux server, OS used is Ubuntu 14.04, all rest configurations are defined below. This Web server is used for serving application built up in PHP, Databse is hosted over RDS. On an average at peak times there are nearly 200 concurrent requests on server, which ends up in 100% memory utilization. Due to this application becomes very slow or sometimes responds back with error. So i followed some steps to get this resolved, which i have listed below, and tried to tune apache and restrict it for odd situations.
OS
NAME="Ubuntu"
VERSION="14.04.5 LTS
Server Configuration
CPU: 8 Cores
RAM: 15 GB
Hardware Provider: AWS
Instance Type: c4.2xlarge
Apache.Conf Parameters (2.4)
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
HostnameLookups Off
LogLevel warn
AllowOverride all (for document root of application)
MPM USED: prefork
MPM_PREFORK.CONF
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 256
MaxConnectionsPerChild 200
Mods_Enabled
access_compat.load autoindex.load mime.load setenvif.load
alias.conf deflate.conf mpm_prefork.conf socache_shmcb.load
alias.load deflate.load mpm_prefork.load ssl.conf
authn_core.load dir.conf negotiation.conf ssl.load
authn_file.load dir.load negotiation.load status.conf
authz_core.load env.load php5.conf status.load
authz_host.load filter.load php5.load
authz_user.load headers.load rewrite.load
autoindex.conf mime.conf setenvif.conf
Average Apache process size
Command used:
sudo ps -ylC apache2 | awk 'x += $8;y += 1 END print "Apache Memory Usage (MB): "x/1024; print "Average Process Size (MB): "x/((y-1)*1024)' <br/>
Apache Memory Usage (MB): 7227.66
Average Process Size (MB): 314.246
Calculation of MaxRequestWorkers
X = Dedicated RAM which i want to allocate to Apache (13GB): 13312 MB
Y = Average Process size which i am monitoring from last 15 days over server: 314.246
MaxRequestWorkers = X/Y = 40 approx
MPM USED: prefork
Modified MPM_PREFORK.CONF
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 40
MaxConnectionsPerChild 8
Now when apache starts, it will start 5 startservers process and each startserver process will start 8 child connections so in total 40 concurrent connections can be made to the server. MaxRequestWorkers are limited to 40, which will not go beyond 40 concurrent requests, Which will prevent in case of DOS, DDOS or protect server from getting halt by occupying maximum ram of 13GB, leaving 2GB RAM free for server.
I am also not clear about MaxConnectionsPerChild parameter, please make me correct if i am using this wrong.
PHP.INI Parametrs (php5)
OLD
output_buffering = 4096
max_execution_time = 60
memory_limit = -1
log_errors = On
NEW
output_buffering = 4096
max_execution_time = 60
memory_limit = 64M
log_errors = On
ISSUES WHICH ARE STILL FACED BY ME
After changing the mpm_prefork_conf memory utilization came down but server responds back with 503 error to many clients due to MaxRequestWorkers parameter. I tried to figure out why my each apache process is using 315MB of RAM, i googled around 2 days and was not able to find the right path to further troubleshoot this. So finally i posted this over here. I have two options now.
To optimize the apache average process limit and increase the MaxRequestWorkers limit.
To increase RAM and serve clients with same average process size, which i think would not be a right choice.
Kindly guide me with the right suggestions how can i identify and reduce the average process size of apache with php. Please genuine answers only.
apache-2.4 php5 memory-usage
add a comment |
I know that question is little long but i choosed to describe each and every aspect which i observed from my end.
I am using a Linux server, OS used is Ubuntu 14.04, all rest configurations are defined below. This Web server is used for serving application built up in PHP, Databse is hosted over RDS. On an average at peak times there are nearly 200 concurrent requests on server, which ends up in 100% memory utilization. Due to this application becomes very slow or sometimes responds back with error. So i followed some steps to get this resolved, which i have listed below, and tried to tune apache and restrict it for odd situations.
OS
NAME="Ubuntu"
VERSION="14.04.5 LTS
Server Configuration
CPU: 8 Cores
RAM: 15 GB
Hardware Provider: AWS
Instance Type: c4.2xlarge
Apache.Conf Parameters (2.4)
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
HostnameLookups Off
LogLevel warn
AllowOverride all (for document root of application)
MPM USED: prefork
MPM_PREFORK.CONF
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 256
MaxConnectionsPerChild 200
Mods_Enabled
access_compat.load autoindex.load mime.load setenvif.load
alias.conf deflate.conf mpm_prefork.conf socache_shmcb.load
alias.load deflate.load mpm_prefork.load ssl.conf
authn_core.load dir.conf negotiation.conf ssl.load
authn_file.load dir.load negotiation.load status.conf
authz_core.load env.load php5.conf status.load
authz_host.load filter.load php5.load
authz_user.load headers.load rewrite.load
autoindex.conf mime.conf setenvif.conf
Average Apache process size
Command used:
sudo ps -ylC apache2 | awk 'x += $8;y += 1 END print "Apache Memory Usage (MB): "x/1024; print "Average Process Size (MB): "x/((y-1)*1024)' <br/>
Apache Memory Usage (MB): 7227.66
Average Process Size (MB): 314.246
Calculation of MaxRequestWorkers
X = Dedicated RAM which i want to allocate to Apache (13GB): 13312 MB
Y = Average Process size which i am monitoring from last 15 days over server: 314.246
MaxRequestWorkers = X/Y = 40 approx
MPM USED: prefork
Modified MPM_PREFORK.CONF
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 40
MaxConnectionsPerChild 8
Now when apache starts, it will start 5 startservers process and each startserver process will start 8 child connections so in total 40 concurrent connections can be made to the server. MaxRequestWorkers are limited to 40, which will not go beyond 40 concurrent requests, Which will prevent in case of DOS, DDOS or protect server from getting halt by occupying maximum ram of 13GB, leaving 2GB RAM free for server.
I am also not clear about MaxConnectionsPerChild parameter, please make me correct if i am using this wrong.
PHP.INI Parametrs (php5)
OLD
output_buffering = 4096
max_execution_time = 60
memory_limit = -1
log_errors = On
NEW
output_buffering = 4096
max_execution_time = 60
memory_limit = 64M
log_errors = On
ISSUES WHICH ARE STILL FACED BY ME
After changing the mpm_prefork_conf memory utilization came down but server responds back with 503 error to many clients due to MaxRequestWorkers parameter. I tried to figure out why my each apache process is using 315MB of RAM, i googled around 2 days and was not able to find the right path to further troubleshoot this. So finally i posted this over here. I have two options now.
To optimize the apache average process limit and increase the MaxRequestWorkers limit.
To increase RAM and serve clients with same average process size, which i think would not be a right choice.
Kindly guide me with the right suggestions how can i identify and reduce the average process size of apache with php. Please genuine answers only.
apache-2.4 php5 memory-usage
add a comment |
I know that question is little long but i choosed to describe each and every aspect which i observed from my end.
I am using a Linux server, OS used is Ubuntu 14.04, all rest configurations are defined below. This Web server is used for serving application built up in PHP, Databse is hosted over RDS. On an average at peak times there are nearly 200 concurrent requests on server, which ends up in 100% memory utilization. Due to this application becomes very slow or sometimes responds back with error. So i followed some steps to get this resolved, which i have listed below, and tried to tune apache and restrict it for odd situations.
OS
NAME="Ubuntu"
VERSION="14.04.5 LTS
Server Configuration
CPU: 8 Cores
RAM: 15 GB
Hardware Provider: AWS
Instance Type: c4.2xlarge
Apache.Conf Parameters (2.4)
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
HostnameLookups Off
LogLevel warn
AllowOverride all (for document root of application)
MPM USED: prefork
MPM_PREFORK.CONF
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 256
MaxConnectionsPerChild 200
Mods_Enabled
access_compat.load autoindex.load mime.load setenvif.load
alias.conf deflate.conf mpm_prefork.conf socache_shmcb.load
alias.load deflate.load mpm_prefork.load ssl.conf
authn_core.load dir.conf negotiation.conf ssl.load
authn_file.load dir.load negotiation.load status.conf
authz_core.load env.load php5.conf status.load
authz_host.load filter.load php5.load
authz_user.load headers.load rewrite.load
autoindex.conf mime.conf setenvif.conf
Average Apache process size
Command used:
sudo ps -ylC apache2 | awk 'x += $8;y += 1 END print "Apache Memory Usage (MB): "x/1024; print "Average Process Size (MB): "x/((y-1)*1024)' <br/>
Apache Memory Usage (MB): 7227.66
Average Process Size (MB): 314.246
Calculation of MaxRequestWorkers
X = Dedicated RAM which i want to allocate to Apache (13GB): 13312 MB
Y = Average Process size which i am monitoring from last 15 days over server: 314.246
MaxRequestWorkers = X/Y = 40 approx
MPM USED: prefork
Modified MPM_PREFORK.CONF
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 40
MaxConnectionsPerChild 8
Now when apache starts, it will start 5 startservers process and each startserver process will start 8 child connections so in total 40 concurrent connections can be made to the server. MaxRequestWorkers are limited to 40, which will not go beyond 40 concurrent requests, Which will prevent in case of DOS, DDOS or protect server from getting halt by occupying maximum ram of 13GB, leaving 2GB RAM free for server.
I am also not clear about MaxConnectionsPerChild parameter, please make me correct if i am using this wrong.
PHP.INI Parametrs (php5)
OLD
output_buffering = 4096
max_execution_time = 60
memory_limit = -1
log_errors = On
NEW
output_buffering = 4096
max_execution_time = 60
memory_limit = 64M
log_errors = On
ISSUES WHICH ARE STILL FACED BY ME
After changing the mpm_prefork_conf memory utilization came down but server responds back with 503 error to many clients due to MaxRequestWorkers parameter. I tried to figure out why my each apache process is using 315MB of RAM, i googled around 2 days and was not able to find the right path to further troubleshoot this. So finally i posted this over here. I have two options now.
To optimize the apache average process limit and increase the MaxRequestWorkers limit.
To increase RAM and serve clients with same average process size, which i think would not be a right choice.
Kindly guide me with the right suggestions how can i identify and reduce the average process size of apache with php. Please genuine answers only.
apache-2.4 php5 memory-usage
I know that question is little long but i choosed to describe each and every aspect which i observed from my end.
I am using a Linux server, OS used is Ubuntu 14.04, all rest configurations are defined below. This Web server is used for serving application built up in PHP, Databse is hosted over RDS. On an average at peak times there are nearly 200 concurrent requests on server, which ends up in 100% memory utilization. Due to this application becomes very slow or sometimes responds back with error. So i followed some steps to get this resolved, which i have listed below, and tried to tune apache and restrict it for odd situations.
OS
NAME="Ubuntu"
VERSION="14.04.5 LTS
Server Configuration
CPU: 8 Cores
RAM: 15 GB
Hardware Provider: AWS
Instance Type: c4.2xlarge
Apache.Conf Parameters (2.4)
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
HostnameLookups Off
LogLevel warn
AllowOverride all (for document root of application)
MPM USED: prefork
MPM_PREFORK.CONF
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 256
MaxConnectionsPerChild 200
Mods_Enabled
access_compat.load autoindex.load mime.load setenvif.load
alias.conf deflate.conf mpm_prefork.conf socache_shmcb.load
alias.load deflate.load mpm_prefork.load ssl.conf
authn_core.load dir.conf negotiation.conf ssl.load
authn_file.load dir.load negotiation.load status.conf
authz_core.load env.load php5.conf status.load
authz_host.load filter.load php5.load
authz_user.load headers.load rewrite.load
autoindex.conf mime.conf setenvif.conf
Average Apache process size
Command used:
sudo ps -ylC apache2 | awk 'x += $8;y += 1 END print "Apache Memory Usage (MB): "x/1024; print "Average Process Size (MB): "x/((y-1)*1024)' <br/>
Apache Memory Usage (MB): 7227.66
Average Process Size (MB): 314.246
Calculation of MaxRequestWorkers
X = Dedicated RAM which i want to allocate to Apache (13GB): 13312 MB
Y = Average Process size which i am monitoring from last 15 days over server: 314.246
MaxRequestWorkers = X/Y = 40 approx
MPM USED: prefork
Modified MPM_PREFORK.CONF
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 40
MaxConnectionsPerChild 8
Now when apache starts, it will start 5 startservers process and each startserver process will start 8 child connections so in total 40 concurrent connections can be made to the server. MaxRequestWorkers are limited to 40, which will not go beyond 40 concurrent requests, Which will prevent in case of DOS, DDOS or protect server from getting halt by occupying maximum ram of 13GB, leaving 2GB RAM free for server.
I am also not clear about MaxConnectionsPerChild parameter, please make me correct if i am using this wrong.
PHP.INI Parametrs (php5)
OLD
output_buffering = 4096
max_execution_time = 60
memory_limit = -1
log_errors = On
NEW
output_buffering = 4096
max_execution_time = 60
memory_limit = 64M
log_errors = On
ISSUES WHICH ARE STILL FACED BY ME
After changing the mpm_prefork_conf memory utilization came down but server responds back with 503 error to many clients due to MaxRequestWorkers parameter. I tried to figure out why my each apache process is using 315MB of RAM, i googled around 2 days and was not able to find the right path to further troubleshoot this. So finally i posted this over here. I have two options now.
To optimize the apache average process limit and increase the MaxRequestWorkers limit.
To increase RAM and serve clients with same average process size, which i think would not be a right choice.
Kindly guide me with the right suggestions how can i identify and reduce the average process size of apache with php. Please genuine answers only.
apache-2.4 php5 memory-usage
apache-2.4 php5 memory-usage
asked Jan 19 '17 at 9:36
imvikasmunjalimvikasmunjal
505411
505411
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I don't think you can get much better than this, I'd take the route to use php-fpm, then the non dynamic content load will be much faster and less memory consuming, I've found this guide (digitalocean.com), that gives good recommendations.
A thing you could check out is to change the keepalive times in apache see here
I am looking for any ideas to reduce average process size by apache which is 314MB right now?
– imvikasmunjal
Jan 19 '17 at 13:29
I've no ideas on that, I'm sorry
– aseques
Jan 19 '17 at 14:11
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f827229%2freducing-apache-memory-usage-and-average-process-size-value%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I don't think you can get much better than this, I'd take the route to use php-fpm, then the non dynamic content load will be much faster and less memory consuming, I've found this guide (digitalocean.com), that gives good recommendations.
A thing you could check out is to change the keepalive times in apache see here
I am looking for any ideas to reduce average process size by apache which is 314MB right now?
– imvikasmunjal
Jan 19 '17 at 13:29
I've no ideas on that, I'm sorry
– aseques
Jan 19 '17 at 14:11
add a comment |
I don't think you can get much better than this, I'd take the route to use php-fpm, then the non dynamic content load will be much faster and less memory consuming, I've found this guide (digitalocean.com), that gives good recommendations.
A thing you could check out is to change the keepalive times in apache see here
I am looking for any ideas to reduce average process size by apache which is 314MB right now?
– imvikasmunjal
Jan 19 '17 at 13:29
I've no ideas on that, I'm sorry
– aseques
Jan 19 '17 at 14:11
add a comment |
I don't think you can get much better than this, I'd take the route to use php-fpm, then the non dynamic content load will be much faster and less memory consuming, I've found this guide (digitalocean.com), that gives good recommendations.
A thing you could check out is to change the keepalive times in apache see here
I don't think you can get much better than this, I'd take the route to use php-fpm, then the non dynamic content load will be much faster and less memory consuming, I've found this guide (digitalocean.com), that gives good recommendations.
A thing you could check out is to change the keepalive times in apache see here
edited May 23 '17 at 12:41
Community♦
1
1
answered Jan 19 '17 at 11:45
asequesaseques
4482924
4482924
I am looking for any ideas to reduce average process size by apache which is 314MB right now?
– imvikasmunjal
Jan 19 '17 at 13:29
I've no ideas on that, I'm sorry
– aseques
Jan 19 '17 at 14:11
add a comment |
I am looking for any ideas to reduce average process size by apache which is 314MB right now?
– imvikasmunjal
Jan 19 '17 at 13:29
I've no ideas on that, I'm sorry
– aseques
Jan 19 '17 at 14:11
I am looking for any ideas to reduce average process size by apache which is 314MB right now?
– imvikasmunjal
Jan 19 '17 at 13:29
I am looking for any ideas to reduce average process size by apache which is 314MB right now?
– imvikasmunjal
Jan 19 '17 at 13:29
I've no ideas on that, I'm sorry
– aseques
Jan 19 '17 at 14:11
I've no ideas on that, I'm sorry
– aseques
Jan 19 '17 at 14:11
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f827229%2freducing-apache-memory-usage-and-average-process-size-value%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown