Sorry for the long postponement in composing this station. Muckles of you hold emailed me inviting the reason constituent of the performance analysis and here itis. This is a continuance from the last station so its highly urged you read the earlier station firstly (Click here for part1)
Here is the list of YSlow 13 performance regulations along with the valuations given to the default web mapping application templet.
1. Brand Fewer HTTP bespeaks ( F )
2. Utilise a CDN ( F )
3. Add an Expires heading ( F )
4. Gzip ingredients ( F )
5. Put CSS at the top ( Bacillus )
6. Move books to the undersurface ( C )
7. Avoid CSS faces ( A )
8. Brand JS and CSS external ( - )
9. Reduce DNS searches ( A )
10. Minify JS ( Angstrom )
11. Avoid redirects ( Angstrom )
12. Withdraw extra books ( A )
13. Configure ETags ( A )
Now permits examine a couple of regulations and its evaluations to see where we as web developers or forepart technologists can add to better the performance of the web function application.
1. Brand Fewer HTTP bespeaks ( F )
The tools steps this with regard to how many HTTP quest the application does while lading in the browser. From a web map application view this can not be commanded easily since the web function application downloads around 16 Javascript files and 2 css files which the YSlow makes not similar. Its hard to modify this since the Javascript files are shot to the HTML at initialisation by the XSL files and you will need to modify a great deal of XSL to trim this. Not advocated.
2. Apply a CDN ( F )
CDN stands for Content Delivery/Distribution Web. Its not practical/economical for little scale web applications with to a lesser degree 10, 000 hits a day to be functioned from CDN
3. Add an Expires head ( F )
Here is where it gets interesting. This regulation is advising that any web resource transported to the browser e.g. images, javascript, css, HTML files can be and shoud be cached by the browser.
Oh goodly, what can we as Forepart Engineers or Web Developers make to better the class and get a better performance and user experience. In the web application we can add custom-made heads such as `` Expires '' and `` Cache-Control '' to these resources so that the browser will download it once and until the user unclutters the browser cache the files are reused. A large performance increase and potentially salves rafts of bandwidth.
Here is a snip fromweb.xml where I hold declared a filter to make the line.
<filter>
<filter-name>ResponseHeaderFilter</filter-name>
<filter-class>
com.esri.sample.ResponseHeaderFilter
</filter-class>
<init-param>
<param-name>Cache-Control</param-name>
<param-value>max-age=3600</param-value>
</init-param>
<init-param>
<param-name>Expires</param-name>
<param-value>Thu, 14 Aug 2008 12:00:00 GMT</param-value>
</init-param>
</filter>
Here is the existent execution - ``ReponseHeaderFilter.java ''
package sample;
import java.io.IOException;
import java.util.Enumeration;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
public class ResponseHeaderFilter implements Filter {
FilterConfig fc;
public void doFilter(ServletRequest req, ServletResponse res,
FilterChain chain)
throws IOException, ServletException {
HttpServletResponse response = (HttpServletResponse) res;
// set the provided HTTP response parameters
for (Enumeration e=fc.getInitParameterNames();e.hasMoreElements()) {
String headerName = (String)e.nextElement();
response.addHeader(headerName, fc.getInitParameter(headerName));
}
// pass the request/response on
chain.doFilter(req, response);
}
public void init(FilterConfig filterConfig) {
this.fc = filterConfig;
}
public void destroy() {
this.fc = null;
}
}
Here is the filter map inweb.xml to place the type of resources to add the headings
& lt; filter-mapping & gt;
& lt; filter-name & gt; ResponseHeaderFilter & lt; /filter-name & gt;
& lt; url-pattern & gt;*.js & lt; /url-pattern & gt;
& lt; /filter-mapping & gt;
& lt; filter-mapping & gt;
& lt; filter-name & gt; ResponseHeaderFilter & lt; /filter-name & gt;
& lt; url-pattern & gt;*.css & lt; /url-pattern & gt;
& lt; /filter-mapping & gt;
& lt; filter-mapping & gt;
& lt; filter-name & gt; ResponseHeaderFilter & lt; /filter-name & gt;
& lt; url-pattern & gt;*.gif & lt; /url-pattern & gt;
& lt; /filter-mapping & gt;
& lt; filter-mapping & gt;
& lt; filter-name & gt; ResponseHeaderFilter & lt; /filter-name & gt;
& lt; url-pattern & gt;*.png & lt; /url-pattern & gt;
& lt; /filter-mapping & gt;
& lt; filter-mapping & gt;
& lt; filter-name & gt; ResponseHeaderFilter & lt; /filter-name & gt;
& lt; url-pattern & gt;*.jpg & lt; /url-pattern & gt;
& lt; /filter-mapping & gt;
& lt; filter-mapping & gt;
& lt; filter-name & gt; ResponseHeaderFilter & lt; /filter-name & gt;
& lt; url-pattern & gt; /tile/* & lt; /url-pattern & gt;
& lt; /filter-mapping & gt;
& lt; filter-mapping & gt;
& lt; filter-name & gt; ResponseHeaderFilter & lt; /filter-name & gt;
& lt; url-pattern & gt; /mimedata/* & lt; /url-pattern & gt;
& lt; /filter-mapping & gt;
4. Gzip factors ( F )
The clip to direct response from your application/web waiter across the web back to the browser can be significantly trimmed by compact certain types of responses. If you desire to acquire more on this for all the good and benefits of Compaction, click here
You will need to depend on the web waiter to furnish this functionality for you and here is an representative of modifying tom 's constellation file to compact different types of responses based on their mime-type.
Note: Just in case instance we are configuring theserver.xml file of Tom (6.0.14 version ) to compact utilise the GZip compaction type for the undermentioned mime-types: text/html, text/xml, text/javascript, text/image, text/css
We are not compact any image arranges here since densification on image or pdf formattings is not advocated since it is already in a tight formatting.
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"
compression="on"
compressionMinSize="512
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml,text/javascript,text/image,text/css"/>
Theserver.xml can be chance under the `` { tom installationfolder } /conf '' booklet and by default will not hold the concretion turned along. Open theserver.xml file in any text editor and happen the and add the concretion ascribes as exhibited above. In my illustration, I hold inquired Tom to compact any HTML, text, xml, javascript or css files which is over 512 bytes.
This modification will significantly hike the performance of your application both at start upwards follwed by every Ajax call doed to the waiter since the Java ADF utilizes XML to direct responses back to the naming web application. Too this alteration alters the YSlow form of F to A for this class.
6. Move playscripts to the undersurface ( C )
This is somewhat simple modification. YSlow cheques to see if there are any external Javascripts files in the page and if yes so is it at the terminal of the body instead than at the caput. The web map application holds a couple of script tickets in themapviewer.jsp at the caput. You can go them all the style to the terminal of the page before the HTML tag. This will imporive the load of the page and besides delight the YSlow valuation.
10. Minify JS ( A )
Desired to do a little input here. In version0.9.x YSlow gives course Angstrom for this regulation when the Javascript libraries of the Web Function application is not lessened. This might be a bug with the YSlow plugin, anyway we should take to decrease the JS libraries as it will imporove the conveyance velocity of the files and recall there are atleast 16 Javascript files transported in the web map application, so we should revisit this theme seperately. Its deserving a station of its ain.
So here it is folks, after doing all these alterations here is concluding screenshot of the new Yslow valuation:

We can see a important advance in valuation ( from F to Bacillus ), performance and reactivity of the application by but following a couple of simple regulations. If you attempt this out, delight portion the performance prosodies so that others can notice on that.
Related posts:
Definition of Portability Insurance
HIV and Insurance
Enter-ing
Today 's Tweety-ness
Periphery; The New Fox Television Series.