AJAX Tutorial for Java Programmers

Optimization Issues

The Jaxcent documentation has some pointers on optimization. These should be reviewed by serious programmers.

We won't get into the technical details of those here. Instead, this tutorial will point out some practical issues.

In practical programming, there are various levels of optimization.

We have already covered JavaScript and how to improve response and decrease server load by doing things in JavaScript.

But given today's servers' power and network speeds, if you are developing an intranet application for a thousand users on a local area network, such optimization would be a waste of time. You may as well not spend any time and effort with JavaScript. JavaScript, as of now, is much harder and clumsier to write, organize and debug than Java. Therefore any development you do in Java instead of JavaScript, improves the application reliability, reduces development time, and so on.

On the other hand, if you are developing an application that could be potentially used by hundreds of thousands of users, some of whom may be located half way around the world at fifty network hops, you should put as much the of the work in JavaScipt as possible, so the application does not have any client-server trips that are not absolutely necessary, and so that the clients are distributing as much workload as possible.

If you don't know ahead of time how much the application needs to scale, a good stragety is to start with an all Java version. As the application grows in clientele, you can start moving selected pieces to JavaScript if/when needed.

There are other optimization issues as well, but in Java AJAX programming at the time, Java/JavaScript balancing is the big optimization issue. Servers hava become very fast and powerful. The network can still be a bottleneck.

Of course, optimization trade-offs change every few years with advances in technology and hardware. It is possible that a few years later, entirely other issues may dominate optimization instead!


Further Learning
Contents