Struts 2 & Dojo files are too heavy and affect site's performance.. Any remedies?

Well.. we've developed a j2ee application using struts2 ajax capabilities. We find that the dojo implementation is quite slow. We did the following things: 1. Custom build of the dojo library. (increased dojo.js from 240kb to 350kb) 2. Took all the static stuff out of the struts jar and kept it outside.

The performance was significantly improved. But still it is quite heavy as you can guess with 350kb size..

Is struts2 ajax supposed to be this heavy? or is there any lighter implementation available?


Edit: I used Firebug and YSlow with my application. Couple of changes that improved my situation hugely are mentioned below:

  1. Custom build of dojo (reduced the number of I/Os)
  2. Move the static files out of Struts jar (helped a great deal)
  3. tune your server to gzip the response (reduced the response size to 1/3)
  4. Reduce number of images on your site.(this is obvious)

Will keep updating on further changes..

Answers


First of all check that you did everything on the server to facilitate caching (e.g., setting right HTTP headers, compression, server-side caching, upstream caches, and so on). See Improving performance… for more details.

The goal is to reduce I/O as much as possible — use Firebug or any other network traffic monitoring tool to see how much is sent back and forth. Try to minimize the number of I/O requests and the total number of bytes.

Don't forget that it applies to your dynamic data too — choose efficient formats, bundle several related requests together, remove all deadwood that is getting sent over and over unchanged.

If the custom build and server-side tweaks didn't help, consider restructuring your web app to be more light-weight. Examples:

  • Evaluate the splash screen technique discussed in the link above.
  • If you use a lot of different form widgets, see if it is really necessary, and fall back on regular DOM elements like "input", "button", "textarea", "select".
  • The same goes for layout widgets. See if simple CSS can help you out.
  • Evaluate building Dojo in layers instead of one monolithic dojo.js so only the necessary subset is loaded by web pages. See details in The Package System and Custom Builds.

Building web applications with Dojo for a living for last 2 years I still didn't see the one that cannot be optimized properly until it is fully accepted and perceived by end users as "fast", "nimble", and "light-weight".


Need Your Help

How to set UIDatePicker's date's seconds value to 00?

ios objective-c cocoa-touch nsdate uidatepicker

How to always get seconds value "00" for UIDatePicker's date?

Setting an object's sub property using ILGenerator.Emit

c# il ilgenerator

I have some code that uses IlGenerator.Emit to create and populate a generic object using a datareader. It works great however I need to extend it to populate simple child objects when the database...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.