wood burning stoves 2.0*
The moose likes Applets and the fly likes Applet loads very slowly! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet loads very slowly!" Watch "Applet loads very slowly!" New topic
Author

Applet loads very slowly!

Chetan Graham
Greenhorn

Joined: Dec 01, 2007
Posts: 21
Thanks to All!

This client side java applet starts by the doctor clicking on an anatomy image (70-80k)within the patients file that is in the large Hospital software that can handle upwards of 5000 doctors and nurses and xray machines, etc at any time.
The ImageAnnotation software simply allows the doctor to edit the simple anatomy image with the patients problem, by using lines, arrows, text, circle, rectangle and polygon. It saves the Annotated Image in XML, with dicom standards in place. No more than 5000 lines of code.
I can tell you this, there are no doubt many different versions of java between all the different pc's in use on the Hospital's software. So when the applet begins loading it no doubt trying to find all the correct classes, etc.

Is client side applets within a large software project a bad idea?
Would javascript with PHP and XML with HTML be the way to go. I know it will be much faster right off.
But is this Client side java applets simply a mistake?

We have one other applet a microphone recorder for the doctor and it loads quickly, never a problem. It is a small program too.

Thanks.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

That sounds like a very cool applet Chetan. With all those features I think a web based approach would be very limiting. An applet/application is going to be your best bet. Its tough to say why it might be slow. Is it slow on everyone's computer or just specific ones? Is it just the initial startup time or is it sluggish throughout usage?


GenRocket - Experts at Building Test Data
Chetan Graham
Greenhorn

Joined: Dec 01, 2007
Posts: 21
Thanks Gregg for your reply,

1)The idea of PHP/javascript/HTML is not web based but on the server(s) hosting close to 5000 pc's and medical related machines within the hospital complex.

2)It is slow for every station we have looked at, which is a very small percentage of the total # involved.

3) The applet starts, simply from the click on the patients form holding the Image the doctor wants to Annotate. At this point the "ProgressBarDialog.java file loads and the progress bar just sits, ..... and sits,.......and sits.......

You get the idea. When it finally loads all is well, and the XML is saved properly.
However, if the doctor has an interruption and he minimizes the applet he/she may forget it is in use later and if they click on the patient's form again here we go again with the nightmare loading for 5 minutes or longer.

Hence, the doctors don't use it. Doctors have to take classes to learn how to use the Hospital software before they can even practice in the hospital.
So when a piece of software takes too long to load it is not used.

I'm sure anybody writing code professionally experiences the same thing.
This project got pitched to me because it has cost a lot of time already and the quality programmers have more productive things to do.
I enjoy trouble shooting systems, and this has all the earmarks of an involved, deep joyride into frustration and final completion.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

The first few steps to debugging this:

The first thing I'd do is track down the total size of the applet download. If it's a huge amount of code, perhaps there's a way to cut it back.

If it's not the download, then find out what's going on while that progress bar is ticking along. What work is being done? Perhaps there's a way to do it faster.


[Jess in Action][AskingGoodQuestions]
Chetan Graham
Greenhorn

Joined: Dec 01, 2007
Posts: 21
Originally posted by Ernest Friedman-Hill:
The first thing I'd do is track down the total size of the applet download. If it's a huge amount of code, perhaps there's a way to cut it back.

It is not huge but it is enough to cause some time loss, perhaps. I will get the exact size. And it has already been cleaned up some, with other code add ons too, like adding color choices to the palette.


If it's not the download, then find out what's going on while that progress bar is ticking along. What work is being done? Perhaps there's a way to do it faster.


This will take time to get access to the server. I am in that process now as we are very busy with other affairs and my small project is important but not to get in the way of other more pertinent projects.
Bear with me, I will get back with the next update. Chetan signing out and thanks!


[ March 08, 2008: Message edited by: Chetan Graham ]
Chetan Graham
Greenhorn

Joined: Dec 01, 2007
Posts: 21
Here are most of the imports...


The applet file size is approximately 302KB this does not include the java class files that need to be downloaded as well.

I would think this is big enough to slow somewhat but certainly not the 5 minute wait.

Thanks,
Chetan
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41599
    
  55
The imports you list above are all part of the JRE - they don't need to be downloaded, and thus won't prolong the download/startup time. Are you using 3rd party libraries that do need to be downloaded? Or other resources like images or data files?


Ping & DNS - my free Android networking tools app
Chetan Graham
Greenhorn

Joined: Dec 01, 2007
Posts: 21
Originally posted by Ulf Dittmer:
The imports you list above are all part of the JRE - they don't need to be downloaded, and thus won't prolong the download/startup time. Are you using 3rd party libraries that do need to be downloaded? Or other resources like images or data files?


Please remember that of the close to 5000 different workstations and machines it is not possible to have the same versions of Java or the VM on the client side.

The image is part of the 300KB. The DataBase with the XML files has to be accessed. These are small files, like the basic patient information to label the annotation.

Thanks for your help.
[ March 09, 2008: Message edited by: Chetan Graham ]
Chetan Graham
Greenhorn

Joined: Dec 01, 2007
Posts: 21
Originally posted by Ulf Dittmer:
The imports you list above are all part of the JRE - they don't need to be downloaded, and thus won't prolong the download/startup time. Are you using 3rd party libraries that do need to be downloaded? Or other resources like images or data files?


I realized that this applet is written using Swing and AWT. It has been brought to my attention that this causes many problems and that in general since Swing sits on top of AWT that there should be a clear separation of coding while using Swing.

Also AWT is thread safe and Swing is not so one must be careful to use the event handler properly.
I am finding this program has had many different minded programmers write different parts and there is a certain confusion.
I am looking seriously at rewriting the whole thing properly. Yet this seems almost more than my ability can handle.
Changing the AWT to Swing may be a simpler or less time consuming way.
Simply adding another thread during the "init" to help the GUI come up faster may help.
So much to consider and yet I feel I am not ready to make a major change as yet. So I am plodding along making small improvements to the tools and fixing bugs.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

"The DataBase with the XML files has to be accessed".

There's an important place to look. Database transactions can be slow, whether you're really talking to a remote database directly from an applet, or if there's a middle tier on the server that's talking to the database, and then the applet is talking to that middle tier.

The stuff you say about "all the different kinds of Java" and that this somehow causes a lot of hunting around for versions of classes doesn't make any sense, nor is it anything you need to worry about.

In any case, blindly making small changes isn't going to help, nor is changing from Swing to AWT. The only thing that will help is study and measurement. If you need to speed things up, then you need to find out where the time goes.
Chetan Graham
Greenhorn

Joined: Dec 01, 2007
Posts: 21
Originally posted by Ernest Friedman-Hill:
"The DataBase with the XML files has to be accessed".

There's an important place to look. Database transactions can be slow, whether you're really talking to a remote database directly from an applet, or if there's a middle tier on the server that's talking to the database, and then the applet is talking to that middle tier.

The stuff you say about "all the different kinds of Java" and that this somehow causes a lot of hunting around for versions of classes doesn't make any sense, nor is it anything you need to worry about.

In any case, blindly making small changes isn't going to help, nor is changing from Swing to AWT. The only thing that will help is study and measurement. If you need to speed things up, then you need to find out where the time goes.


Thanks for you replies. I'm still trying to get access to the server on one system to test. I will focus on the Study and Measurement.
I wonder if Thread tracking is an obvious choice in measurement. Perhaps I need to introduce another thread for getting over the init period or loading period.
Chetan Graham
Greenhorn

Joined: Dec 01, 2007
Posts: 21
To All,
I am still working night and day on this applet.
I have finally received news from the big boss that this applet's problem in loading is not the twenty versions of java and different OS's on all the different workstations like he originally brought up.

He now agrees with my first statement to him that this applet is so poorly written and upon loading goes into an endless loops.

It is the whole applet that needs to be rewritten and this is what I am now understanding. The six draw tools with the saving and retrieving the xml files to the database has to be completely redone.

Every time I polish one of the draw tools to perform better or fix a bug in a tool, more cracks appear in the plaster wall of the platform.

The concept of rewrite the fundamental platform or just polish the poor code is not new by any means.

I realize this is quite the undertaking and pray I am up to it.

Here is one error I receive on loading the applet on my workstation many times. If I just click inside the applet window it begins working and the error message is a thing of the past. It comes and goes. There is no xml file to load, no network to deal with, just this hard drive, eclipse, java and physical mem called on.






[ April 04, 2008: Message edited by: Chetan Graham ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Applet loads very slowly!