{"id":1385,"date":"2014-12-05T01:21:49","date_gmt":"2014-12-05T01:21:49","guid":{"rendered":"https:\/\/qbytes.cloud\/?p=1385"},"modified":"2014-12-05T01:21:49","modified_gmt":"2014-12-05T01:21:49","slug":"optimize-apache","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2014\/12\/05\/optimize-apache\/","title":{"rendered":"Optimize apache"},"content":{"rendered":"<p>Home \u00bbService Configuration \u00bbApache Configuration \u00bbGlobal Configuration<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nMinimum\u00a0Spare Servers 8\nMaximum\u00a0Spare Servers 32\nMax\u00a0Clients 1500\nMax\u00a0Requests Per\u00a0Child 0\nStart\u00a0Servers 8\nServer\u00a0Limit 2000\nKeep-Alive Timeout 15\nMax\u00a0Keep-Alive\u00a0Requests 256\n<\/pre>\n<p>Other options:<\/p>\n<p>&#8211;addition of memcache<br \/>\n&#8211;recompiling Apache to run as PreFork opposed to MPM Worker Event<\/p>\n<p>Check for Prefork or Worker<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# &#x5B;root@austin ~]# \/usr\/sbin\/httpd -V | grep MPM\n# Server MPM:     Prefork\n# -D APACHE_MPM_DIR=&quot;server\/mpm\/prefork&quot;\n\n<\/pre>\n<p>Links:<br \/>\nhttp:\/\/kb.sp.parallels.com\/en\/113007<br \/>\nhttp:\/\/codebucket.co.in\/apache-prefork-or-worker\/<br \/>\n&#8211;Reduced some of the limits in the apache config. Many things that should be in the hundreds were set in the thousands.<br \/>\n&#8211;KeepAlive on was simply adding too large of a load to the server.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\nTimeout\nTimeout 300\n\n<\/pre>\n<p>Usually this value doesn\u2019t require editing and a default of 300 is sufficient. Lowering the \u2018Timeout\u2019 value will cause a long running script to terminate earlier than expected.<\/p>\n<p>On virtualized servers like VPS servers, lowering this value to 100 can help improve performance.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\nKeepAlive\nKeepAlive On\n<\/pre>\n<p>This setting should be \u201cOn\u201d unless the server is getting requests from hundreds of IPs at once.<\/p>\n<p>High volume and\/or load balanced servers should have this setting disabled (Off) to increase connection throughput.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\nMaxKeepAliveRequests\nMaxKeepAliveRequests 100\n\n<\/pre>\n<p>This setting limits the number of requests allowed per persistent connection when KeepAlive is on. If it is set to 0, unlimited requests will be allowed.<\/p>\n<p>It is recommended to keep this value at 100 for virtualized accounts like VPS accounts. On dedicated servers it is recommended that this value be modified to 150.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\nKeepAliveTimeout\nKeepAliveTimeout 15\n\n<\/pre>\n<p>The number of seconds Apache will wait for another request before closing the connection. Setting this to a high value may cause performance problems in heavily loaded servers. The higher the timeout, the more server processes will be kept occupied waiting on connections with idle clients.<\/p>\n<p>It is recommended that this value be lowered to 5 on all servers.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\nMinSpareServers\nMinSpareServers 5\n\n<\/pre>\n<p>This directive sets the desired minimum number of idle child server processes. An idle process is one which is not handling a request. If there are fewer spareservers idle then specified by this value, then the parent process creates new children at a maximum rate of 1 per second. Setting this parameter to a large number is almost always a bad idea.<\/p>\n<p>Others Suggestions:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\nVirtualized server, ie VPS 5\nDedicated server with 1-2GB RAM 10\nDedicated server with 2-4GB RAM 20\nDedicated server with 4+ GB RAM 25\nMaxSpareServers\nMaxSpareServers 10\n\n<\/pre>\n<p>The MaxSpareServers directive sets the desired maximum number of idle child server processes. An idle process is one which is not handling a request. If there are more than MaxSpareServers idle, then the parent process will kill off the excess processes.<\/p>\n<p>The MaxSpareServers value should be set as double the value that is set in MinSpareServers.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\nStartServers\nStartServers 5\n\n<\/pre>\n<p>This directivesets the number of child server processes created on startup. This value should mirror what is set in MinSpareServers.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\nMaxClients\nMaxClients 150\n\n<\/pre>\n<p>This directive sets the limit on the number of simultaneous requests that will be served. Any connection attempts over the specified limit will be queued. Once a process is freed at the end of a different request, the queued connection will then be served.<\/p>\n<p>For virtualized servers such as VPS accounts, it is recommended to keep this value at 150. For all dedicated servers the recommended value for this setting is 250.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\nMaxRequestsPerChild\nMaxRequestsPerChild 0\n\n<\/pre>\n<p>This directive sets the limit on the number of requests that an individual child server process will handle. After the number of requests reaches the value specified, the child process will die. When this value is set at 0, then the process will never expire.<\/p>\n<p>Other adjustments:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\nVirtualized server, ie VPS 300\nDedicated server with 1-4GB RAM 500\nDedicated server with 4+GB RAM 1000\n\n<\/pre>\n<p>Other resources:<br \/>\n<a href=\"http:\/\/httpd.apache.org\/docs\/2.2\/misc\/perf-tuning.html\" target=\"_blank\" rel=\"noopener\">http:\/\/httpd.apache.org\/docs\/2.2\/misc\/perf-tuning.html<\/a><br \/>\n<a href=\"https:\/\/www.howtoforge.com\/configuring_apache_for_maximum_performance\" target=\"_blank\" rel=\"noopener\">https:\/\/www.howtoforge.com\/configuring_apache_for_maximum_performance<\/a><br \/>\n<a href=\"http:\/\/stackoverflow.com\/questions\/8902103\/is-there-an-apache-tuner-script-like-mysqltuner-pl\" target=\"_blank\" rel=\"noopener\">http:\/\/stackoverflow.com\/questions\/8902103\/is-there-an-apache-tuner-script-like-mysqltuner-pl<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Home \u00bbService Configuration \u00bbApache Configuration \u00bbGlobal Configuration Minimum\u00a0Spare Servers 8 Maximum\u00a0Spare Servers 32 Max\u00a0Clients 1500 Max\u00a0Requests Per\u00a0Child 0 Start\u00a0Servers 8 Server\u00a0Limit 2000 Keep-Alive Timeout 15 Max\u00a0Keep-Alive\u00a0Requests 256 Other options: &#8211;addition of memcache &#8211;recompiling Apache to run as PreFork opposed to MPM Worker Event Check for Prefork or Worker # &#x5B;root@austin ~]# \/usr\/sbin\/httpd -V | grep &#8230; <a title=\"Optimize apache\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2014\/12\/05\/optimize-apache\/\" aria-label=\"Read more about Optimize apache\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,20,123],"tags":[],"class_list":["post-1385","post","type-post","status-publish","format-standard","hentry","category-apache","category-cpanel","category-whm"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/1385","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=1385"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/1385\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=1385"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=1385"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=1385"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}