{"id":2848,"date":"2014-04-13T15:46:47","date_gmt":"2014-04-13T15:46:47","guid":{"rendered":"http:\/\/blog.shineservers.com\/?p=2848"},"modified":"2014-04-13T15:46:47","modified_gmt":"2014-04-13T15:46:47","slug":"increase-page-load-speed-apache-keepalive","status":"publish","type":"post","link":"https:\/\/www.shineservers.com\/2014\/04\/13\/increase-page-load-speed-apache-keepalive\/","title":{"rendered":"How To Increase Page Load Speed with Apache KeepAlive"},"content":{"rendered":"<p>The KeepAlive directive for Apache allows a single request to download multiple files. So on a typical page load, the client may need to download HTML, CSS, JS, and images. When KeepAlive is set to \u201cOn\u201d, all of these files can be downloaded in a single request. If KeepAlive is set to \u201cOff\u201d, each file download would require it\u2019s own request.<\/p>\n<p>You can control how many files can be downloaded in a single request with the MaxKeepAliveRequests directive, which defaults to 100. If you have pages with a lot of different files, consider putting this higher so that your pages will load in a single request.<\/p>\n<p>One thing to be cautious of when using KeepAlive, is the connections will remain open waiting for new requests once the connection is established. This can use up a lot of memory, as the processes sitting idly will be consuming RAM. You can help avoid this with the KeepAliveTimeout directive, which specifies how long the connections remain open. I generally put this below 5, depending on the average load times of my site.<\/p>\n<p>An important factor when deciding to use KeepAlive is the CPU vs. RAM usage requirements for your server. Having KeepAlive On will consume less CPU as the files are served in a single request, but will use more RAM because the processes will sit idly. Here is an example of KeepAlive settings I use:<\/p>\n<pre>KeepAlive             On\nMaxKeepAliveRequests  50\nKeepAliveTimeOut      3<\/pre>\n<p>Once KeepAlive is on you can see the following header in your server\u2019s response:<\/p>\n<pre>Connection:  Keep-Alive\n\n\n<\/pre>\n<h3 class=\"zemanta-related-title\" style=\"margin: 0 0 10px 0; padding: 0; clear: both;\">Related articles across the web<\/h3>\n<ul class=\"zemanta-article-ul zemanta-article-ul-image\" style=\"margin: 0; padding: 0; overflow: hidden;\">\n<li class=\"zemanta-article-ul-li-image zemanta-article-ul-li\" style=\"padding: 0; background: none; list-style: none; display: block; float: left; vertical-align: top; text-align: left; width: 104px; font-size: 12px; margin: 0 5px 10px 0;\"><a style=\"padding: 2px; display: block; text-decoration: none;\" href=\"http:\/\/blog.shineservers.com\/optimise-tweak-high-traffic-servers\/\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" style=\"border-radius: 3px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); padding: 0; margin: 0; border: 0; display: block; width: 100px; max-width: 100%;\" alt=\"\" src=\"http:\/\/i.zemanta.com\/238622182_150_150.jpg\" \/><\/a><a style=\"display: block; overflow: hidden; text-decoration: none; line-height: 12pt; height: 80px; padding: 5px 2px 0 2px;\" href=\"http:\/\/blog.shineservers.com\/optimise-tweak-high-traffic-servers\/\" target=\"_blank\" rel=\"noopener noreferrer\">Optimise and Tweak High-Traffic Servers<\/a><\/li>\n<li class=\"zemanta-article-ul-li-image zemanta-article-ul-li\" style=\"padding: 0; background: none; list-style: none; display: block; float: left; vertical-align: top; text-align: left; width: 104px; font-size: 12px; margin: 0 5px 10px 0;\"><a style=\"padding: 2px; display: block; text-decoration: none;\" href=\"http:\/\/blog.shineservers.com\/optimise-mysql-apache-cpanelwhm\/\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" style=\"border-radius: 3px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); padding: 0; margin: 0; border: 0; display: block; width: 100px; max-width: 100%;\" alt=\"\" src=\"http:\/\/i.zemanta.com\/261167979_150_150.jpg\" \/><\/a><a style=\"display: block; overflow: hidden; text-decoration: none; line-height: 12pt; height: 80px; padding: 5px 2px 0 2px;\" href=\"http:\/\/blog.shineservers.com\/optimise-mysql-apache-cpanelwhm\/\" target=\"_blank\" rel=\"noopener noreferrer\">How To Optimise MySQL &amp; Apache On cPanel\/WHM<\/a><\/li>\n<li class=\"zemanta-article-ul-li-image zemanta-article-ul-li\" style=\"padding: 0; background: none; list-style: none; display: block; float: left; vertical-align: top; text-align: left; width: 104px; font-size: 12px; margin: 0 5px 10px 0;\"><a style=\"padding: 2px; display: block; text-decoration: none;\" href=\"http:\/\/blog.shineservers.com\/optimise-cpanelwhm-server\/\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" style=\"border-radius: 3px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); padding: 0; margin: 0; border: 0; display: block; width: 100px; max-width: 100%;\" alt=\"\" src=\"http:\/\/i.zemanta.com\/238622181_150_150.jpg\" \/><\/a><a style=\"display: block; overflow: hidden; text-decoration: none; line-height: 12pt; height: 80px; padding: 5px 2px 0 2px;\" href=\"http:\/\/blog.shineservers.com\/optimise-cpanelwhm-server\/\" target=\"_blank\" rel=\"noopener noreferrer\">Optimise cPanel\/WHM Server<\/a><\/li>\n<li class=\"zemanta-article-ul-li-image zemanta-article-ul-li\" style=\"padding: 0; background: none; list-style: none; display: block; float: left; vertical-align: top; text-align: left; width: 104px; font-size: 12px; margin: 0 5px 10px 0;\"><a style=\"padding: 2px; display: block; text-decoration: none;\" href=\"https:\/\/www.digitalocean.com\/community\/articles\/how-to-configure-the-apache-web-server-on-an-ubuntu-or-debian-vps\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" style=\"border-radius: 3px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); padding: 0; margin: 0; border: 0; display: block; width: 100px; max-width: 100%;\" alt=\"\" src=\"http:\/\/i.zemanta.com\/191789219_150_150.jpg\" \/><\/a><a style=\"display: block; overflow: hidden; text-decoration: none; line-height: 12pt; height: 80px; padding: 5px 2px 0 2px;\" href=\"https:\/\/www.digitalocean.com\/community\/articles\/how-to-configure-the-apache-web-server-on-an-ubuntu-or-debian-vps\" target=\"_blank\" rel=\"noopener noreferrer\">How to Configure the Apache Web Server on an Ubuntu or Debian VPS<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>The KeepAlive directive for Apache allows a single request to download multiple files. So on a typical page load, the client may need to download HTML, CSS, JS, and images. When KeepAlive is set to \u201cOn\u201d, all of these files can be downloaded in a single request. If KeepAlive is set to \u201cOff\u201d, each file [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[60],"tags":[204],"class_list":["post-2848","post","type-post","status-publish","format-standard","hentry","category-linux","tag-increase-web-page-load-speed"],"acf":[],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/posts\/2848","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/comments?post=2848"}],"version-history":[{"count":0,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/posts\/2848\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/media?parent=2848"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/categories?post=2848"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/tags?post=2848"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}