Jar file preloading before a go-live

Sometimes, when you go live an application handling a big applet you could have not network problem as if all the user try to get the associated Jar files in parallel this could saturate your network and impact your go-live.

One of the solution is to pre-load these JAR files into the browser of each user. Unfortunately is sound not possible to copy the files into a specific directory to do it : the Jar files must be loaded for the server.

It is possible to create a small applet doing nothing but containing the needed commands to preload the jar file. This applet can be started by the users before the go live, services by services to fill the JVM cache and to avoid a reload during go-live operation.

The html file can be executed locally or remotely depend of your choice. Here are two examples :

With a local file to execute from the desktop:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <title>JAR Preloading/caching</title>
  </head>
  <body>
  <p>Preloading in progress</p>

  <applet codebase="<codebaseifneeded>"
   code="myappletdoingnothing.class"
   cache_archive_ex="http://<servername>:<port>/pathtojarfile/jarfile1.jar;preload,
   http://<servername>:<port>/pathtojarfile/jarfile2.jar;preload"
   width=600 height=600 >
  </applet>
  </body>
</html>

With a file deployed on the server where the Jar are located:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <title>JAR Preloading/caching</title>
  </head>
  <body>
  <p>Preloading in progress</p>

  <applet codebase="<codebaseifneeded>"
   code="myappletdoingnothing.class"
   cache_archive_ex="/pathtojarfile/jarfile1.jar;preload,
   /pathtojarfile/jarfile2.jar;preload"
   width=600 height=600 >
  </applet>
  </body>
</html>

All the Jar files indicated in the cache_archive_ex parameter will be preloaded as indicated after each of them, even if they are not used by the myappletdoingnothing stuff.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.