<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>InfoTales &#187; Web Application Performance</title>
	<atom:link href="http://www.infotales.com/topic/web-performance-optimization/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.infotales.com</link>
	<description>Web application performance, Web Server Performance, Data Mining, SEO, MySQL, Magento Performance and much more</description>
	<lastBuildDate>Thu, 26 Aug 2010 15:33:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Web Server Performance: Rotate Apache Access Logs on Windows</title>
		<link>http://www.infotales.com/web-server-performance-rotate-apache-access-logs-on-windows/</link>
		<comments>http://www.infotales.com/web-server-performance-rotate-apache-access-logs-on-windows/#comments</comments>
		<pubDate>Wed, 18 Aug 2010 05:23:23 +0000</pubDate>
		<dc:creator>shahpar</dc:creator>
				<category><![CDATA[Web Application Performance]]></category>

		<guid isPermaLink="false">http://www.infotales.com/?p=1149</guid>
		<description><![CDATA[Apache web access logs provide vital information about visits, visitors and requests served by Apache web server. Each request is logged by the web server so the log file size can increase at high speed. If the log file size is small it is easy for apache to append lines. On other hand as the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.infotales.com/wp-content/uploads/2010/06/apache_webserver_logo.gif"><img src="http://www.infotales.com/wp-content/uploads/2010/06/apache_webserver_logo.gif" alt="Apache webserver logo" title="Apache webserver logo" width="133" height="36" class="alignleft size-full wp-image-1021" /></a>Apache web access logs provide vital information about visits, visitors and requests served by Apache web server. Each request is logged by the web server so the log file size can increase at high speed. If the log file size is small it is easy for apache to append lines. On other hand as the size of file grows, web server require more server resources to maintain logs.</p>
<p>If the access log file size reaches to around 4GB on windows machine, apache will be very slow to respond and will hurt the web application performance badly. You should keep checking log file size regularly to make sure its within acceptable range. Access log file is normally found in logs/access.log under the apache installation.<span id="more-1149"></span></p>
<p>Apache provides built in functionality to rotate these logs on daily basis so it does not grow much and create performance issues to server. If we set it up, new file will be created for each day. Following is method to setup log rotation on Windows with WAMP, Apache 2.2.11.</p>
<p>Log rotation can be done at two levels, one server level and second on virtual host level. To do a server level log rotation you will need to modify /conf/httpd.conf file under apache installation. To do a virtual host level rotation will need to modify file \conf\extra\httpd-vhosts.conf file.</p>
<p>For server level log rotation open file /conf/httpd.conf and find line like<br />
<code>CustomLog "C:/Program Files/wamp/logs/access.log" common</code><br />
The line defines the log file. Now we will define log rotation in following manner<br />
<code>CustomLog "|bin/rotatelogs.exe C:/Program Files/wamp/logs/access_%y-%m-%d.log 86400" common</code><br />
here |bin/rotatelogs.exe tells that logs should be sent to rotatelogs.exe program which is located under apache installation in bin folder (make sure the exe file exists and have permissions). </p>
<p>The C:/Program Files/wamp/logs/access_%y-%m-%d.log tells the location of new log files. Here %y is year, %m is month and %d is day so the file name remains unique. 86400 is time span defined in seconds after which new file is generated, in this case its 24 hours (24x60x60) means log should rotate daily.</p>
<p>Be sure that you user have permission to write a file on given location (C:\ in this case). Also be sure that there is no space in file path given as it will create issues in creating new file.</p>
<p>After making the changes save file and restart apache. Now check if new file is created properly on access any web pages on this server. The new file should be created with name like &#8220;access_10-08-18.log&#8221; assuming that today is (Aug, 18 2010). </p>
<p>If you have to do same thing for a particular virtual host than you should add following line in &lt;VirtualHost xxxxxxxx&gt; definition.<code>CustomLog "|bin/rotatelogs.exe C:/Program Files/wamp/logs/access_%y-%m-%d.log 86400" </code></p>
<p>This should help improving performance of the web server as it has to write to a small file, secondly it is easy to download and analyze small logs as compared to huge files.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.infotales.com/web-server-performance-rotate-apache-access-logs-on-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web Application Performance: JavaScript Placement</title>
		<link>http://www.infotales.com/web-application-performance-javascript-placement/</link>
		<comments>http://www.infotales.com/web-application-performance-javascript-placement/#comments</comments>
		<pubDate>Sun, 27 Jun 2010 06:33:19 +0000</pubDate>
		<dc:creator>shahpar</dc:creator>
				<category><![CDATA[Web Application Performance]]></category>

		<guid isPermaLink="false">http://www.infotales.com/?p=1141</guid>
		<description><![CDATA[JavaScript files have become important part of most of the web. Placement of js file can play important role in front end performance. If you care about performance for you visitors, you must place JavaScript files properly. Browsers allow parallel connections to a single hostname. This allows files to download faster in parallel and very [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.infotales.com/wp-content/uploads/2010/06/JavaScript.gif"><img class="alignleft size-thumbnail wp-image-1143" title="JavaScript" src="http://www.infotales.com/wp-content/uploads/2010/06/JavaScript-150x150.gif" alt="" width="150" height="150" /></a>JavaScript files have become important part of most of the web. Placement of js file can play important role in front end performance. If you care about performance for you visitors, you must place JavaScript files properly.</p>
<p>Browsers allow parallel connections to a single hostname. This allows files to download faster in parallel and very helpful for web application performance. When JavaScript file is called browsers halts the parallel connections to all hosts. This is because JavaScript can alter the document dom with <em>document.write()</em>.<span id="more-1141"></span></p>
<p>This can badly hurt the front end performance of a web application. To avoid this all calls to JavaScript files should be moved to bottom of the page, just before end to BODY tag.</p>
<p>If it is not possible to move JavaScript calls to bottom, one should use DEFER attribute when calling script. Example code for this is<br />
<code>&lt;script src="script.js" type="text/javascript" defer="defer"&gt;&lt;/script&gt;</code><br />
Here defer tells that JavaScript does not contain any document.write() and browser should continue rendering. Problem with defer is that FireFox does not support it, Internet Explorer supports the defer but not to as desired. Still its batter to use it.</p>
<p>For faster page loadeds its recommended that JavaScript should be moved at bottom of the page, so parallel downloads are not blocked by JavaScript files.</p>
<p>This post is part of our &#8220;<a href="http://www.infotales.com/web-application-performance/" target="_blank">Web Application Performance</a>&#8220;. You can find more exciting post to improve performance of a web application in <a href="http://www.infotales.com/topic/web-performance-optimization/" target="_blank">Web Application Performance category</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.infotales.com/web-application-performance-javascript-placement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web Application Performance: CSS Placement</title>
		<link>http://www.infotales.com/web-application-performance-css-placement/</link>
		<comments>http://www.infotales.com/web-application-performance-css-placement/#comments</comments>
		<pubDate>Sat, 26 Jun 2010 14:01:15 +0000</pubDate>
		<dc:creator>shahpar</dc:creator>
				<category><![CDATA[Web Application Performance]]></category>

		<guid isPermaLink="false">http://www.infotales.com/?p=1121</guid>
		<description><![CDATA[CSS has become a vital part of a web page. CSS file call or style placement can play important role in performance. If you care about performance of your web application, than you should see where to place your CSS. A CSS file or style should be placed in HEAD element of the page. It [...]]]></description>
			<content:encoded><![CDATA[<p>CSS has become a vital part of a web page. CSS file call or style placement can play important role in performance. If you care about performance of your web application, than you should see where to place your CSS.</p>
<p>A CSS file or style should be placed in HEAD element of the page. It is important because browsers render page progressively if CSS is placed in HEAD. Putting CSS at bottom can block progressive rendering in most of the browsers. If CSS is placed at bottom the browser have to redraw all elements, this hurts the front end performance for visitor and they have to see a blank page for a while.<span id="more-1121"></span></p>
<p>HTML specification also suggests that CSS should only be placed in HEAD. It still can be added within BODY but best way is to place it in HEAD. Also it is good idea to use only one CSS in web application. You can combine multiple CSS to avoid more HTTP requests to web server.</p>
<p>This post is part to our &#8220;<a title="Web Application Performance" href="http://www.infotales.com/web-application-performance/" target="_blank">Web Application Performance</a>&#8221; series. You can find how to combine multiple CSS into one file in our post &#8220;<a href="http://www.infotales.com/web-application-performance-reducing-http-requests/" target="_blank">Reducing HTTP requests</a>&#8220;. You can also fine more stuff to <a href="http://www.infotales.com/topic/web-performance-optimization/" target="_blank">improve web application performance here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.infotales.com/web-application-performance-css-placement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web Application Performance: Reducing HTTP Requests</title>
		<link>http://www.infotales.com/web-application-performance-reducing-http-requests/</link>
		<comments>http://www.infotales.com/web-application-performance-reducing-http-requests/#comments</comments>
		<pubDate>Thu, 24 Jun 2010 14:19:15 +0000</pubDate>
		<dc:creator>shahpar</dc:creator>
				<category><![CDATA[Web Application Performance]]></category>

		<guid isPermaLink="false">http://www.infotales.com/?p=1072</guid>
		<description><![CDATA[A web page have multiple objects like images, css, JavaScript and flash etc. Browser have to send one http request to the server for each object. Each request adds a round trip to the server. Server have to receive and process each request and send the response. For enhancing web application performance the rule is [...]]]></description>
			<content:encoded><![CDATA[<p>A web page have multiple objects like images, css, JavaScript and flash etc. Browser have to send one http request to the server for each object. Each request adds a round trip to the server. Server have to receive and process each request and send the response.</p>
<p>For enhancing web application performance the rule is simple, reduce http requests.  We will discuss methods to do it, in detail but first lets look why we should reduce http requests?<span id="more-1072"></span></p>
<h4>How reducing http requests can help in web application performance?</h4>
<p><img class="size-full wp-image-1079 alignleft" title="More HTTP request means slower page" src="http://www.infotales.com/wp-content/uploads/2010/06/more_http_request_slow_page.png" alt="Web Application Performance" width="250" height="221" /> Web browsers only allow limited number of concurrent connections per domain, more requests means that requests have to be queued one after an other. Web page is not considered completed unless all objects are downloaded. Additionally each request have its own overhead of send information to server and wait for server response. Most of the times each request will also contain cookies, which is addition overhead. See the left image for a page having long waterfall of http requests for images etc.</p>
<p><img class="size-full wp-image-1080 alignright" title="Faster Page" src="http://www.infotales.com/wp-content/uploads/2010/06/less_request_faster_page.png" alt="Web Application Performance" width="250" height="72" />Now compared to a page having less objects, you can see a small amount of http requests and faster page completion. Reducing http requests can significantly reduce the response time for user and will make web application faster.</p>
<h4>How to reduce http requests</h4>
<p>Normally there are 3 types of objects are used in a web page. These are image, css and JavaScript files. Different techniques can be used to reduce requests.</p>
<h5>Combining Images</h5>
<p><img class="alignright" title="Google home page sprite image" src="http://www.google.com/images/srpr/nav_logo13.png" alt="" width="108" height="144" />Best way to reduce requests for images is to use sprite image. Sprite image contains all images need in a single image. You will need some css skills to use sprite images to give look like a normal images. You can do further self study on sprite images and how to use it.</p>
<p>See an example sprite from Google home page, which contains all 45 icons combined in a single image. Imagine only one request has be made instead of making 45 request in queue mode.</p>
<h5>Combining CSS files</h5>
<p>If a page is having more than 1 css files, these files should be combined into 1 file. You can put code of one css into the other file to reduce extra request.<br />
Imagine two files files 1.css and 2.css are called from page like<br />
<code>&lt;link rel="stylesheet" href="style/1.css"&gt;" type="text/css" media="all" /&gt;<br />
&lt;link rel="stylesheet" href="style/2.css"&gt;" type="text/css" media="all" /&gt;</code><br />
You can put code of 2.css at the end of 1.css and remove the call for 2.css from code.</p>
<h5>Combining JS files</h5>
<p>If a page is having more than 1 JavaScript files, these files should be combined into 1 file. You can put code of one JS into the other file to reduce extra request.<br />
Imagine two files files one.js and two.js are called from page like<br />
<code>&lt;script type="text/javascript" src="js/one.js"&gt;&lt;/script&gt;<br />
&lt;script type="text/javascript" src="js/two.js"&gt;&lt;/script&gt;</code><br />
You can put code of two.js at the end of one.js and remove the call for two.js from code.</p>
<h5>Using browser cache for performance</h5>
<p>Another effective way to reduce http requests is to cache the static contents in browser. This gives advantage when visitor visits the page again. On next visit all images and files are loaded from local cache and no http requests are sent. This give very fast experience to user.<br />
Ideally no images, css and js file request should be made when page is viewed 2nd time. See two graphs for first and 2nd view of page.<br />
<img class="size-full wp-image-1099 alignnone" title="First View" src="http://www.infotales.com/wp-content/uploads/2010/06/nocache.gif" alt="" width="390" height="189" /><br />
Repeat View Graph: The js and image request are for Google analytics only as these are not controllable by us, other than this only one request is sent for the whole page.<br />
<img class="size-full wp-image-1100 alignnone" title="prime_cache" src="http://www.infotales.com/wp-content/uploads/2010/06/prime_cache.gif" alt="" width="397" height="184" /><br />
Please read our post <a href="http://www.infotales.com/web-application-performance-http-features-for-performance/">Web Application Performance: HTTP Features for Performance</a> to see how to cache images, css and js files.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.infotales.com/web-application-performance-reducing-http-requests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web Application Performance: HTTP Features for Performance</title>
		<link>http://www.infotales.com/web-application-performance-http-features-for-performance/</link>
		<comments>http://www.infotales.com/web-application-performance-http-features-for-performance/#comments</comments>
		<pubDate>Sun, 20 Jun 2010 07:48:28 +0000</pubDate>
		<dc:creator>shahpar</dc:creator>
				<category><![CDATA[Web Application Performance]]></category>

		<guid isPermaLink="false">http://www.infotales.com/?p=1055</guid>
		<description><![CDATA[HTTP protocol have many features built-in which can help in improving front end performance of a web application. In this post we will look into these features and see how they can be used to improve performance. The features include (find details below) 304 Not Modified requests Expires header Keep-Alive Compression 304 Not Modified requests [...]]]></description>
			<content:encoded><![CDATA[<p>HTTP protocol have many features built-in which can help in improving front end performance of a web application. In this post we will look into these features and see how they can be used to improve performance.<br />
The features include (find details below)</p>
<ul>
<li>304 Not Modified requests</li>
<li>Expires header</li>
<li>Keep-Alive</li>
<li>Compression</li>
</ul>
<h3>304 Not Modified requests</h3>
<p>When a page is opened, browser downloads all objects (images, css, js, flash etc etc) and put it in its cache (if not told specifically to not to). When caching it also stores the last modified data of the object. When same object is requested next time the browser checks if the object is already in cache. If found in cache browser sends a conditional http request to server, and sends the last modified date of the object in &#8220;if-modified-since&#8221;. <span id="more-1055"></span></p>
<p>A sample request header will look like<br />
<code>GET /images/imagecache/109x100_carlisle-brass.jpg HTTP/1.1<br />
Host: www.bestdoorhandles.co.uk<br />
User-Agent: Mozilla/5.0 (Windows; ...<br />
If-Modified-Since: Sun, 20 Jun 2010 04:57:52 GMT</code><br />
The header is telling server that I have a copy of the image which was last modified on &#8220;Sun, 20 Jun 2010 04:57:52 GMT&#8221; tell me if the image was not modified after that or not?<br />
A sample response header from server will be like<br />
<code>HTTP/1.1 304 Not Modified<br />
Content-Type: image/jpeg<br />
Last-Modified: Sun, 20 Jun 2010 04:57:52 GMT<br />
</code></p>
<p>The response will not include any image, so the size of response will be very small. After receiving this header the browser will use image from it local cache. This way a lot of user bandwidth is saved to give faster experience to visitor. When evaluating your web application performance make sure to test this behavior and make sure its working properly.</p>
<h4>How to enable 304 Not Modified requests?</h4>
<p>Apache web server sends the last modified date with each object by default, so you don&#8217;t need to do any thing to enable it.</p>
<h3>Expires header</h3>
<p>Expires header is great way to improve web application performance. 304 not modified requests make page load faster as compared to normal request, but they still send request to server and server has to validate it each time. This adds a round trip between client and the server.</p>
<p>Expires header is great because it tells browser to use object from cache without requesting the server again and again. Expires header consist of a date in GMT format. When browsers gets and expires header it stores the object in local cache with the expires date. The browser will not request the same object unless it is expired or refreshed (F5 or refresh button) by visitor.</p>
<p>An example header with expires will look like<br />
<code>HTTP/1.1 200 OK<br />
Date: Sun, 20 Jun 2010 06:47:23 GMT<br />
Cache-Control: max-age=3456000<br />
Expires: Fri, 30 Jul 2010 06:47:23 GMT<br />
Last-Modified: Mon, 23 Jun 2008 11:59:38 GMT<br />
Accept-Ranges: bytes<br />
Content-Length: 1388<br />
Content-Type: image/jpeg</code></p>
<p>Now this images will be stored in local cache and browser will not send request for this image to server unless &#8220;Fri, 30 Jul 2010 06:47:23 GMT&#8221;. This is a great way to reduce http requests on repeat view of the page.</p>
<h4>How to enable expires header?</h4>
<p>For Apache web server you can add expires headers by adding following code in .htaccess file<br />
<code>&lt;ifmodule mod_expires.c&gt;<br />
&lt;filesmatch "\.(jpg|JPG|gif|GIF|png|css|ico)$"&gt;<br />
ExpiresActive on<br />
ExpiresDefault "access plus 7 day"<br />
&lt;/filesmatch&gt;<br />
&lt;/ifmodule&gt;</code></p>
<p>This tell apache web server to add expiry of 7 days to images, css and ico files, from time they are served.<br />
When evaluating web application performance be sure that proper expiry headers are being sent from server.</p>
<h3>Keep-Alive</h3>
<p>Using persistent connections (keep-alive) is another great feature to be used for web application performance. HTTP is based on TCP, in early versions of HTTP a connection has to be opened for each request and closed later.</p>
<p>In later version this feature was introduces where browser and server use same connection to receive and send many requests on a single connection. This saves the overhead of opening and closing connections. On</p>
<p>Browser and server send a &#8220;connection&#8221; header to specify that they support keep-alive or persistent connections. Sample request and response headers can look like<br />
Request header from browser<br />
<code>GET /images/imagecache/100x100_SW123.jpg HTTP/1.1<br />
Host: youdomainname.com.ss<br />
User-Agent: Mozilla/5.0 ( ...<br />
Keep-Alive: 115<br />
Connection: keep-alive</code></p>
<p>Response header for web server<br />
<code>HTTP/1.1 200 OK<br />
Date: Sun, 20 Jun 2010 07:07:19 GMT<br />
Last-Modified: Mon, 23 Jun 2008 11:59:38 GMT<br />
Connection: keep-alive</code></p>
<h4>How to enable Keep-alive?</h4>
<p>Apache web server keep-alive is enabled by default. This configuration can be changed from apache configuration file.</p>
<h3>Gzip Compression</h3>
<p>Compression is a great feature to reduce the size of response from server, thus saving a lot of bandwidth of visitor. Gzip is used to compress response, it can reduce the size 70% or more, thus giving a faster response. Almost 90% of web traffic comes through browsers which support gzip compression, as all major browsers support gzip compression.</p>
<p>Browser tells the server if they are ready to accept gzip encoding, a sample request header will look like<br />
<code>GET / HTTP/1.1<br />
Host: youdomainhost.co.cc<br />
User-Agent: Mozilla/5.0 (...<br />
Accept-Encoding: gzip,deflate<br />
</code></p>
<p>A sample response from server with gzip enabled will be like<br />
<code>HTTP/1.1 200 OK<br />
Date: Sun, 20 Jun 2010 07:08:33 GMT<br />
Content-Encoding: gzip<br />
Vary: Accept-Encoding<br />
Transfer-Encoding: chunked<br />
Content-Type: text/html<br />
</code></p>
<h4>How to enable gzip compression?</h4>
<p>For apache web server gzip compression can be enabled by mod_deflate. If you have mod_deflate enabled on your web server you can enable gzip compression by adding following code in .htaccess<br />
<code>&lt;IfModule mod_deflate.c&gt;<br />
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript<br />
&lt;/IfModule&gt;</code><br />
The code tells server to add gzip compression on webpages, text files, css and javascript files.</p>
<p>If you don&#8217;t have mod_deflate installed you can add compression by following php code</p>
<p>&lt;?php<br />
ob_start(&#8216;ob_gzhandler&#8217;);<br />
?&gt;<br />
&lt;html&gt;<br />
&lt;body&gt;All of my page&lt;/body&gt;<br />
&lt;/html&gt;<br />
&lt;?php<br />
ob_end_flush();<br />
?&gt;</p>
<p>When considering options to enhance web application performance do consider gzip compression. You can also see <a title="Gzip Compression" href="http://www.infotales.com/compress-your-web-pages/" target="_blank">Compress you pages</a> to know more about gzip compression.</p>
<p>Over all these http features can be used to achieve great performance for you web site. This post is part of our &#8220;<a title="Web Application Performance" href="http://www.infotales.com/web-application-performance/" target="_blank">Web Application Performance</a>&#8221; series, see the post for other great performance enhancements.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.infotales.com/web-application-performance-http-features-for-performance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web Application Performance</title>
		<link>http://www.infotales.com/web-application-performance/</link>
		<comments>http://www.infotales.com/web-application-performance/#comments</comments>
		<pubDate>Sat, 19 Jun 2010 07:03:11 +0000</pubDate>
		<dc:creator>shahpar</dc:creator>
				<category><![CDATA[Web Application Performance]]></category>

		<guid isPermaLink="false">http://www.infotales.com/?p=1047</guid>
		<description><![CDATA[Web application performance is increasingly becoming important aspect in web based business. Awareness about faster websites is increasing. Recently website speed has been added to ranking criteria of Google, most of the other search engines should be following soon. Optimizing website performance includes optimization of different aspects of a site, ranging from image optimization to [...]]]></description>
			<content:encoded><![CDATA[<p>Web application performance is increasingly becoming important aspect in web based business. Awareness about faster websites is increasing. Recently <a href="http://www.infotales.com/site-speed-will-be-used-google-search-ranking/" target="_blank">website speed has been added to ranking criteria of Google</a>, most of the other search engines should be following soon.</p>
<p>Optimizing website performance includes optimization of different aspects of a site, ranging from image optimization to advance level web server enhancements. The performance does not only include fetching HTML code from the server, it also includes download time of all images, css, js files and other objects in page. <span id="more-1047"></span></p>
<p><img class="alignleft size-full wp-image-1049" title="Performance graph" src="http://www.infotales.com/wp-content/uploads/2010/06/performance_graph.png" alt="" width="320" height="60" />According to a research only 10 to 20% of total time is spent fetching html and rest of the 80 to 90% is spent of other objects. Focusing on this 80 to 90% time can improve user experience of an web application. In this series of posts we will focus of methods to improve in this area.</p>
<p>The series will include following methods to improve web application performance</p>
<ul>
<li><a href="http://www.infotales.com/web-application-performance-http-features-for-performance/" target="_blank">Using HTTP features</a> 304 not modified, expires header, keep-alive, gzip</li>
<li><a href="http://www.infotales.com/web-application-performance-reducing-http-requests/" target="_blank">Reducing HTTP requests</a></li>
<li><a title="Using browser cache image expiry for performance" href="http://www.infotales.com/using-browser-cache-image-expiry-for-performance/" target="_blank">Caching images in browser</a></li>
<li><a title="Compressing web application pages" href="http://www.infotales.com/compress-your-web-pages/" target="_blank">Gzip Compression</a></li>
<li><a href="http://www.infotales.com/web-application-performance-css-placement/">Proper CSS Placements</a></li>
<li><a href="http://www.infotales.com/web-application-performance-javascript-placement/" target="_blank">Proper JavaScript placement</a></li>
<li>Minimizing CSS and JavaScript code</li>
<li><a title="serving images from cookie less domain" href="http://www.infotales.com/serving-images-from-cookie-less-domain/" target="_blank">Serving images from cookie less domain</a></li>
<li>Avoiding HTTP redirection</li>
<li>Optimizing Ajax</li>
<li><a title="PHP Accelerators" href="http://www.infotales.com/web-server-performance-use-php-accelerator/" target="_blank">Use PHP accelerators</a></li>
</ul>
<p>Stay tuned for updates in this series. We will be adding details for all these methods and few more ones.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.infotales.com/web-application-performance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web server performance: Use PHP accelerator</title>
		<link>http://www.infotales.com/web-server-performance-use-php-accelerator/</link>
		<comments>http://www.infotales.com/web-server-performance-use-php-accelerator/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 16:04:09 +0000</pubDate>
		<dc:creator>boogieman</dc:creator>
				<category><![CDATA[Web Application Performance]]></category>

		<guid isPermaLink="false">http://www.infotales.com/?p=1016</guid>
		<description><![CDATA[Web server performance is a major hurdle in any web application performance. Apache web server is a great web server to serve static and dynamic pages. Combined with PHP, it becomes a winning combination, powering millions of websites around the globe. As PHP pages are compiled than executed for each and every request, it consumes [...]]]></description>
			<content:encoded><![CDATA[<p>Web server performance is a major hurdle in any web application performance. Apache web server is a great web server to serve static and dynamic pages. Combined with PHP, it becomes a winning combination, powering millions of websites around the globe.</p>
<p>As PHP pages are compiled than executed for each and every request, it consumes a significant amount of processor time for busy websites, thus creating a bottleneck. If processor is busy it will reduce server&#8217;s capacity to server more web requests per second.</p>
<p><strong>Removing bottleneck</strong><br />
The solution to the issue is to use OPCode caching on web server. This saves the parsing, compilation time and a lot of I/O on each and every request.<span id="more-1016"></span></p>
<p>There are a lot of accelerators available to fulfill need of performance hungry applications. Famous php accelerators include</p>
<ul>
<li>eAccelerator: Free, open source and great tool to improve performance. Covered in more depth in my post <a href="http://www.infotales.com/web-server-performance-installing-eaccelerator/">Installing eAccelerator</a></li>
<li>Alternative PHP Cache: Open source, will become built in PHP 6</li>
<li>ionCube PHP Accelerator: Born in 2001, only supports PHP 4</li>
<li>Xcache: fast, stable and 	relatively new.</li>
<li>Nusphere PhpExpress: Free, available for windows as well</li>
<li>Zend Optimizer+: By Zend, part of Zend Server</li>
<li>Windows Cache Extension for PHP: Free, open source by Microsoft for PHP under Windows</li>
</ul>
<p>We will look into the above listed accelerators in depth, in series of post dedicated to each of them, starting with eAccelerator. Please see my post <a href="http://www.infotales.com/web-server-performance-installing-eaccelerator/">Using eAccelerator</a>, the post includes details, performance impact and how to install.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.infotales.com/web-server-performance-use-php-accelerator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web Server Performance: Installing eAccelerator</title>
		<link>http://www.infotales.com/web-server-performance-installing-eaccelerator/</link>
		<comments>http://www.infotales.com/web-server-performance-installing-eaccelerator/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 16:02:09 +0000</pubDate>
		<dc:creator>shahpar</dc:creator>
				<category><![CDATA[Web Application Performance]]></category>

		<guid isPermaLink="false">http://www.infotales.com/?p=1028</guid>
		<description><![CDATA[eAccelerator is a free, open source PHP accelerator, optimizer, and dynamic content cache, used to improve web server performance. It is a great tool which does not require change is existing php code. It stores PHP files in compiled state in shared memory and on next request it serves the request from compiled state cache. [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full  wp-image-1053" title="eaccelerator logo" src="http://www.infotales.com/wp-content/uploads/2010/06/eaccelerator_logo.png" alt="" width="247" height="33" />eAccelerator is a free, open source PHP accelerator, optimizer, and dynamic content cache, used to improve web server performance. It is a great tool which does not require change is existing php code. It stores PHP files in compiled state in shared memory and on next request it serves the request from compiled state cache. This saves a lot of parsing, compilation and I/O time.</p>
<p><strong>Performance Impact on Web Server</strong><br />
eAccelerator can increase web application performance 1 – 10 times. It reduces the processor load and fasten the execution of php scripts.<span id="more-1028"></span></p>
<p><strong>Installing eAccelerator</strong><br />
First download and extract using following commands<br />
<code>wget http://bart.eaccelerator.net/source/0.9.5.2/eaccelerator-0.9.5.2.tar.bz2</code><br />
Extract the tar file<br />
<code>tar xjf eaccelerator-0.9.5.2.tar.bz2<br />
cd eaccelerator-0.9.5.2</code></p>
<p>Now we have to compile it<br />
<code>hpize ./configure –-prefix=/path/where/to/install<br />
make<br />
make install</code><br />
now edit PHP Configuration (php.ini). Mostly found at /etc/php.ini<br />
<code>vi /etc/php.ini</code><br />
Add following lines in php.ini<br />
<code>extension="eaccelerator.so"<br />
eaccelerator.shm_size="0"<br />
eaccelerator.cache_dir="/var/cache/eaccelerator"<br />
eaccelerator.enable="1"<br />
eaccelerator.optimizer="1"<br />
eaccelerator.check_mtime="1"<br />
eaccelerator.debug="0"<br />
eaccelerator.filter=""<br />
eaccelerator.shm_max="0"<br />
eaccelerator.shm_ttl="0"<br />
eaccelerator.shm_prune_period="0"<br />
eaccelerator.shm_only="0"<br />
eaccelerator.compress="1"<br />
eaccelerator.compress_level="9"</code><br />
Now create a temp directory which will used to store the compiled files and also set permissions to write.<br />
<code>mkdir -p /tmp/eaccelerator<br />
chmod 0777 /tmp/eaccelerator</code></p>
<p>finally restart Apache.<br />
<code>/etc/init.d/httpd restart</code></p>
<p>Your site should be lighting fast, remember faster sites create happy customers. Please note that you need to change version, paths according to your server.</p>
<p>This post is part of our &#8220;<a title="Web Server Performance" href="http://www.infotales.com/web-server-performance-use-php-accelerator/">Web Server Performance</a>&#8221; series. In this post we have discussed using eAccelerator for web server performance. You can find details about more PHP accelerators in {post link}</p>
]]></content:encoded>
			<wfw:commentRss>http://www.infotales.com/web-server-performance-installing-eaccelerator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Features in Apache2.2</title>
		<link>http://www.infotales.com/new_features_in_apache2-2/</link>
		<comments>http://www.infotales.com/new_features_in_apache2-2/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 13:39:54 +0000</pubDate>
		<dc:creator>boogieman</dc:creator>
				<category><![CDATA[Web Application Performance]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Webserver]]></category>

		<guid isPermaLink="false">http://www.infotales.com/?p=996</guid>
		<description><![CDATA[Apache 2.2 has been out in year 2008, and just recently, 2.2.13 was released, enhancements and bug fixes introduced. Happily, 2.0 users are migrating to 2.2 due to the excellent performance on static pages. Here, More exciting innovations found in 2.2 and perhaps peek at one or two of the more esoteric ones. These changes [...]]]></description>
			<content:encoded><![CDATA[<p>Apache 2.2 has been out in year 2008, and just recently, 2.2.13 was released, enhancements and bug fixes introduced. Happily, 2.0 users are migrating to 2.2 due to the excellent performance on static pages.</p>
<p>Here, More exciting innovations found in 2.2 and perhaps peek at one or two of the more esoteric ones. These changes will surprise you.</p>
<p><strong>SNI</strong></p>
<p>SNI is the new feature in Apache 2.2.12, and you can now serve multiple SSL hosts off of one IP address. So there is issue with its documentation but it will resolve soon.</p>
<p>Till now the best documentation is available at <a rel="nofollow external" href="http://wiki.apache.org/httpd/NameBasedSSLVHostsWithSNI" target="_blank">http://wiki.apache.org/httpd/NameBasedSSLVHostsWithSNI</a>.</p>
<p><strong>Graceful Stop</strong></p>
<p>There is an issue with old apache server, when stopped it will kill the all existing connection, but now there is an option for graceful restart. It is used to change the server setting without restarting the server. I will serve the current users, and new connections will come with new config <span id="more-996"></span></p>
<p><code>$  httpd -k graceful-restart</code></p>
<p>But the new option introduced graceful-stop this option will stop the apache server and complete current request in process. So it will stop the server when the request is complete.</p>
<p><code>$ httpd -k graceful-stop</code></p>
<p>This can reduce angry customers while settings are being changed on server</p>
<p><strong>mod_substitute</strong></p>
<p>Apache 2.2 introduced <em>mod_substitute</em>, which includes some of the functionality of both of the latter modules and allows you to modify the response that is being sent to the web client, using regular expressions. To use mod_substitute, you must know enough about regular expressions to express your desired change. For example, if you are proxying a back-end server <em>images.local</em> and want to replace that hostname in URLs with its external hostname, you would do the following:</p>
<p><strong>AddOutputFilterByType SUBSTITUTE text/html</strong></p>
<p><strong>Substitute s/images.local/images.mysite.com/i</strong></p>
<p>In this case, the i on the end indicates that the substitution should happen in a case-insensitive fashion. The AddOutputFilterByType directive specifies what kind of files the substitution should affect. You don&#8217;t want to do substitutions on images or PDF files, for example, as it will corrupt them and result in garbage.</p>
<p>It can also used in the .htaccess</p>
<p><strong>mod_proxy_balancer</strong></p>
<p>This is the new excellent feature. Before this, we had to use the hardware or software load balancer. Now apache 2.2 had introduced the functionality built in.</p>
<p>Its really a full-featured load balancing proxy for free, and included in your Apache 2.2 server.</p>
<p>To get started with mod_proxy_balancer, you can define your cluster pool like this:<br />
<code><br />
&lt;Proxy balancer://mycluster&gt;<br />
BalancerMember http://192.168.1.50:80<br />
BalancerMember http://192.168.1.51:80<br />
BalancerMember http://192.168.1.51:80<br />
&lt;/Proxy&gt;<br />
</code><br />
Then, tell your server to proxy requests through to those servers:</p>
<p><strong>ProxyPass /test balancer://mycluster/</strong></p>
<p>This is the reference article to study about it more <a rel="nofollow external" href="http://httpd.apache.org/docs/2.2/mod/mod_proxy_balancer.html">http://httpd.apache.org/docs/2.2/mod/mod_proxy_balancer.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.infotales.com/new_features_in_apache2-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Online web page performance testing tool</title>
		<link>http://www.infotales.com/online-web-page-performance-testing-tool/</link>
		<comments>http://www.infotales.com/online-web-page-performance-testing-tool/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 15:54:05 +0000</pubDate>
		<dc:creator>shahpar</dc:creator>
				<category><![CDATA[Web Application Performance]]></category>

		<guid isPermaLink="false">http://www.infotales.com/?p=973</guid>
		<description><![CDATA[To test performance of your web application there are several free sites available. Here are few you can try WebPageTest.org: My personal favorite, and used by me. Gives multiple locations, waterfall view of requests and good optimization tips to improve web application performance. PingDom.com: Gives basic tests for free, I don&#8217;t like is personally because [...]]]></description>
			<content:encoded><![CDATA[<p>To test performance of your web application there are several free sites available. Here are few you can try</p>
<ul>
<li><strong>WebPageTest.org</strong>: My personal favorite, and used by me. Gives multiple locations, waterfall view of requests and good optimization tips to improve web application performance.</li>
<li><strong>PingDom.com</strong>: Gives basic tests for free, I don&#8217;t like is personally because it can&#8217;t handle images which have space in its name, shows these as not found,</li>
<li><strong>BrowserMob.com</strong>: Provides testing from multiple locations in US and Europe, provides stats for load time, object type breakup etc.</li>
</ul>
<p><img class="size-full wp-image-986 alignleft" title="webpagetest_logo" src="http://www.infotales.com/wp-content/uploads/2010/06/webpagetest_logo.png" alt="" width="203" height="50" />My favorite is webpagetest because its give multiple location in US, China, Europe and tests provides detailed analysis. I includes waterfall requests view, connection view, CPU usage and rendering time etc. Also equipped with forum where you can discuss test results and tips to improve and discuss web application performance.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.infotales.com/online-web-page-performance-testing-tool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
