开发者

Attempting to Speed up my Web App using Flash, Javascript, JSP

I am currently working on a web application using Flash, Javascript and using a JSP (running on Apache Tomcat). I am trying to speed it up.

The application is embedded into another page using an <iframe>. Often we will embed the applicaiton many times into one page.

The page in the iframe is a JSP with some Javascript and a Flash SWF. The basic structure is:

<html>
    <head>
        <script src="script1.js"/>
        ... 
        <script src="script8.js"/>
    </head>
    <body>
        <object>
            <param ... />
            <param ... />
            <param ... />
            <embed src="myFlash.swf" ...>
            </embed>
        </object>
    </body>
</html>

After doing some informal testing I have found that for each application that is added to a page the page takes an additional four seconds to load. This is a linear increse in time which makes sence to me.

LoadingTime = (4 seconds)*NumberApplications + (3 seconds)

I think that these are the candidates 开发者_StackOverflow社区for slowness:

  • Javascript
  • Flash
  • Server Side Processing
  • Download Time

Javascript

I have used Firebug to profile the Javascript but no function is taking large percentage of the time and the overall time seems very small. Here are the approximate results:

  • Function A takes up 25% of the time. Its time (including nested calls) is 1.5 seconds*. This seems almost neglegable.
  • Function B, C, D, E Take up less than 10%
  • There are many other functions that take up less than 2% of the total time

It looks like the JS is fast and not the cause of the app being slow.

* This time is for when there are 21 apps on the page and the total loading time is 85 seconds

Flash

I don't know how to profile the Flash code. I see a grey loading bar for some of the SWFs (some of them skip the grey scroll bar). I think that profiling this is my next step.

Download

Looking at the Net tab in Firebug it looks like there are a couple of things that are a bit slow on the download. Each JSP has about 8 javascript files associated with it. Downloading the first one is always a little bit slow (takes about a full second). I am not sure why this is. I am wondering if it is because there are not enough connections supported by my Tomcat server.

Other questions that come to mind are:

  • It is making requests for the same 8 js files for each jsp would it be possible to put the js files on the main page so they are only requested once.
  • Should I increse the number of connections to Tomcat?
  • Since I am loading many applications I would like app1 to begin initializing itself after it has downloaded (and not wait for app2 to finish downloading). How can I see when app1 has begun running, relitive to the downloads

Server Side Processing

I think that any Server side processing should be reflected by the download time. For example if one of the JSPs is taking a long time it would be easy to see since the JSP will take a long time to download.

Question

  • What is the standard way to figure out what the slow part of the web app is?
  • What is the easiest part to speed up?
  • I know have some idea about how long some things are taking (download and JS) but I don't know how these two relate to each other. When does the JS start executing? When the download is finished or when it is finished for that file?
  • Are there other things other that could be making my applicaiton slow?
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜