Monday, May 13, 2013

Analyze Application Load Time

Introduction

                  There could be several reasons your application is slow. This article discuss about couple of common problems which application faces.

Improve Initial Load Time (Soyc Report)

            As soon as the GWT client code grows in size, it takes longer time to load. Luckily GWT provides a way to find out initial load and address this issue. GWT provides way to generate a report called soyc report (Story Of Your Compiler).

        The goal of this story will be to identify the sweet spots that will allow you to gain the performance benefit by splitting the code. This report identifies the bottlenecks in the code and proposed code split points. A brief introduction here, this document is detailed enough to understand about soyc.

https://developers.google.com/web-toolkit/doc/latest/DevGuideCompileReport

         A Compile Report is not produced by default, but it is easy to get the compiler to do so by setting a compiler flag. https://developers.google.com/web-toolkit/doc/latest/DevGuideCompileReport#Usage

                  -Dgwt.compiler.compileReport=true -Dgwt.compiler.soycDetailed=true

      By default report will be generated on Your Project/target/extra/compile-report/index.html unless the -extra compile flag is included.
      
      



        Report breaks down into package, type and literals. Once the report is generated you can start applying code splits. Refer GWT offical doc for more understanding. To split your code, simply insert calls to the method GWT.runAsync at the places where you want the program to be able to pause for downloading more code. These locations are called split points. It will drastically improve application load time if causes are downloading code. 

        https://developers.google.com/web-toolkit/doc/latest/DevGuideCodeSplitting

Using Google Pagespeed


                   To speed up web app loading time, ofcouse split points is a first step.
Slowness can also come from uncompressed pictures for instance.
Also, when you compile your GWT app, ensure you use "OBFUSCATED" mode for your compiled javascript, which makes it significantly smaller.
Now if you are using Apache HTTPD as web server, Google has released a wonderful Apache module that implements web app best practices out of the box: http://code.google.com/p/modpagespeed/

Trouble Shoot



1) End up with exception "Unable to write to byte cache". It could be problem with disk space or report is very huge. Reduce GWT compile permutation and try it.

2) In case you are using maven add soycDetailed and compileReport tag with value true.
  



                

No comments:

Post a Comment